From 820451efed0d9a02399cf06040d4384e92568f8a Mon Sep 17 00:00:00 2001 From: Vladislav Veselskiy Date: Sat, 25 Jan 2025 12:34:11 +0300 Subject: [PATCH] Save response status to span. --- fcm.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fcm.go b/fcm.go index 161aea3..959782e 100644 --- a/fcm.go +++ b/fcm.go @@ -28,6 +28,7 @@ import ( "golang.org/x/oauth2" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" ) const tracerName = "git.bit5.ru/backend/fcm" @@ -188,6 +189,10 @@ func (c *Client) doSendRequest(ctx context.Context, req SendRequest, loggerEnabl } defer response.Body.Close() + span.SetAttributes( + attribute.Int("response.status_code", response.StatusCode), + ) + if response.StatusCode != http.StatusOK { body, err := ioutil.ReadAll(response.Body) if err != nil {