Add span attribute request_body.

This commit is contained in:
Владислав Весельский 2025-01-28 15:27:58 +03:00
parent 86e7c8815f
commit e3ee45f895
1 changed files with 4 additions and 0 deletions

4
fcm.go
View File

@ -225,6 +225,10 @@ func (c *Client) doSendRequest(ctx context.Context, req SendRequest, loggerEnabl
) )
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)