diff --git a/fcm.go b/fcm.go index 7110c88..b1cb310 100644 --- a/fcm.go +++ b/fcm.go @@ -188,6 +188,9 @@ func (c *Client) doSendRequest(ctx context.Context, req SendRequest, loggerEnabl span.RecordError(err) return SendResponse{}, errors.WithStack(err) } + span.SetAttributes( + attribute.String("request.body", string(data)), + ) if loggerEnabled { c.logger.Info("sending", "message", data) } @@ -221,14 +224,10 @@ func (c *Client) doSendRequest(ctx context.Context, req SendRequest, loggerEnabl span.SetAttributes( attribute.Int("response.status_code", response.StatusCode), - attribute.String("response_body", bodyStr), + attribute.String("response.body", bodyStr), ) 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) span.SetStatus(codes.Error, err.Error()) span.RecordError(err)