From ae9b30ea0951b27a7945cad272a5ee8a2324e7df Mon Sep 17 00:00:00 2001 From: Sylvain Muller Date: Wed, 9 Oct 2024 22:17:51 +0200 Subject: [PATCH] feat(deps): update fox to v0.16.0 (#4) --- foxtrace.go | 7 ++++--- foxtrace_test.go | 2 +- go.mod | 14 +++++++------- go.sum | 24 ++++++++++++------------ 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/foxtrace.go b/foxtrace.go index f167e25..256f97e 100644 --- a/foxtrace.go +++ b/foxtrace.go @@ -90,11 +90,12 @@ func (t *Tracer) Trace(next fox.HandlerFunc) fox.HandlerFunc { ctx, span := t.tracer.Start(ctx, spanName, opts...) defer span.End() - c.SetRequest(req.WithContext(ctx)) + cc := c.CloneWith(c.Writer(), req.WithContext(ctx)) + defer cc.Close() - next(c) + next(cc) - status := c.Writer().Status() + status := cc.Writer().Status() span.SetStatus(httpconv.ServerStatus(status)) if status > 0 { span.SetAttributes(semconv.HTTPStatusCode(status)) diff --git a/foxtrace_test.go b/foxtrace_test.go index d5d7664..f7e6fdd 100644 --- a/foxtrace_test.go +++ b/foxtrace_test.go @@ -79,7 +79,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { router := fox.New() mw := New("foobar", WithTracerProvider(provider), WithPropagators(b3)) - err := router.Handle(http.MethodGet, "/user/:id", mw.Trace(func(c fox.Context) { + err := router.Handle(http.MethodGet, "/user/{id}", mw.Trace(func(c fox.Context) { span := trace.SpanFromContext(c.Request().Context()) assert.Equal(t, sc.TraceID(), span.SpanContext().TraceID()) assert.Equal(t, sc.SpanID(), span.SpanContext().SpanID()) diff --git a/go.mod b/go.mod index 03b8502..8c660fa 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/tigerwill90/otelfox -go 1.21 +go 1.23 require ( github.com/stretchr/testify v1.9.0 - github.com/tigerwill90/fox v0.15.0 - go.opentelemetry.io/contrib/propagators/b3 v1.28.0 - go.opentelemetry.io/otel v1.28.0 - go.opentelemetry.io/otel/trace v1.28.0 + github.com/tigerwill90/fox v0.16.0 + go.opentelemetry.io/contrib/propagators/b3 v1.30.0 + go.opentelemetry.io/otel v1.30.0 + go.opentelemetry.io/otel/trace v1.30.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.28.0 // indirect - golang.org/x/sys v0.22.0 // indirect + go.opentelemetry.io/otel/metric v1.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 6a2d4ce..676fe0b 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.15.0 h1:ff4cxNrnCHvXPagkVUOSBDsJeibWQgM8k98VBPxGX88= -github.com/tigerwill90/fox v0.15.0/go.mod h1:1D355//lMLlduFSNb1fS+w+TK9svw/sjhH/h9tAD4KQ= -go.opentelemetry.io/contrib/propagators/b3 v1.28.0 h1:XR6CFQrQ/ttAYmTBX2loUEFGdk1h17pxYI8828dk/1Y= -go.opentelemetry.io/contrib/propagators/b3 v1.28.0/go.mod h1:DWRkzJONLquRz7OJPh2rRbZ7MugQj62rk7g6HRnEqh0= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +github.com/tigerwill90/fox v0.16.0 h1:p/1xOID3MTw8rtVMxw+Ji/ogMhACh6tQQg9H5JlNCVM= +github.com/tigerwill90/fox v0.16.0/go.mod h1:ujscTs1DtEAaU/wrPKB7dw65yQiXTIFVJJiNTSFZgBs= +go.opentelemetry.io/contrib/propagators/b3 v1.30.0 h1:vumy4r1KMyaoQRltX7cJ37p3nluzALX9nugCjNNefuY= +go.opentelemetry.io/contrib/propagators/b3 v1.30.0/go.mod h1:fRbvRsaeVZ82LIl3u0rIvusIel2UUf+JcaaIpy5taho= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.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=