mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
StartServerSpan had the wrong spankind
This commit is contained in:
parent
a91d7ad952
commit
cd9665f107
1 changed files with 7 additions and 12 deletions
|
|
@ -40,14 +40,14 @@ func Int64Attribute(key string, val int64) Attribute {
|
||||||
return attribute.Int64(key, val)
|
return attribute.Int64(key, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartSpan creates an internal span.
|
// StartSpan creates a SpanKind=INTERNAL span.
|
||||||
func StartSpan(ctx context.Context, spanName string, attributes ...Attribute) (context.Context, trace.Span, func(error)) {
|
func StartSpan(ctx context.Context, spanName string, attributes ...Attribute) (context.Context, trace.Span, func(error)) {
|
||||||
return StartSpanWithTracer(ctx, otel.Tracer(""), spanName, attributes...)
|
return StartSpanWithTracer(ctx, otel.Tracer(""), spanName, attributes...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartSpanWithTracer requires a tracer to be passed in and creates a SpanKind=INTERNAL span.
|
// StartSpanWithTracer requires a tracer to be passed in and creates a SpanKind=INTERNAL span.
|
||||||
func StartSpanWithTracer(ctx context.Context, tracer trace.Tracer, name string, attributes ...Attribute) (context.Context, trace.Span, func(error)) {
|
func StartSpanWithTracer(ctx context.Context, tracer trace.Tracer, name string, attributes ...Attribute) (context.Context, trace.Span, func(error)) {
|
||||||
return startSpan(ctx, tracer, name, attributes...)
|
return startSpan(ctx, tracer, trace.SpanKindInternal, name, attributes...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RPCInfo contains information about the RPC request.
|
// RPCInfo contains information about the RPC request.
|
||||||
|
|
@ -74,18 +74,13 @@ func StartServerSpan(ctx context.Context, tracer trace.Tracer, rpc RPCInfo, othe
|
||||||
others...,
|
others...,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
ctx, span := tracer.Start(ctx, name, trace.WithSpanKind(trace.SpanKindInternal))
|
ctx, _, end := startSpan(ctx, tracer, trace.SpanKindServer, name, attributes...)
|
||||||
|
return ctx, end
|
||||||
if len(attributes) > 0 {
|
|
||||||
span.SetAttributes(attributes...)
|
|
||||||
}
|
|
||||||
return ctx, endSpan(span)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// startSpan creates an internal span.
|
// startSpan creates a span with the given kind.
|
||||||
func startSpan(ctx context.Context, tracer trace.Tracer, spanName string, attributes ...Attribute) (context.Context, trace.Span, func(error)) {
|
func startSpan(ctx context.Context, tracer trace.Tracer, kind trace.SpanKind, spanName string, attributes ...Attribute) (context.Context, trace.Span, func(error)) {
|
||||||
ctx, span := tracer.Start(ctx, spanName, trace.WithSpanKind(trace.SpanKindInternal))
|
ctx, span := tracer.Start(ctx, spanName, trace.WithSpanKind(kind))
|
||||||
|
|
||||||
if len(attributes) > 0 {
|
if len(attributes) > 0 {
|
||||||
span.SetAttributes(attributes...)
|
span.SetAttributes(attributes...)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue