diff --git a/foxtrace.go b/foxtrace.go index aa2e978..f77ee77 100644 --- a/foxtrace.go +++ b/foxtrace.go @@ -19,7 +19,7 @@ type Tracer struct { cfg *config } -// New creates a new Tracer middleware for the given service. +// New creates a new [Tracer] middleware for the given service. // Options can be provided to configure the tracer. func New(service string, opts ...Option) *Tracer { cfg := defaultConfig() @@ -35,7 +35,7 @@ func New(service string, opts ...Option) *Tracer { } } -// Middleware is a convenience function that creates a new Tracer middleware instance +// Middleware is a convenience function that creates a new [Tracer] middleware instance // for the specified service and returns the Trace middleware function. // Options can be provided to configure the tracer. func Middleware(service string, opts ...Option) fox.MiddlewareFunc { @@ -77,7 +77,7 @@ func (t *Tracer) Trace(next fox.HandlerFunc) fox.HandlerFunc { var spanName string if t.cfg.spanFmt == nil { - spanName = c.Path() + spanName = c.Pattern() } else { spanName = t.cfg.spanFmt(c) } diff --git a/foxtrace_test.go b/foxtrace_test.go index 0cdab03..f9fa2f6 100644 --- a/foxtrace_test.go +++ b/foxtrace_test.go @@ -122,7 +122,7 @@ func TestWithSpanAttributes(t *testing.T) { span := trace.SpanFromContext(c.Request().Context()) assert.Equal(t, sc.TraceID(), span.SpanContext().TraceID()) assert.Equal(t, sc.SpanID(), span.SpanContext().SpanID()) - }), fox.WithAnnotation("foo", "bar")) + }), fox.WithAnnotations(fox.Annotation{Key: "foo", Value: "bar"})) require.NoError(t, err) router.ServeHTTP(w, r) diff --git a/go.mod b/go.mod index 30bebc2..d2dcd63 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/tigerwill90/otelfox -go 1.23 +go 1.23.0 require ( github.com/stretchr/testify v1.9.0 - github.com/tigerwill90/fox v0.17.1 - go.opentelemetry.io/contrib/propagators/b3 v1.31.0 - go.opentelemetry.io/otel v1.31.0 - go.opentelemetry.io/otel/trace v1.31.0 + github.com/tigerwill90/fox v0.18.0 + go.opentelemetry.io/contrib/propagators/b3 v1.32.0 + go.opentelemetry.io/otel v1.32.0 + go.opentelemetry.io/otel/trace v1.32.0 ) require ( @@ -16,7 +16,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.31.0 // indirect - golang.org/x/sys v0.26.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + golang.org/x/sys v0.27.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 465436c..22773f1 100644 --- a/go.sum +++ b/go.sum @@ -20,18 +20,18 @@ github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUA github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tigerwill90/fox v0.17.1 h1:kH7NdRbEKb/8UuS1tbFGOnxlRLcEFj0Zq1mdjjCNJAM= -github.com/tigerwill90/fox v0.17.1/go.mod h1:ujscTs1DtEAaU/wrPKB7dw65yQiXTIFVJJiNTSFZgBs= -go.opentelemetry.io/contrib/propagators/b3 v1.31.0 h1:PQPXYscmwbCp76QDvO4hMngF2j8Bx/OTV86laEl8uqo= -go.opentelemetry.io/contrib/propagators/b3 v1.31.0/go.mod h1:jbqfV8wDdqSDrAYxVpXQnpM0XFMq2FtDesblJ7blOwQ= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +github.com/tigerwill90/fox v0.18.0 h1:2Hqxe9p2hN7qu8QOEfMEHbCdXe6R3TX9vYA9hpaQ5VM= +github.com/tigerwill90/fox v0.18.0/go.mod h1:njvaFTnPHMXIGKqnQn2Y5YiE7GWzukAAxQJEcb/9KBM= +go.opentelemetry.io/contrib/propagators/b3 v1.32.0 h1:MazJBz2Zf6HTN/nK/s3Ru1qme+VhWU5hm83QxEP+dvw= +go.opentelemetry.io/contrib/propagators/b3 v1.32.0/go.mod h1:B0s70QHYPrJwPOwD1o3V/R8vETNOG9N3qZf4LDYvA30= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/option.go b/option.go index 10eff71..dfb6b73 100644 --- a/option.go +++ b/option.go @@ -29,7 +29,7 @@ type SpanNameFormatter func(c fox.Context) string // SpanAttributesFunc is a function type that can be used to dynamically // generate span attributes for a given HTTP request. It is used in -// conjunction with the WithSpanAttributes middleware option. +// conjunction with the [WithSpanAttributes] middleware option. type SpanAttributesFunc func(c fox.Context) []attribute.KeyValue type config struct { @@ -73,7 +73,7 @@ func WithTracerProvider(provider trace.TracerProvider) Option { } // WithTextMapCarrier specify a carrier to use for extracting information from http request. -// If none is specified, propagation.HeaderCarrier is used. +// If none is specified, [propagation.HeaderCarrier] is used. func WithTextMapCarrier(fn func(r *http.Request) propagation.TextMapCarrier) Option { return optionFunc(func(c *config) { if fn != nil { diff --git a/version.go b/version.go index 190f17f..8cbe19d 100644 --- a/version.go +++ b/version.go @@ -2,7 +2,7 @@ package otelfox import "fmt" -const version = "v0.17.1" +const version = "v0.18.0" var semver = fmt.Sprintf("semver:%s", version)