Merge remote-tracking branch 'og/main'
This commit is contained in:
commit
2567f02e81
11 changed files with 237 additions and 37 deletions
12
internal/otel/otel.go
Normal file
12
internal/otel/otel.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
//go:build !no_otel
|
||||
|
||||
package otel
|
||||
|
||||
import (
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
func Tracer(name string) trace.Tracer {
|
||||
return otel.Tracer(name)
|
||||
}
|
22
internal/otel/shim.go
Normal file
22
internal/otel/shim.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
//go:build no_otel
|
||||
|
||||
package otel
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type FakeTracer struct{}
|
||||
type FakeSpan struct{}
|
||||
|
||||
func Tracer(name string) FakeTracer {
|
||||
return FakeTracer{}
|
||||
}
|
||||
|
||||
func (t FakeTracer) Start(ctx context.Context, _ string) (context.Context, FakeSpan) {
|
||||
return ctx, FakeSpan{}
|
||||
}
|
||||
|
||||
func (s FakeSpan) End() {
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue