Save response status to span.
This commit is contained in:
parent
ce36c038cc
commit
820451efed
5
fcm.go
5
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 {
|
||||
|
|
Loading…
Reference in New Issue