From f7b9da077eaad0bd49843e85f3136468aa2bbec2 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 19 Dec 2024 01:03:20 -0700 Subject: [PATCH] Fix builds and tests --- examples/go.mod | 17 +++++++++-------- examples/go.sum | 38 ++++++++++++++++++++------------------ grpc/interceptor_test.go | 34 +++++++++++++++++----------------- otel/go.mod | 6 +++--- otel/go.sum | 16 ++++++++-------- otel/otel_test.go | 2 ++ 6 files changed, 59 insertions(+), 54 deletions(-) diff --git a/examples/go.mod b/examples/go.mod index fbd7a48..fdbb8c8 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -4,16 +4,17 @@ go 1.21 require ( github.com/veqryn/slog-context v0.7.0 - github.com/veqryn/slog-context/otel v0.6.0 - go.opentelemetry.io/otel v1.24.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 - go.opentelemetry.io/otel/sdk v1.24.0 - go.opentelemetry.io/otel/trace v1.24.0 + github.com/veqryn/slog-context/otel v0.7.0 + go.opentelemetry.io/otel v1.29.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.29.0 + go.opentelemetry.io/otel/sdk v1.29.0 + go.opentelemetry.io/otel/trace v1.29.0 ) require ( - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.24.0 // indirect - golang.org/x/sys v0.18.0 // indirect + github.com/google/uuid v1.6.0 // indirect + go.opentelemetry.io/otel/metric v1.29.0 // indirect + golang.org/x/sys v0.24.0 // indirect ) diff --git a/examples/go.sum b/examples/go.sum index 4c49ce1..76978b3 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -1,31 +1,33 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +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/veqryn/slog-context v0.7.0 h1:Ne7ajlR6Mjs2rQQtpg8k0eO6krR5wzpareh5VpV+V2s= github.com/veqryn/slog-context v0.7.0/go.mod h1:E+qpdyiQs2YKRxFnX1JjpdFE1z3Ka94Kem2q9ZG6Jjo= -github.com/veqryn/slog-context/otel v0.6.0 h1:LwVMzfKMFhVpIKPASwa4IkzgL8+/bmyrFWJYrBIkpf0= -github.com/veqryn/slog-context/otel v0.6.0/go.mod h1:0l6vQ7IqZHKq1MH7pyhNlbdUutBcuiGYJluAPLQ33Nk= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 h1:s0PHtIkN+3xrbDOpt2M8OTG92cWqUESvzh2MxiR5xY8= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0/go.mod h1:hZlFbDbRt++MMPCCfSJfmhkGIWnX1h3XjkfxZUjLrIA= -go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= -go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +github.com/veqryn/slog-context/otel v0.7.0 h1:7JptnwF5XyEVSygzilp/LqRmjSymqGBgFcKG5MZLvnU= +github.com/veqryn/slog-context/otel v0.7.0/go.mod h1:Zqag1kf9g8K5ZPIJjgLYwqtWCaEPzXXZEzgguvxPCws= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.29.0 h1:X3ZjNp36/WlkSYx0ul2jw4PtbNEDDeLskw3VPsrpYM0= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.29.0/go.mod h1:2uL/xnOXh0CHOBFCWXz5u1A4GXLiW+0IQIzVbeOEQ0U= +go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= +go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= +go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= +go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/grpc/interceptor_test.go b/grpc/interceptor_test.go index 655c2d3..6a9386e 100644 --- a/grpc/interceptor_test.go +++ b/grpc/interceptor_test.go @@ -189,13 +189,13 @@ func TestClientStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up err = stream.Send(&protogen.TestReq{Name: "clientRequest2"}) if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up _, err = stream.CloseAndRecv() if err != nil { @@ -251,13 +251,13 @@ func TestClientStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up err = stream.Send(&protogen.TestReq{}) if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up _, err = stream.CloseAndRecv() if err == nil { @@ -313,13 +313,13 @@ func TestClientStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up err = stream.Send(&protogen.TestReq{Name: "clientRequest2"}) if err != io.EOF { t.Fatal("expected EOF") } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up _, err = stream.CloseAndRecv() if err == nil { @@ -613,7 +613,7 @@ func TestBidirectionalStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up _, err = stream.Recv() if err != nil { @@ -624,7 +624,7 @@ func TestBidirectionalStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up // streams should always be closed after last send err = stream.CloseSend() @@ -698,7 +698,7 @@ func TestBidirectionalStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up _, err = stream.Recv() if err != nil { @@ -709,7 +709,7 @@ func TestBidirectionalStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up _, err = stream.Recv() if err == nil { @@ -777,7 +777,7 @@ func TestBidirectionalStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up _, err = stream.Recv() if err != nil { @@ -788,14 +788,14 @@ func TestBidirectionalStreaming(t *testing.T) { if err != nil { t.Fatal(err) } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the server catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the server catch up _, err = stream.Recv() if err != nil { t.Fatal(err) } - time.Sleep(100*time.Millisecond) // Let the server catch up + time.Sleep(100 * time.Millisecond) // Let the server catch up err = stream.Send(&protogen.TestReq{Name: "clientRequest3"}) if err != io.EOF { @@ -811,7 +811,7 @@ func TestBidirectionalStreaming(t *testing.T) { // Should always keep receiving until error for { _, err = stream.Recv() - if err != nil { + if err != nil { break } } @@ -975,7 +975,7 @@ func (s *server) ServerStream(req *protogen.TestReq, stream grpc.ServerStreaming // fmt.Println(err) return err } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the client catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the client catch up } if rerr != nil { return rerr @@ -1004,7 +1004,7 @@ func (s *server) BidirectionalStream(stream grpc.BidiStreamingServer[protogen.Te // fmt.Println(err) return err } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the client catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the client catch up } if rerr != nil { return rerr @@ -1019,7 +1019,7 @@ func (s *server) BidirectionalStream(stream grpc.BidiStreamingServer[protogen.Te // fmt.Println(err) return err } - time.Sleep(10*time.Millisecond) // GRPC buffers under the hood, so let the client catch up + time.Sleep(10 * time.Millisecond) // GRPC buffers under the hood, so let the client catch up } if rerr != nil { return rerr diff --git a/otel/go.mod b/otel/go.mod index ebd4c5e..31be024 100644 --- a/otel/go.mod +++ b/otel/go.mod @@ -4,8 +4,8 @@ go 1.21 require ( github.com/veqryn/slog-context v0.7.0 - go.opentelemetry.io/otel v1.24.0 - go.opentelemetry.io/otel/trace v1.24.0 + go.opentelemetry.io/otel v1.29.0 + go.opentelemetry.io/otel/trace v1.29.0 ) -require github.com/go-logr/logr v1.4.1 // indirect +require github.com/go-logr/logr v1.4.2 // indirect diff --git a/otel/go.sum b/otel/go.sum index b985d82..56ff85e 100644 --- a/otel/go.sum +++ b/otel/go.sum @@ -1,18 +1,18 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +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/veqryn/slog-context v0.7.0 h1:Ne7ajlR6Mjs2rQQtpg8k0eO6krR5wzpareh5VpV+V2s= github.com/veqryn/slog-context v0.7.0/go.mod h1:E+qpdyiQs2YKRxFnX1JjpdFE1z3Ka94Kem2q9ZG6Jjo= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/otel/otel_test.go b/otel/otel_test.go index 8b20922..66f10a6 100644 --- a/otel/otel_test.go +++ b/otel/otel_test.go @@ -119,3 +119,5 @@ func (*recorderSpan) SetName(string) {} // TracerProvider returns nil. func (*recorderSpan) TracerProvider() trace.TracerProvider { return nil } + +func (r *recorderSpan) AddLink(link trace.Link) {}