Skip to content

Commit

Permalink
added noop adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Oct 14, 2024
1 parent bb52927 commit 2ef5b21
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions otel/noop.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package otel

import (
"context"

"github.com/ydb-platform/ydb-go-sdk/v3/trace"
)

var (
_ Config = noopConfig{}
_ Span = noopSpan{}
)

type (
noopConfig struct{}
noopSpan struct{}
)

func (noopSpan) TraceID() string {
return ""
}

func (n noopSpan) Msg(string, ...KeyValue) {}

func (n noopSpan) End(...KeyValue) {}

func (noopConfig) Details() trace.Details {
return 0
}

func (noopConfig) SpanFromContext(context.Context) Span {
return noopSpan{}
}

func (noopConfig) Start(ctx context.Context, _ string, _ ...KeyValue) (context.Context, Span) {
return ctx, noopSpan{}
}

0 comments on commit 2ef5b21

Please sign in to comment.