add tracer enabled status
All checks were successful
coverage / build (push) Successful in 1m39s
test / test (push) Successful in 4m22s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2025-05-19 09:42:38 +03:00
parent 979dde6c24
commit 9294657af5
3 changed files with 7 additions and 1 deletions

2
go.mod
View File

@@ -7,7 +7,7 @@ toolchain go1.23.4
require (
github.com/opentracing/opentracing-go v1.2.0
go.opentelemetry.io/otel v1.35.0
go.unistack.org/micro/v4 v4.1.6
go.unistack.org/micro/v4 v4.1.14
)
require (

2
go.sum
View File

@@ -24,5 +24,7 @@ go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
go.unistack.org/micro/v4 v4.1.6 h1:sYLpe1Vd8/lDwddtV0BLTvJ+i+fllXAS4fZngT1wKZ4=
go.unistack.org/micro/v4 v4.1.6/go.mod h1:lr3oYED8Ay1vjK68QqRw30QOtdk/ffpZqMFDasOUhKw=
go.unistack.org/micro/v4 v4.1.14 h1:6EotPq9kz/gaFb5YulHdKuuUwmj/7Hk44DpOlzh/A6k=
go.unistack.org/micro/v4 v4.1.14/go.mod h1:xleO2M5Yxh4s6I+RUcLrEpUjobefh+71ctrdIfn7TUs=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -261,6 +261,10 @@ func (t *otTracer) startSpanFromAny(ctx context.Context, name string, opts ...ot
return t.startSpanFromContext(ctx, name, opts...)
}
func (t *otTracer) Enabled() bool {
return t.opts.Enabled
}
func (t *otTracer) startSpanFromContext(ctx context.Context, name string, opts ...ot.StartSpanOption) (context.Context, ot.Span) {
var parentSpan ot.Span
if tracerSpan, ok := tracer.SpanFromContext(ctx); ok && tracerSpan != nil {