From 31f060f2bd08242c547a542701b91c3012355c76 Mon Sep 17 00:00:00 2001 From: Alagunto Date: Thu, 5 Sep 2024 07:47:09 +0400 Subject: [PATCH] add some clarity to the spans --- near.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/near.go b/near.go index dbaa8a0..3478899 100644 --- a/near.go +++ b/near.go @@ -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 + }), + ), }, }), } @@ -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),