Output reqest body.
This commit is contained in:
parent
e3ee45f895
commit
0a8bde4947
9
fcm.go
9
fcm.go
|
@ -188,6 +188,9 @@ func (c *Client) doSendRequest(ctx context.Context, req SendRequest, loggerEnabl
|
||||||
span.RecordError(err)
|
span.RecordError(err)
|
||||||
return SendResponse{}, errors.WithStack(err)
|
return SendResponse{}, errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
span.SetAttributes(
|
||||||
|
attribute.String("request.body", string(data)),
|
||||||
|
)
|
||||||
if loggerEnabled {
|
if loggerEnabled {
|
||||||
c.logger.Info("sending", "message", data)
|
c.logger.Info("sending", "message", data)
|
||||||
}
|
}
|
||||||
|
@ -221,14 +224,10 @@ func (c *Client) doSendRequest(ctx context.Context, req SendRequest, loggerEnabl
|
||||||
|
|
||||||
span.SetAttributes(
|
span.SetAttributes(
|
||||||
attribute.Int("response.status_code", response.StatusCode),
|
attribute.Int("response.status_code", response.StatusCode),
|
||||||
attribute.String("response_body", bodyStr),
|
attribute.String("response.body", bodyStr),
|
||||||
)
|
)
|
||||||
|
|
||||||
if response.StatusCode != http.StatusOK {
|
if response.StatusCode != http.StatusOK {
|
||||||
span.SetAttributes(
|
|
||||||
attribute.String("request_body", string(data)),
|
|
||||||
)
|
|
||||||
|
|
||||||
err := errors.Errorf("Status is not OK. Status: %d. Body: %q.", response.StatusCode, bodyStr)
|
err := errors.Errorf("Status is not OK. Status: %d. Body: %q.", response.StatusCode, bodyStr)
|
||||||
span.SetStatus(codes.Error, err.Error())
|
span.SetStatus(codes.Error, err.Error())
|
||||||
span.RecordError(err)
|
span.RecordError(err)
|
||||||
|
|
Loading…
Reference in New Issue