Skip to content

Commit 23032a0

Browse files
committed
added noop adapter
1 parent b3a6286 commit 23032a0

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

otel/noop.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package otel
2+
3+
import (
4+
"context"
5+
6+
"github.com/ydb-platform/ydb-go-sdk/v3/trace"
7+
)
8+
9+
var (
10+
_ Config = noopConfig{}
11+
_ Span = noopSpan{}
12+
)
13+
14+
type (
15+
noopConfig struct{}
16+
noopSpan struct{}
17+
)
18+
19+
func (noopSpan) TraceID() string {
20+
return ""
21+
}
22+
23+
func (n noopSpan) Msg(string, ...KeyValue) {}
24+
25+
func (n noopSpan) End(...KeyValue) {}
26+
27+
func (noopConfig) Details() trace.Details {
28+
return 0
29+
}
30+
31+
func (noopConfig) SpanFromContext(context.Context) Span {
32+
return noopSpan{}
33+
}
34+
35+
func (noopConfig) Start(ctx context.Context, _ string, _ ...KeyValue) (context.Context, Span) {
36+
return ctx, noopSpan{}
37+
}

0 commit comments

Comments
 (0)