Skip to content

Commit

Permalink
add some clarity to the spans
Browse files Browse the repository at this point in the history
  • Loading branch information
Alagunto committed Sep 5, 2024
1 parent 6d3fcc8 commit 31f060f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions near.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ func NewConnectionWithOTLPTracing(nodeURL string, timeout time.Duration) *Connec
OTLPEnabled: true,
c: jsonrpc.NewClientWithOpts(nodeURL, &jsonrpc.RPCClientOpts{
HTTPClient: &http.Client{
Timeout: timeout,
Transport: otelhttp.NewTransport(http.DefaultTransport),
Timeout: timeout,
Transport: otelhttp.NewTransport(
http.DefaultTransport,
otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string {
return "near-api-go.json-rpc." + operation
}),
),
},
}),
}
Expand All @@ -61,7 +66,7 @@ func (c *Connection) call(ctx context.Context, method string, params ...interfac
ctx, span = otel.GetTracerProvider().Tracer("near-api-go").
Start(
ctx,
method,
"near-api-go."+method,
trace.WithSpanKind(trace.SpanKindInternal),
trace.WithAttributes(
attribute.String("method", method),
Expand Down

0 comments on commit 31f060f

Please sign in to comment.