Save token in span.

This commit is contained in:
Владислав Весельский 2025-02-03 12:05:43 +03:00
parent 678438ace4
commit 65928f4c0b
1 changed files with 6 additions and 1 deletions

7
fcm.go
View File

@ -27,6 +27,7 @@ import (
"go.opentelemetry.io/otel" "go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
) )
const tracerName = "git.bit5.ru/backend/fcm" const tracerName = "git.bit5.ru/backend/fcm"
@ -166,7 +167,11 @@ func (c *Client) Validate(ctx context.Context, message Message) (string, error)
func (c *Client) doSendRequest(ctx context.Context, req SendRequest, loggerEnabled bool) (SendResponse, error) { func (c *Client) doSendRequest(ctx context.Context, req SendRequest, loggerEnabled bool) (SendResponse, error) {
_, span := tracer.Start(ctx, "Client.doSendRequest") spanAttrs := trace.WithAttributes(
attribute.String("token", req.Message.Token),
)
_, span := tracer.Start(ctx, "Client.doSendRequest", spanAttrs)
defer span.End() defer span.End()
accessToken, err := c.ts.Token() accessToken, err := c.ts.Token()