diff --git a/appsec/appsec.go b/appsec/appsec.go index bf086c6806..48587b5f51 100644 --- a/appsec/appsec.go +++ b/appsec/appsec.go @@ -18,8 +18,8 @@ import ( "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/httpsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/appsec" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/log" ) diff --git a/contrib/google.golang.org/grpc/appsec.go b/contrib/google.golang.org/grpc/appsec.go index ac9e9be4c8..b627c4474a 100644 --- a/contrib/google.golang.org/grpc/appsec.go +++ b/contrib/google.golang.org/grpc/appsec.go @@ -8,17 +8,16 @@ package grpc import ( "context" + "github.com/DataDog/appsec-internal-go/netip" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/grpcsec" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/grpcsec/types" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace/grpctrace" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace/httptrace" - "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/grpcsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/grpcsec/types" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace/grpctrace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace/httptrace" - "github.com/DataDog/appsec-internal-go/netip" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" @@ -147,7 +146,7 @@ func setClientIP(ctx context.Context, span *tracer.Span, md metadata.MD) netip.A remoteAddr = p.Addr.String() } ipTags, clientIP := httptrace.ClientIPTags(md, false, remoteAddr) - log.Debug("appsec: http client ip detection returned `%s` given the http headers `%v`", clientIP, md) + instr.Logger().Debug("appsec: http client ip detection returned `%s` given the http headers `%v`", clientIP, md) if len(ipTags) > 0 { trace.SetTags(span, ipTags) } diff --git a/contrib/google.golang.org/grpc/appsec_test.go b/contrib/google.golang.org/grpc/appsec_test.go index 63c79f209c..710436bcc0 100644 --- a/contrib/google.golang.org/grpc/appsec_test.go +++ b/contrib/google.golang.org/grpc/appsec_test.go @@ -13,9 +13,10 @@ import ( "strings" "testing" - pappsec "github.com/DataDog/dd-trace-go/v2/appsec" + "github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2/fixturepb" + "github.com/DataDog/dd-trace-go/v2/appsec" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" - "github.com/DataDog/dd-trace-go/v2/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/testutils" "github.com/stretchr/testify/require" "google.golang.org/grpc" @@ -25,13 +26,12 @@ import ( ) func TestAppSec(t *testing.T) { - appsec.Start() - defer appsec.Stop() - if !appsec.Enabled() { + testutils.StartAppSec(t) + if !instr.AppSecEnabled() { t.Skip("appsec disabled") } - setup := func() (FixtureClient, mocktracer.Tracer, func()) { + setup := func() (fixturepb.FixtureClient, mocktracer.Tracer, func()) { rig, err := newRig(false) require.NoError(t, err) @@ -49,7 +49,7 @@ func TestAppSec(t *testing.T) { // Send a XSS attack in the payload along with the canary value in the RPC metadata ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("dd-canary", "dd-test-scanner-log")) - res, err := client.Ping(ctx, &FixtureRequest{Name: ""}) + res, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: ""}) // Check that the handler was properly called require.NoError(t, err) require.Equal(t, "passed", res.Message) @@ -74,7 +74,7 @@ func TestAppSec(t *testing.T) { require.NoError(t, err) // Send a XSS attack - err = stream.Send(&FixtureRequest{Name: ""}) + err = stream.Send(&fixturepb.FixtureRequest{Name: ""}) require.NoError(t, err) // Check that the handler was properly called @@ -84,7 +84,7 @@ func TestAppSec(t *testing.T) { for i := 0; i < 5; i++ { // Fire multiple times, each time should result in a detected event // Send a SQLi attack - err = stream.Send(&FixtureRequest{Name: fmt.Sprintf("-%[1]d' and %[1]d=%[1]d union select * from users--", i)}) + err = stream.Send(&fixturepb.FixtureRequest{Name: fmt.Sprintf("-%[1]d' and %[1]d=%[1]d union select * from users--", i)}) require.NoError(t, err) // Check that the handler was properly called @@ -133,13 +133,12 @@ func TestAppSec(t *testing.T) { // Test that http blocking works by using custom rules/rules data func TestBlocking(t *testing.T) { t.Setenv("DD_APPSEC_RULES", "../../../internal/appsec/testdata/blocking.json") - appsec.Start() - defer appsec.Stop() - if !appsec.Enabled() { + testutils.StartAppSec(t) + if !instr.AppSecEnabled() { t.Skip("appsec disabled") } - setup := func() (FixtureClient, mocktracer.Tracer, func()) { + setup := func() (fixturepb.FixtureClient, mocktracer.Tracer, func()) { rig, err := newRig(false) require.NoError(t, err) @@ -157,7 +156,7 @@ func TestBlocking(t *testing.T) { // Send a XSS attack in the payload along with the canary value in the RPC metadata ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("dd-canary", "dd-test-scanner-log", "x-client-ip", "1.2.3.4")) - reply, err := client.Ping(ctx, &FixtureRequest{Name: ""}) + reply, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: ""}) require.Nil(t, reply) require.Equal(t, codes.Aborted, status.Code(err)) @@ -176,7 +175,7 @@ func TestBlocking(t *testing.T) { // Send a XSS attack in the payload along with the canary value in the RPC metadata ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("dd-canary", "dd-test-scanner-log", "x-client-ip", "1.2.3.5")) - reply, err := client.Ping(ctx, &FixtureRequest{Name: ""}) + reply, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: ""}) require.Equal(t, "passed", reply.Message) require.Equal(t, codes.OK, status.Code(err)) @@ -211,7 +210,7 @@ func TestBlocking(t *testing.T) { require.NoError(t, err) // Send a XSS attack - err = stream.Send(&FixtureRequest{Name: ""}) + err = stream.Send(&fixturepb.FixtureRequest{Name: ""}) require.NoError(t, err) reply, err := stream.Recv() require.Equal(t, codes.OK, status.Code(err)) @@ -226,13 +225,12 @@ func TestBlocking(t *testing.T) { // Test that user blocking works by using custom rules/rules data func TestUserBlocking(t *testing.T) { t.Setenv("DD_APPSEC_RULES", "../../../internal/appsec/testdata/blocking.json") - appsec.Start() - defer appsec.Stop() - if !appsec.Enabled() { + testutils.StartAppSec(t) + if !instr.AppSecEnabled() { t.Skip("appsec disabled") } - setup := func() (FixtureClient, mocktracer.Tracer, func()) { + setup := func() (fixturepb.FixtureClient, mocktracer.Tracer, func()) { rig, err := newAppsecRig(false) require.NoError(t, err) @@ -250,7 +248,7 @@ func TestUserBlocking(t *testing.T) { // Send a XSS attack in the payload along with the canary value in the RPC metadata ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("user-id", "blocked-user-1")) - reply, err := client.Ping(ctx, &FixtureRequest{Name: ""}) + reply, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: ""}) require.Nil(t, reply) require.Equal(t, codes.Aborted, status.Code(err)) @@ -269,7 +267,7 @@ func TestUserBlocking(t *testing.T) { defer cleanup() ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("user-id", "legit user")) - reply, err := client.Ping(ctx, &FixtureRequest{Name: ""}) + reply, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: ""}) require.Equal(t, "passed", reply.Message) require.Equal(t, codes.OK, status.Code(err)) @@ -282,7 +280,7 @@ func TestUserBlocking(t *testing.T) { defer cleanup() ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("user-id", "blocked-user-1", "x-forwarded-for", "1.2.3.4")) - reply, err := client.Ping(ctx, &FixtureRequest{}) + reply, err := client.Ping(ctx, &fixturepb.FixtureRequest{}) require.Nil(t, reply) require.Equal(t, codes.Aborted, status.Code(err)) @@ -323,7 +321,7 @@ func TestUserBlocking(t *testing.T) { require.NoError(t, err) // Send a XSS attack - err = stream.Send(&FixtureRequest{Name: ""}) + err = stream.Send(&fixturepb.FixtureRequest{Name: ""}) require.NoError(t, err) reply, err := stream.Recv() require.Equal(t, codes.OK, status.Code(err)) @@ -360,13 +358,12 @@ func TestPasslist(t *testing.T) { // but only one of them is passlisted (custom-1 is passlisted, custom-2 is not and must trigger). t.Setenv("DD_APPSEC_RULES", "../../../internal/appsec/testdata/passlist.json") - appsec.Start() - defer appsec.Stop() - if !appsec.Enabled() { + testutils.StartAppSec(t) + if !instr.AppSecEnabled() { t.Skip("appsec disabled") } - setup := func() (FixtureClient, mocktracer.Tracer, func()) { + setup := func() (fixturepb.FixtureClient, mocktracer.Tracer, func()) { rig, err := newRig(false) require.NoError(t, err) @@ -384,7 +381,7 @@ func TestPasslist(t *testing.T) { // Send the payload triggering the sec event thanks to the "zouzou" value in the RPC metadata ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs("dd-canary", "zouzou")) - res, err := client.Ping(ctx, &FixtureRequest{Name: "hello"}) + res, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: "hello"}) // Check that the handler was properly called require.NoError(t, err) @@ -411,7 +408,7 @@ func TestPasslist(t *testing.T) { // Send some messages for i := 0; i < 5; i++ { - err = stream.Send(&FixtureRequest{Name: "hello"}) + err = stream.Send(&fixturepb.FixtureRequest{Name: "hello"}) require.NoError(t, err) // Check that the handler was properly called @@ -444,8 +441,8 @@ func newAppsecRig(traceClient bool, interceptorOpts ...Option) (*appsecRig, erro grpc.StreamInterceptor(StreamServerInterceptor(interceptorOpts...)), ) - fixtureServer := new(appsecFixtureServer) - RegisterFixtureServer(server, fixtureServer) + fixtureServer := &appsecFixtureServer{s: fixturepb.NewFixtureServer()} + fixturepb.RegisterFixtureServer(server, fixtureServer) li, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { @@ -472,7 +469,7 @@ func newAppsecRig(traceClient bool, interceptorOpts ...Option) (*appsecRig, erro port: port, server: server, conn: conn, - client: NewFixtureClient(conn), + client: fixturepb.NewFixtureClient(conn), }, err } @@ -484,7 +481,7 @@ type appsecRig struct { port string listener net.Listener conn *grpc.ClientConn - client FixtureClient + client fixturepb.FixtureClient } func (r *appsecRig) Close() { @@ -493,23 +490,23 @@ func (r *appsecRig) Close() { } type appsecFixtureServer struct { - UnimplementedFixtureServer - s fixtureServer + fixturepb.UnimplementedFixtureServer + s *fixturepb.FixtureSrv } -func (s *appsecFixtureServer) StreamPing(stream Fixture_StreamPingServer) (err error) { +func (s *appsecFixtureServer) StreamPing(stream fixturepb.Fixture_StreamPingServer) (err error) { ctx := stream.Context() md, _ := metadata.FromIncomingContext(ctx) ids := md.Get("user-id") - if err := pappsec.SetUser(ctx, ids[0]); err != nil { + if err := appsec.SetUser(ctx, ids[0]); err != nil { return err } return s.s.StreamPing(stream) } -func (s *appsecFixtureServer) Ping(ctx context.Context, in *FixtureRequest) (*FixtureReply, error) { +func (s *appsecFixtureServer) Ping(ctx context.Context, in *fixturepb.FixtureRequest) (*fixturepb.FixtureReply, error) { md, _ := metadata.FromIncomingContext(ctx) ids := md.Get("user-id") - if err := pappsec.SetUser(ctx, ids[0]); err != nil { + if err := appsec.SetUser(ctx, ids[0]); err != nil { return nil, err } diff --git a/contrib/google.golang.org/grpc/client.go b/contrib/google.golang.org/grpc/client.go index c5c72bb831..ecf3ead2e5 100644 --- a/contrib/google.golang.org/grpc/client.go +++ b/contrib/google.golang.org/grpc/client.go @@ -12,7 +12,6 @@ import ( "github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2/internal/grpcutil" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" - "github.com/DataDog/dd-trace-go/v2/internal/log" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" @@ -37,7 +36,7 @@ func (cs *clientStream) RecvMsg(m interface{}) (err error) { cs.Context(), cs.method, "grpc.message", - cs.cfg.serviceName, + cs.cfg.serviceName.String(), cs.cfg.startSpanOptions()..., ) span.SetTag(ext.Component, componentName) @@ -56,7 +55,7 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { cs.Context(), cs.method, "grpc.message", - cs.cfg.serviceName, + cs.cfg.serviceName.String(), cs.cfg.startSpanOptions()..., ) span.SetTag(ext.Component, componentName) @@ -77,7 +76,7 @@ func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { for _, fn := range opts { fn.apply(cfg) } - log.Debug("contrib/google.golang.org/grpc: Configuring StreamClientInterceptor: %#v", cfg) + instr.Logger().Debug("contrib/google.golang.org/grpc: Configuring StreamClientInterceptor: %#v", cfg) return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { var methodKind string if desc != nil { @@ -148,7 +147,7 @@ func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor { for _, fn := range opts { fn.apply(cfg) } - log.Debug("contrib/google.golang.org/grpc: Configuring UnaryClientInterceptor: %#v", cfg) + instr.Logger().Debug("contrib/google.golang.org/grpc: Configuring UnaryClientInterceptor: %#v", cfg) return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { if _, ok := cfg.untracedMethods[method]; ok { return invoker(ctx, method, req, reply, cc, opts...) @@ -173,7 +172,7 @@ func doClientRequest( ctx, method, cfg.spanName, - cfg.serviceName, + cfg.serviceName.String(), cfg.startSpanOptions( tracer.Tag(ext.Component, componentName), tracer.Tag(ext.SpanKind, ext.SpanKindClient))..., diff --git a/contrib/google.golang.org/grpc/go.mod b/contrib/google.golang.org/grpc/go.mod index 757fb797d4..77b5b9dd15 100644 --- a/contrib/google.golang.org/grpc/go.mod +++ b/contrib/google.golang.org/grpc/go.mod @@ -4,12 +4,13 @@ go 1.21 require ( github.com/DataDog/appsec-internal-go v1.5.0 + github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2 v2.0.0-00010101000000-000000000000 github.com/DataDog/dd-trace-go/v2 v2.0.0-20240516153256-8d6fa2bea61d github.com/golang/protobuf v1.5.4 github.com/stretchr/testify v1.8.4 github.com/tinylib/msgp v1.1.9 - google.golang.org/grpc v1.64.0 - google.golang.org/protobuf v1.34.1 + google.golang.org/grpc v1.65.0 + google.golang.org/protobuf v1.34.2 ) require ( @@ -39,8 +40,10 @@ require ( golang.org/x/text v0.15.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) +replace github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2 => ../../../instrumentation/testutils/grpc + replace github.com/DataDog/dd-trace-go/v2 => ../../.. diff --git a/contrib/google.golang.org/grpc/go.sum b/contrib/google.golang.org/grpc/go.sum index 51d8055579..9ca8563147 100644 --- a/contrib/google.golang.org/grpc/go.sum +++ b/contrib/google.golang.org/grpc/go.sum @@ -129,12 +129,12 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 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/contrib/google.golang.org/grpc/grpc.go b/contrib/google.golang.org/grpc/grpc.go index c3baa66137..7e8e8de4b4 100644 --- a/contrib/google.golang.org/grpc/grpc.go +++ b/contrib/google.golang.org/grpc/grpc.go @@ -3,8 +3,6 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -//go:generate sh gen_proto.sh - // Package grpc provides functions to trace the google.golang.org/grpc package v1.2. package grpc // import "github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2" @@ -18,7 +16,7 @@ import ( "github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2/internal/grpcutil" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" - "github.com/DataDog/dd-trace-go/v2/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/instrumentation" "github.com/golang/protobuf/proto" "google.golang.org/grpc/codes" @@ -28,9 +26,10 @@ import ( const componentName = "google.golang.org/grpc" +var instr *instrumentation.Instrumentation + func init() { - telemetry.LoadIntegration(componentName) - tracer.MarkIntegrationImported(componentName) + instr = instrumentation.Load(instrumentation.PackageGRPC) } // cache a constant option: saves one allocation per call @@ -55,11 +54,11 @@ func (cfg *config) startSpanOptions(opts ...tracer.StartSpanOption) []tracer.Sta } func startSpanFromContext( - ctx context.Context, method, operation string, serviceFn func() string, opts ...tracer.StartSpanOption, + ctx context.Context, method, operation string, serviceName string, opts ...tracer.StartSpanOption, ) (*tracer.Span, context.Context) { methodElements := strings.SplitN(strings.TrimPrefix(method, "/"), "/", 2) opts = append(opts, - tracer.ServiceName(serviceFn()), + tracer.ServiceName(serviceName), tracer.ResourceName(method), tracer.Tag(tagMethodName, method), spanTypeRPC, diff --git a/contrib/google.golang.org/grpc/grpc_test.go b/contrib/google.golang.org/grpc/grpc_test.go index 63056efd4d..e7656a67a0 100644 --- a/contrib/google.golang.org/grpc/grpc_test.go +++ b/contrib/google.golang.org/grpc/grpc_test.go @@ -14,17 +14,14 @@ import ( "net" "net/http" "strings" - "sync/atomic" "testing" "time" + "github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2/fixturepb" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" - "github.com/DataDog/dd-trace-go/v2/internal/contrib/namingschematest" - "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" - "github.com/DataDog/dd-trace-go/v2/internal/lists" - "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/instrumentation/testutils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -72,7 +69,7 @@ func TestUnary(t *testing.T) { span, ctx := tracer.StartSpanFromContext(context.Background(), "a", tracer.ServiceName("b"), tracer.ResourceName("c")) - resp, err := client.Ping(ctx, &FixtureRequest{Name: tt.message}) + resp, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: tt.message}) span.Finish() if tt.error { assert.Error(err) @@ -132,12 +129,12 @@ func TestUnary(t *testing.T) { func TestStreaming(t *testing.T) { // creates a stream, then sends/recvs two pings, then closes the stream - runPings := func(t *testing.T, ctx context.Context, client FixtureClient) { + runPings := func(t *testing.T, ctx context.Context, client fixturepb.FixtureClient) { stream, err := client.StreamPing(ctx) assert.NoError(t, err) for i := 0; i < 2; i++ { - err = stream.Send(&FixtureRequest{Name: "pass"}) + err = stream.Send(&fixturepb.FixtureRequest{Name: "pass"}) assert.NoError(t, err) resp, err := stream.Recv() @@ -324,7 +321,7 @@ func TestSpanTree(t *testing.T) { // root span -> client Ping span -> server Ping span -> child span rootSpan, ctx := tracer.StartSpanFromContext(context.Background(), "root") client := rig.client - resp, err := client.Ping(ctx, &FixtureRequest{Name: "child"}) + resp, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: "child"}) assert.NoError(err) assert.Equal("child", resp.Message) rootSpan.Finish() @@ -366,7 +363,7 @@ func TestSpanTree(t *testing.T) { ctx = metadata.AppendToOutgoingContext(ctx, "custom_metadata_key", "custom_metadata_value") stream, err := client.StreamPing(ctx) assert.NoError(err) - err = stream.SendMsg(&FixtureRequest{Name: "break"}) + err = stream.SendMsg(&fixturepb.FixtureRequest{Name: "break"}) assert.NoError(err) resp, err := stream.Recv() assert.Nil(err) @@ -441,7 +438,7 @@ func TestPass(t *testing.T) { ctx := context.Background() ctx = metadata.AppendToOutgoingContext(ctx, "test-key", "test-value") - resp, err := client.Ping(ctx, &FixtureRequest{Name: "pass"}) + resp, err := client.Ping(ctx, &fixturepb.FixtureRequest{Name: "pass"}) assert.Nil(err) assert.Equal("passed", resp.Message) @@ -475,10 +472,10 @@ func TestPreservesMetadata(t *testing.T) { ctx := context.Background() ctx = metadata.AppendToOutgoingContext(ctx, "test-key", "test-value") span, ctx := tracer.StartSpanFromContext(ctx, "x", tracer.ServiceName("y"), tracer.ResourceName("z")) - rig.client.Ping(ctx, &FixtureRequest{Name: "pass"}) + rig.client.Ping(ctx, &fixturepb.FixtureRequest{Name: "pass"}) span.Finish() - md := rig.fixtureServer.lastRequestMetadata.Load().(metadata.MD) + md := rig.fixtureServer.LastRequestMetadata.Load().(metadata.MD) assert.Equal(t, []string{"test-value"}, md.Get("test-key"), "existing metadata should be preserved") @@ -505,7 +502,7 @@ func TestStreamSendsErrorCode(t *testing.T) { stream, err := rig.client.StreamPing(ctx) require.NoError(t, err, "no error should be returned after creating stream client") - err = stream.Send(&FixtureRequest{Name: "invalid"}) + err = stream.Send(&fixturepb.FixtureRequest{Name: "invalid"}) require.NoError(t, err, "no error should be returned after sending message") resp, err := stream.Recv() @@ -534,71 +531,15 @@ func TestStreamSendsErrorCode(t *testing.T) { assert.Equal(t, wantCode, gotLastSpanCode, "last span should contain error code") } -// fixtureServer a dummy implementation of our grpc fixtureServer. -type fixtureServer struct { - UnimplementedFixtureServer - lastRequestMetadata atomic.Value -} - -func (s *fixtureServer) StreamPing(stream Fixture_StreamPingServer) (err error) { - for { - msg, err := stream.Recv() - if err != nil { - return err - } - - reply, err := s.Ping(stream.Context(), msg) - if err != nil { - return err - } - - err = stream.Send(reply) - if err != nil { - return err - } - - if msg.Name == "break" { - return nil - } - } -} - -func (s *fixtureServer) Ping(ctx context.Context, in *FixtureRequest) (*FixtureReply, error) { - if md, ok := metadata.FromIncomingContext(ctx); ok { - s.lastRequestMetadata.Store(md) - } - switch { - case in.Name == "child": - span, _ := tracer.StartSpanFromContext(ctx, "child") - span.Finish() - return &FixtureReply{Message: "child"}, nil - case in.Name == "disabled": - if _, ok := tracer.SpanFromContext(ctx); ok { - panic("should be disabled") - } - return &FixtureReply{Message: "disabled"}, nil - case in.Name == "invalid": - return nil, status.Error(codes.InvalidArgument, "invalid") - case in.Name == "errorDetails": - s, _ := status.New(codes.Unknown, "unknown"). - WithDetails(&FixtureReply{Message: "a"}, &FixtureReply{Message: "b"}) - return nil, s.Err() - } - return &FixtureReply{Message: "passed"}, nil -} - -// ensure it's a fixtureServer -var _ FixtureServer = &fixtureServer{} - // rig contains all of the servers and connections we'd need for a // grpc integration test type rig struct { - fixtureServer *fixtureServer + fixtureServer *fixturepb.FixtureSrv server *grpc.Server port string listener net.Listener conn *grpc.ClientConn - client FixtureClient + client fixturepb.FixtureClient } func (r *rig) Close() { @@ -611,8 +552,8 @@ func newRigWithInterceptors( clientInterceptors []grpc.DialOption, ) (*rig, error) { server := grpc.NewServer(serverInterceptors...) - fixtureSrv := new(fixtureServer) - RegisterFixtureServer(server, fixtureSrv) + fixtureSrv := fixturepb.NewFixtureServer() + fixturepb.RegisterFixtureServer(server, fixtureSrv) li, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { @@ -632,7 +573,7 @@ func newRigWithInterceptors( port: port, server: server, conn: conn, - client: NewFixtureClient(conn), + client: fixturepb.NewFixtureClient(conn), }, err } @@ -670,7 +611,7 @@ func TestAnalyticsSettings(t *testing.T) { defer rig.Close() client := rig.client - resp, err := client.Ping(context.Background(), &FixtureRequest{Name: "pass"}) + resp, err := client.Ping(context.Background(), &fixturepb.FixtureRequest{Name: "pass"}) assert.Nil(t, err) assert.Equal(t, "passed", resp.Message) @@ -705,9 +646,7 @@ func TestAnalyticsSettings(t *testing.T) { mt := mocktracer.Start() defer mt.Stop() - rate := globalconfig.AnalyticsRate() - defer globalconfig.SetAnalyticsRate(rate) - globalconfig.SetAnalyticsRate(0.4) + testutils.SetGlobalAnalyticsRate(t, 0.4) assertRate(t, mt, 0.4) }) @@ -730,9 +669,7 @@ func TestAnalyticsSettings(t *testing.T) { mt := mocktracer.Start() defer mt.Stop() - rate := globalconfig.AnalyticsRate() - defer globalconfig.SetAnalyticsRate(rate) - globalconfig.SetAnalyticsRate(0.4) + testutils.SetGlobalAnalyticsRate(t, 0.4) assertRate(t, mt, 0.23, WithAnalyticsRate(0.23)) }) @@ -763,7 +700,7 @@ func TestUntracedMethods(t *testing.T) { t.Fatalf("error setting up rig: %s", err) } client := rig.client - resp, err := client.Ping(context.Background(), &FixtureRequest{Name: "pass"}) + resp, err := client.Ping(context.Background(), &fixturepb.FixtureRequest{Name: "pass"}) assert.Nil(t, err) assert.Equal(t, "passed", resp.Message) @@ -798,7 +735,7 @@ func TestUntracedMethods(t *testing.T) { stream, err := client.StreamPing(ctx) assert.NoError(t, err) - err = stream.Send(&FixtureRequest{Name: "pass"}) + err = stream.Send(&fixturepb.FixtureRequest{Name: "pass"}) assert.NoError(t, err) resp, err := stream.Recv() @@ -836,7 +773,7 @@ func TestIgnoredMetadata(t *testing.T) { ctx := context.Background() ctx = metadata.AppendToOutgoingContext(ctx, "test-key", "test-value", "test-key2", "test-value2") span, ctx := tracer.StartSpanFromContext(ctx, "x", tracer.ServiceName("y"), tracer.ResourceName("z")) - rig.client.Ping(ctx, &FixtureRequest{Name: "pass"}) + rig.client.Ping(ctx, &fixturepb.FixtureRequest{Name: "pass"}) span.Finish() spans := mt.FinishedSpans() @@ -870,7 +807,7 @@ func TestSpanOpts(t *testing.T) { t.Fatalf("error setting up rig: %s", err) } client := rig.client - resp, err := client.Ping(context.Background(), &FixtureRequest{Name: "pass"}) + resp, err := client.Ping(context.Background(), &fixturepb.FixtureRequest{Name: "pass"}) assert.Nil(t, err) assert.Equal(t, "passed", resp.Message) @@ -897,7 +834,7 @@ func TestSpanOpts(t *testing.T) { stream, err := client.StreamPing(ctx) assert.NoError(t, err) - err = stream.Send(&FixtureRequest{Name: "pass"}) + err = stream.Send(&fixturepb.FixtureRequest{Name: "pass"}) assert.NoError(t, err) resp, err := stream.Recv() @@ -935,7 +872,7 @@ func TestCustomTag(t *testing.T) { } ctx := context.Background() span, ctx := tracer.StartSpanFromContext(ctx, "x", tracer.ServiceName("y"), tracer.ResourceName("z")) - rig.client.Ping(ctx, &FixtureRequest{Name: "pass"}) + rig.client.Ping(ctx, &fixturepb.FixtureRequest{Name: "pass"}) span.Finish() spans := mt.FinishedSpans() @@ -955,52 +892,6 @@ func TestCustomTag(t *testing.T) { } } -func TestServerNamingSchema(t *testing.T) { - genSpans := getGenSpansFn(false, true) - assertOpV0 := func(t *testing.T, spans []*mocktracer.Span) { - require.Len(t, spans, 4) - for i := 0; i < 4; i++ { - assert.Equal(t, "grpc.server", spans[i].OperationName()) - } - } - assertOpV1 := func(t *testing.T, spans []*mocktracer.Span) { - require.Len(t, spans, 4) - for i := 0; i < 4; i++ { - assert.Equal(t, "grpc.server.request", spans[i].OperationName()) - } - } - wantServiceNameV0 := namingschematest.ServiceNameAssertions{ - WithDefaults: lists.RepeatString("grpc.server", 4), - WithDDService: lists.RepeatString(namingschematest.TestDDService, 4), - WithDDServiceAndOverride: lists.RepeatString(namingschematest.TestServiceOverride, 4), - } - t.Run("ServiceName", namingschematest.NewServiceNameTest(genSpans, wantServiceNameV0)) - t.Run("SpanName", namingschematest.NewSpanNameTest(genSpans, assertOpV0, assertOpV1)) -} - -func TestClientNamingSchema(t *testing.T) { - genSpans := getGenSpansFn(true, false) - assertOpV0 := func(t *testing.T, spans []*mocktracer.Span) { - require.Len(t, spans, 4) - for i := 0; i < 4; i++ { - assert.Equal(t, "grpc.client", spans[i].OperationName()) - } - } - assertOpV1 := func(t *testing.T, spans []*mocktracer.Span) { - require.Len(t, spans, 4) - for i := 0; i < 4; i++ { - assert.Equal(t, "grpc.client.request", spans[i].OperationName()) - } - } - wantServiceNameV0 := namingschematest.ServiceNameAssertions{ - WithDefaults: lists.RepeatString("grpc.client", 4), - WithDDService: lists.RepeatString("grpc.client", 4), - WithDDServiceAndOverride: lists.RepeatString(namingschematest.TestServiceOverride, 4), - } - t.Run("ServiceName", namingschematest.NewServiceNameTest(genSpans, wantServiceNameV0)) - t.Run("SpanName", namingschematest.NewSpanNameTest(genSpans, assertOpV0, assertOpV1)) -} - func TestWithErrorDetailTags(t *testing.T) { mt := mocktracer.Start() defer mt.Stop() @@ -1019,7 +910,7 @@ func TestWithErrorDetailTags(t *testing.T) { } ctx := context.Background() span, ctx := tracer.StartSpanFromContext(ctx, "x", tracer.ServiceName("y"), tracer.ResourceName("z")) - rig.client.Ping(ctx, &FixtureRequest{Name: "errorDetails"}) + rig.client.Ping(ctx, &fixturepb.FixtureRequest{Name: "errorDetails"}) span.Finish() spans := mt.FinishedSpans() @@ -1041,58 +932,9 @@ func TestWithErrorDetailTags(t *testing.T) { } } -func getGenSpansFn(traceClient, traceServer bool) namingschematest.GenSpansFn { - return func(t *testing.T, serviceOverride string) []*mocktracer.Span { - var opts []Option - if serviceOverride != "" { - opts = append(opts, WithService(serviceOverride)) - } - // exclude the grpc.message spans as they are not affected by naming schema - opts = append(opts, WithStreamMessages(false)) - mt := mocktracer.Start() - defer mt.Stop() - - var serverInterceptors []grpc.ServerOption - if traceServer { - serverInterceptors = append(serverInterceptors, - grpc.UnaryInterceptor(UnaryServerInterceptor(opts...)), - grpc.StreamInterceptor(StreamServerInterceptor(opts...)), - grpc.StatsHandler(NewServerStatsHandler(opts...)), - ) - } - clientInterceptors := []grpc.DialOption{grpc.WithInsecure()} - if traceClient { - clientInterceptors = append(clientInterceptors, - grpc.WithUnaryInterceptor(UnaryClientInterceptor(opts...)), - grpc.WithStreamInterceptor(StreamClientInterceptor(opts...)), - grpc.WithStatsHandler(NewClientStatsHandler(opts...)), - ) - } - rig, err := newRigWithInterceptors(serverInterceptors, clientInterceptors) - require.NoError(t, err) - defer rig.Close() - _, err = rig.client.Ping(context.Background(), &FixtureRequest{Name: "pass"}) - require.NoError(t, err) - - stream, err := rig.client.StreamPing(context.Background()) - require.NoError(t, err) - err = stream.Send(&FixtureRequest{Name: "break"}) - require.NoError(t, err) - _, err = stream.Recv() - require.NoError(t, err) - err = stream.CloseSend() - require.NoError(t, err) - // to flush the spans - _, _ = stream.Recv() - - waitForSpans(mt, 4) - return mt.FinishedSpans() - } -} - func BenchmarkUnaryServerInterceptor(b *testing.B) { // need to use the real tracer to get representative measurments - tracer.Start(tracer.WithLogger(log.DiscardLogger{}), + tracer.Start(tracer.WithLogger(testutils.DiscardLogger()), tracer.WithEnv("test"), tracer.WithServiceVersion("0.1.2")) defer tracer.Stop() @@ -1240,10 +1082,10 @@ func TestIssue2050(t *testing.T) { defer rig.Close() // call tracer.Start after integration is initialized, to reproduce the issue - tracer.Start(tracer.WithHTTPClient(httpClient)) + tracer.Start(tracer.WithHTTPClient(httpClient), tracer.WithLogger(testutils.DiscardLogger())) defer tracer.Stop() - _, err = rig.client.Ping(context.Background(), &FixtureRequest{Name: "pass"}) + _, err = rig.client.Ping(context.Background(), &fixturepb.FixtureRequest{Name: "pass"}) require.NoError(t, err) select { diff --git a/contrib/google.golang.org/grpc/option.go b/contrib/google.golang.org/grpc/option.go index 20c5386b61..218f4e9233 100644 --- a/contrib/google.golang.org/grpc/option.go +++ b/contrib/google.golang.org/grpc/option.go @@ -6,20 +6,14 @@ package grpc import ( + "math" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" - "github.com/DataDog/dd-trace-go/v2/internal" - "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" - "github.com/DataDog/dd-trace-go/v2/internal/log" - "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/instrumentation" "google.golang.org/grpc/codes" ) -const ( - defaultClientServiceName = "grpc.client" - defaultServerServiceName = "grpc.server" -) - // Option describes options for the gRPC integration. type Option interface { apply(*config) @@ -37,8 +31,33 @@ func (fn OptionFn) applyStream(cfg *config) { fn(cfg) } +type cachedServiceName struct { + value string + getValue func() string +} + +func newCachedServiceName(getValue func() string) *cachedServiceName { + c := &cachedServiceName{getValue: getValue} + // warmup cache + _ = c.String() + return c +} + +func (cs *cachedServiceName) String() string { + if cs.value != "" { + return cs.value + } + svc := cs.getValue() + // cache only if the tracer has been started. This ensures we get the final value for service name, since this + // is where the tracer configuration is resolved (including env variables and tracer options). + if instr.TracerInitialized() { + cs.value = svc + } + return svc +} + type config struct { - serviceName func() string + serviceName *cachedServiceName spanName string nonErrorCodes map[codes.Code]bool traceStreamCalls bool @@ -57,9 +76,8 @@ func defaults(cfg *config) { cfg.traceStreamCalls = true cfg.traceStreamMessages = true cfg.nonErrorCodes = map[codes.Code]bool{codes.Canceled: true} - // cfg.spanOpts = append(cfg.spanOpts, tracer.AnalyticsRate(globalconfig.AnalyticsRate())) - if internal.BoolEnv("DD_TRACE_GRPC_ANALYTICS_ENABLED", false) { - cfg.spanOpts = append(cfg.spanOpts, tracer.AnalyticsRate(1.0)) + if rate := instr.AnalyticsRate(false); !math.IsNaN(rate) { + cfg.spanOpts = append(cfg.spanOpts, tracer.AnalyticsRate(rate)) } cfg.ignoredMetadata = map[string]struct{}{ "x-datadog-trace-id": {}, @@ -69,31 +87,27 @@ func defaults(cfg *config) { } func clientDefaults(cfg *config) { - sn := namingschema.ServiceNameOverrideV0(defaultClientServiceName, defaultClientServiceName) - cfg.serviceName = func() string { return sn } - cfg.spanName = namingschema.OpName(namingschema.GRPCClient) + cfg.serviceName = newCachedServiceName(func() string { + return instr.ServiceName(instrumentation.ComponentClient, nil) + }) + cfg.spanName = instr.OperationName(instrumentation.ComponentClient, nil) defaults(cfg) } func serverDefaults(cfg *config) { - // We check for a configured service name, so we don't break users who are incorrectly creating their server - // before the call `tracer.Start()` - if globalconfig.ServiceName() != "" { - sn := namingschema.ServiceName(defaultServerServiceName) - cfg.serviceName = func() string { return sn } - } else { - log.Warn("No global service name was detected. GRPC Server may have been created before calling tracer.Start(). Will dynamically fetch service name for every span. " + - "Note this may have a slight performance cost, it is always recommended to start the tracer before initializing any traced packages.\n") - cfg.serviceName = func() string { return namingschema.ServiceName(defaultServerServiceName) } - } - cfg.spanName = namingschema.OpName(namingschema.GRPCServer) + cfg.serviceName = newCachedServiceName(func() string { + return instr.ServiceName(instrumentation.ComponentServer, nil) + }) + cfg.spanName = instr.OperationName(instrumentation.ComponentServer, nil) defaults(cfg) } // WithService sets the given service name for the intercepted client. func WithService(name string) OptionFn { return func(cfg *config) { - cfg.serviceName = func() string { return name } + cfg.serviceName = newCachedServiceName(func() string { + return name + }) } } diff --git a/contrib/google.golang.org/grpc/server.go b/contrib/google.golang.org/grpc/server.go index f6aafd2709..261349e06e 100644 --- a/contrib/google.golang.org/grpc/server.go +++ b/contrib/google.golang.org/grpc/server.go @@ -10,8 +10,6 @@ import ( "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" - "github.com/DataDog/dd-trace-go/v2/internal/appsec" - "github.com/DataDog/dd-trace-go/v2/internal/log" "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -45,7 +43,7 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { ss.ctx, ss.method, "grpc.message", - ss.cfg.serviceName, + ss.cfg.serviceName.String(), ss.cfg.startSpanOptions(tracer.Measured())..., ) span.SetTag(ext.Component, componentName) @@ -66,7 +64,7 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { ss.ctx, ss.method, "grpc.message", - ss.cfg.serviceName, + ss.cfg.serviceName.String(), ss.cfg.startSpanOptions(tracer.Measured())..., ) span.SetTag(ext.Component, componentName) @@ -83,7 +81,7 @@ func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { for _, fn := range opts { fn.apply(cfg) } - log.Debug("contrib/google.golang.org/grpc: Configuring StreamServerInterceptor: %#v", cfg) + instr.Logger().Debug("contrib/google.golang.org/grpc: Configuring StreamServerInterceptor: %#v", cfg) return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error) { ctx := ss.Context() // if we've enabled call tracing, create a span @@ -94,7 +92,7 @@ func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { ctx, info.FullMethod, cfg.spanName, - cfg.serviceName, + cfg.serviceName.String(), cfg.startSpanOptions(tracer.Measured(), tracer.Tag(ext.Component, componentName), tracer.Tag(ext.SpanKind, ext.SpanKindServer))..., @@ -108,7 +106,7 @@ func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { span.SetTag(tagMethodKind, methodKindClientStream) } defer func() { finishWithError(span, err, cfg) }() - if appsec.Enabled() { + if instr.AppSecEnabled() { handler = appsecStreamHandlerMiddleware(info.FullMethod, span, handler) } } @@ -131,7 +129,7 @@ func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { for _, fn := range opts { fn.apply(cfg) } - log.Debug("contrib/google.golang.org/grpc: Configuring UnaryServerInterceptor: %#v", cfg) + instr.Logger().Debug("contrib/google.golang.org/grpc: Configuring UnaryServerInterceptor: %#v", cfg) return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { _, um := cfg.untracedMethods[info.FullMethod] if um { @@ -141,7 +139,7 @@ func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { ctx, info.FullMethod, cfg.spanName, - cfg.serviceName, + cfg.serviceName.String(), cfg.startSpanOptions(tracer.Measured(), tracer.Tag(ext.Component, componentName), tracer.Tag(ext.SpanKind, ext.SpanKindServer))..., @@ -149,7 +147,7 @@ func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { span.SetTag(tagMethodKind, methodKindUnary) withMetadataTags(ctx, cfg, span) withRequestTags(cfg, req, span) - if appsec.Enabled() { + if instr.AppSecEnabled() { handler = appsecUnaryHandlerMiddleware(info.FullMethod, span, handler) } resp, err := handler(ctx, req) diff --git a/contrib/google.golang.org/grpc/stats_client.go b/contrib/google.golang.org/grpc/stats_client.go index 92be190b2f..1692bbd79e 100644 --- a/contrib/google.golang.org/grpc/stats_client.go +++ b/contrib/google.golang.org/grpc/stats_client.go @@ -36,7 +36,7 @@ func (h *clientStatsHandler) TagRPC(ctx context.Context, rti *stats.RPCTagInfo) ctx, rti.FullMethodName, h.cfg.spanName, - h.cfg.serviceName, + h.cfg.serviceName.String(), spanOpts..., ) ctx = injectSpanIntoContext(ctx) diff --git a/contrib/google.golang.org/grpc/stats_client_test.go b/contrib/google.golang.org/grpc/stats_client_test.go index f06b5c2a2a..b6edf60eb1 100644 --- a/contrib/google.golang.org/grpc/stats_client_test.go +++ b/contrib/google.golang.org/grpc/stats_client_test.go @@ -9,6 +9,7 @@ import ( "context" "testing" + "github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2/fixturepb" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" @@ -34,7 +35,7 @@ func TestClientStatsHandler(t *testing.T) { defer mt.Stop() rootSpan, ctx := tracer.StartSpanFromContext(context.Background(), "a", tracer.ServiceName("b"), tracer.ResourceName("c")) - _, err = server.client.Ping(ctx, &FixtureRequest{Name: "name"}) + _, err = server.client.Ping(ctx, &fixturepb.FixtureRequest{Name: "name"}) assert.NoError(err) rootSpan.Finish() diff --git a/contrib/google.golang.org/grpc/stats_server.go b/contrib/google.golang.org/grpc/stats_server.go index 626728c044..fa402c51b9 100644 --- a/contrib/google.golang.org/grpc/stats_server.go +++ b/contrib/google.golang.org/grpc/stats_server.go @@ -41,7 +41,7 @@ func (h *serverStatsHandler) TagRPC(ctx context.Context, rti *stats.RPCTagInfo) ctx, rti.FullMethodName, h.cfg.spanName, - h.cfg.serviceName, + h.cfg.serviceName.String(), spanOpts..., ) return ctx diff --git a/contrib/google.golang.org/grpc/stats_server_test.go b/contrib/google.golang.org/grpc/stats_server_test.go index 5ff5f53312..ea19882010 100644 --- a/contrib/google.golang.org/grpc/stats_server_test.go +++ b/contrib/google.golang.org/grpc/stats_server_test.go @@ -10,6 +10,7 @@ import ( "fmt" "testing" + "github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2/fixturepb" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" @@ -33,7 +34,7 @@ func TestServerStatsHandler(t *testing.T) { mt := mocktracer.Start() defer mt.Stop() - _, err = server.client.Ping(context.Background(), &FixtureRequest{Name: "name"}) + _, err = server.client.Ping(context.Background(), &fixturepb.FixtureRequest{Name: "name"}) assert.NoError(err) waitForSpans(mt, 1) diff --git a/ddtrace/tracer/textmap.go b/ddtrace/tracer/textmap.go index 92c34644e3..9f17c8eeb4 100644 --- a/ddtrace/tracer/textmap.go +++ b/ddtrace/tracer/textmap.go @@ -13,20 +13,12 @@ import ( "strconv" "strings" - "github.com/DataDog/dd-trace-go/v2/ddtrace" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/internal" "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/DataDog/dd-trace-go/v2/internal/samplernames" ) -func init() { - // Push the private API for a propagating tag into the internal package. - internal.SetPropagatingTag = func(ctx ddtrace.SpanContext, k, v string) { - setPropagatingTag(ctx.(*SpanContext), k, v) - } -} - // HTTPHeadersCarrier wraps an http.Header as a TextMapWriter and TextMapReader, allowing // it to be used using the provided Propagator implementation. type HTTPHeadersCarrier http.Header diff --git a/ddtrace/tracer/tracer.go b/ddtrace/tracer/tracer.go index 13ed13aa84..1c5e018f02 100644 --- a/ddtrace/tracer/tracer.go +++ b/ddtrace/tracer/tracer.go @@ -210,12 +210,14 @@ func Start(opts ...StartOption) error { // client is appropriately configured. appsec.Start(appsecConfig.WithRCConfig(cfg)) _ = t.hostname() // Prime the hostname cache + globalinternal.SetTracerInitialized(true) return nil } // Stop stops the started tracer. Subsequent calls are valid but become no-op. func Stop() { SetGlobalTracer(&NoopTracer{}) + globalinternal.SetTracerInitialized(false) log.Flush() } diff --git a/go.work b/go.work index 3b23bf95b7..2db2029d97 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.22.5 // Go version must match the highest supported version, not the minimum supported version. +go 1.22.6 // Go version must match the highest supported version, not the minimum supported version. use ( . @@ -53,6 +53,7 @@ use ( ./contrib/urfave/negroni ./contrib/valyala/fasthttp ./instrumentation/internal/namingschematest + ./instrumentation/testutils/grpc ./internal/apps ./internal/contrib/validationtest ./internal/traceprof/traceproftest diff --git a/go.work.sum b/go.work.sum index b7d52f77d6..4bc2dd9c21 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1254,6 +1254,7 @@ github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/cel-go v0.17.7/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= @@ -1604,6 +1605,7 @@ github.com/tchap/go-patricia/v2 v2.3.1/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwD github.com/tink-crypto/tink-go-gcpkms/v2 v2.1.0/go.mod h1:QXPc/i5yUEWWZ4lbe2WOam1kDdrXjGHRjl0Lzo7IQDU= github.com/tink-crypto/tink-go-hcvault/v2 v2.1.0/go.mod h1:OJLS+EYJo/BTViJj7EBG5deKLeQfYwVNW8HMS1qHAAo= github.com/tink-crypto/tink-go/v2 v2.1.0/go.mod h1:y1TnYFt1i2eZVfx4OGc+C+EMp4CoKWAw2VSEuoicHHI= +github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= github.com/tonistiigi/go-actions-cache v0.0.0-20240227172821-a0b64f338598/go.mod h1:anhKd3mnC1shAbQj1Q4IJ+w6xqezxnyDYlx/yKa7IXM= @@ -1793,6 +1795,7 @@ golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2 golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= +golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= @@ -1909,6 +1912,7 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1: google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2/go.mod h1:O1cOfN1Cy6QEYr7VxtjOyP5AdAuR0aJ/MYZaaof623Y= google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6/go.mod h1:10yRODfgim2/T8csjQsMPgZOMvtytXKTDRzH6HRGzRw= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= @@ -1943,7 +1947,6 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go. google.golang.org/genproto/googleapis/rpc v0.0.0-20240304161311-37d4d3c04a78/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= @@ -1963,6 +1966,7 @@ google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJai google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/internal/appsec/dyngo/operation.go b/instrumentation/appsec/dyngo/operation.go similarity index 100% rename from internal/appsec/dyngo/operation.go rename to instrumentation/appsec/dyngo/operation.go diff --git a/internal/appsec/dyngo/operation_test.go b/instrumentation/appsec/dyngo/operation_test.go similarity index 99% rename from internal/appsec/dyngo/operation_test.go rename to instrumentation/appsec/dyngo/operation_test.go index e2ea93c9f4..1db1c05800 100644 --- a/internal/appsec/dyngo/operation_test.go +++ b/instrumentation/appsec/dyngo/operation_test.go @@ -17,7 +17,7 @@ import ( "sync/atomic" "testing" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/stretchr/testify/require" ) diff --git a/internal/appsec/emitter/doc.go b/instrumentation/appsec/emitter/doc.go similarity index 100% rename from internal/appsec/emitter/doc.go rename to instrumentation/appsec/emitter/doc.go diff --git a/instrumentation/appsec/emitter/graphqlsec/context.go b/instrumentation/appsec/emitter/graphqlsec/context.go index 3a0f6b4663..6f1e6d100b 100644 --- a/instrumentation/appsec/emitter/graphqlsec/context.go +++ b/instrumentation/appsec/emitter/graphqlsec/context.go @@ -8,7 +8,7 @@ package graphqlsec import ( "context" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/internal/log" ) diff --git a/instrumentation/appsec/emitter/graphqlsec/execution.go b/instrumentation/appsec/emitter/graphqlsec/execution.go index 27507122ce..f6dbc5b9e0 100644 --- a/instrumentation/appsec/emitter/graphqlsec/execution.go +++ b/instrumentation/appsec/emitter/graphqlsec/execution.go @@ -8,9 +8,9 @@ package graphqlsec import ( "context" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/graphqlsec/types" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" ) // StartExecutionOperation starts a new GraphQL query operation, along with the given arguments, and diff --git a/instrumentation/appsec/emitter/graphqlsec/request.go b/instrumentation/appsec/emitter/graphqlsec/request.go index f6bfea2f14..2048debffb 100644 --- a/instrumentation/appsec/emitter/graphqlsec/request.go +++ b/instrumentation/appsec/emitter/graphqlsec/request.go @@ -12,9 +12,9 @@ package graphqlsec import ( "context" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/graphqlsec/types" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" ) // StartRequestOperation starts a new GraphQL request operation, along with the given arguments, and diff --git a/instrumentation/appsec/emitter/graphqlsec/resolve.go b/instrumentation/appsec/emitter/graphqlsec/resolve.go index b64698f2bd..370815862a 100644 --- a/instrumentation/appsec/emitter/graphqlsec/resolve.go +++ b/instrumentation/appsec/emitter/graphqlsec/resolve.go @@ -8,9 +8,9 @@ package graphqlsec import ( "context" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/graphqlsec/types" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" ) // StartResolveOperation starts a new GraphQL Resolve operation, along with the given arguments, and diff --git a/instrumentation/appsec/emitter/graphqlsec/types/types.go b/instrumentation/appsec/emitter/graphqlsec/types/types.go index 51f2baade1..96101ee9e1 100644 --- a/instrumentation/appsec/emitter/graphqlsec/types/types.go +++ b/instrumentation/appsec/emitter/graphqlsec/types/types.go @@ -6,8 +6,8 @@ package types import ( - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" ) type ( diff --git a/internal/appsec/emitter/grpcsec/grpc.go b/instrumentation/appsec/emitter/grpcsec/grpc.go similarity index 89% rename from internal/appsec/emitter/grpcsec/grpc.go rename to instrumentation/appsec/emitter/grpcsec/grpc.go index 997ea88919..27d859cfc4 100644 --- a/internal/appsec/emitter/grpcsec/grpc.go +++ b/instrumentation/appsec/emitter/grpcsec/grpc.go @@ -12,10 +12,10 @@ package grpcsec import ( "context" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/grpcsec/types" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/grpcsec/types" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" ) // StartHandlerOperation starts an gRPC server handler operation, along with the diff --git a/internal/appsec/emitter/grpcsec/grpc_test.go b/instrumentation/appsec/emitter/grpcsec/grpc_test.go similarity index 92% rename from internal/appsec/emitter/grpcsec/grpc_test.go rename to instrumentation/appsec/emitter/grpcsec/grpc_test.go index ac0f770b95..8eee6fb5bc 100644 --- a/internal/appsec/emitter/grpcsec/grpc_test.go +++ b/instrumentation/appsec/emitter/grpcsec/grpc_test.go @@ -10,9 +10,9 @@ import ( "fmt" "testing" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/grpcsec" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/grpcsec/types" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/grpcsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/grpcsec/types" "github.com/stretchr/testify/require" ) diff --git a/internal/appsec/emitter/grpcsec/init.go b/instrumentation/appsec/emitter/grpcsec/init.go similarity index 100% rename from internal/appsec/emitter/grpcsec/init.go rename to instrumentation/appsec/emitter/grpcsec/init.go diff --git a/internal/appsec/emitter/grpcsec/types/types.go b/instrumentation/appsec/emitter/grpcsec/types/types.go similarity index 96% rename from internal/appsec/emitter/grpcsec/types/types.go rename to instrumentation/appsec/emitter/grpcsec/types/types.go index 6ec586a3bb..af080d5e02 100644 --- a/internal/appsec/emitter/grpcsec/types/types.go +++ b/instrumentation/appsec/emitter/grpcsec/types/types.go @@ -8,8 +8,8 @@ package types import ( "net/netip" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" ) // Abstract gRPC server handler operation definitions. It is based on two diff --git a/instrumentation/appsec/emitter/httpsec/http.go b/instrumentation/appsec/emitter/httpsec/http.go index 64319e3969..b145a32ef7 100644 --- a/instrumentation/appsec/emitter/httpsec/http.go +++ b/instrumentation/appsec/emitter/httpsec/http.go @@ -18,12 +18,12 @@ import ( "strings" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/httpsec/types" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace/httptrace" "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace/httptrace" "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/DataDog/appsec-internal-go/netip" diff --git a/instrumentation/appsec/emitter/httpsec/tags.go b/instrumentation/appsec/emitter/httpsec/tags.go index f4d8de9a67..da2c778d7a 100644 --- a/instrumentation/appsec/emitter/httpsec/tags.go +++ b/instrumentation/appsec/emitter/httpsec/tags.go @@ -6,8 +6,8 @@ package httpsec import ( - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace/httptrace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace/httptrace" ) // setRequestHeadersTags sets the AppSec-specific request headers span tags. diff --git a/instrumentation/appsec/emitter/httpsec/tags_test.go b/instrumentation/appsec/emitter/httpsec/tags_test.go index 3f6687323a..a51812cfff 100644 --- a/instrumentation/appsec/emitter/httpsec/tags_test.go +++ b/instrumentation/appsec/emitter/httpsec/tags_test.go @@ -9,8 +9,8 @@ import ( "fmt" "testing" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" testlib "github.com/DataDog/dd-trace-go/v2/internal/appsec/_testlib" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" "github.com/stretchr/testify/require" ) diff --git a/instrumentation/appsec/emitter/httpsec/types/types.go b/instrumentation/appsec/emitter/httpsec/types/types.go index 3507cc7bac..10fd7ebd1e 100644 --- a/instrumentation/appsec/emitter/httpsec/types/types.go +++ b/instrumentation/appsec/emitter/httpsec/types/types.go @@ -9,8 +9,8 @@ import ( "net/netip" "sync" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" ) // Operation type representing an HTTP operation. It must be created with diff --git a/internal/appsec/emitter/sharedsec/actions.go b/instrumentation/appsec/emitter/sharedsec/actions.go similarity index 100% rename from internal/appsec/emitter/sharedsec/actions.go rename to instrumentation/appsec/emitter/sharedsec/actions.go diff --git a/internal/appsec/emitter/sharedsec/actions_test.go b/instrumentation/appsec/emitter/sharedsec/actions_test.go similarity index 100% rename from internal/appsec/emitter/sharedsec/actions_test.go rename to instrumentation/appsec/emitter/sharedsec/actions_test.go diff --git a/internal/appsec/emitter/sharedsec/blocked-template.html b/instrumentation/appsec/emitter/sharedsec/blocked-template.html similarity index 100% rename from internal/appsec/emitter/sharedsec/blocked-template.html rename to instrumentation/appsec/emitter/sharedsec/blocked-template.html diff --git a/internal/appsec/emitter/sharedsec/blocked-template.json b/instrumentation/appsec/emitter/sharedsec/blocked-template.json similarity index 100% rename from internal/appsec/emitter/sharedsec/blocked-template.json rename to instrumentation/appsec/emitter/sharedsec/blocked-template.json diff --git a/internal/appsec/emitter/sharedsec/shared.go b/instrumentation/appsec/emitter/sharedsec/shared.go similarity index 97% rename from internal/appsec/emitter/sharedsec/shared.go rename to instrumentation/appsec/emitter/sharedsec/shared.go index 9c8b968c42..9dc739acd1 100644 --- a/internal/appsec/emitter/sharedsec/shared.go +++ b/instrumentation/appsec/emitter/sharedsec/shared.go @@ -9,7 +9,7 @@ import ( "context" "reflect" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener" "github.com/DataDog/dd-trace-go/v2/internal/log" ) diff --git a/internal/appsec/trace/grpctrace/grpc.go b/instrumentation/appsec/trace/grpctrace/grpc.go similarity index 87% rename from internal/appsec/trace/grpctrace/grpc.go rename to instrumentation/appsec/trace/grpctrace/grpc.go index 78df9c8350..99a5ec75ae 100644 --- a/internal/appsec/trace/grpctrace/grpc.go +++ b/instrumentation/appsec/trace/grpctrace/grpc.go @@ -6,8 +6,8 @@ package grpctrace import ( - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace/httptrace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace/httptrace" "github.com/DataDog/dd-trace-go/v2/internal/log" ) diff --git a/internal/appsec/trace/grpctrace/grpc_test.go b/instrumentation/appsec/trace/grpctrace/grpc_test.go similarity index 100% rename from internal/appsec/trace/grpctrace/grpc_test.go rename to instrumentation/appsec/trace/grpctrace/grpc_test.go diff --git a/internal/appsec/trace/httptrace/http.go b/instrumentation/appsec/trace/httptrace/http.go similarity index 98% rename from internal/appsec/trace/httptrace/http.go rename to instrumentation/appsec/trace/httptrace/http.go index 0367b8c7e5..0044c2dcaf 100644 --- a/internal/appsec/trace/httptrace/http.go +++ b/instrumentation/appsec/trace/httptrace/http.go @@ -12,7 +12,7 @@ import ( "github.com/DataDog/appsec-internal-go/httpsec" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" "github.com/DataDog/dd-trace-go/v2/internal/log" ) diff --git a/internal/appsec/trace/httptrace/http_test.go b/instrumentation/appsec/trace/httptrace/http_test.go similarity index 97% rename from internal/appsec/trace/httptrace/http_test.go rename to instrumentation/appsec/trace/httptrace/http_test.go index 8da251573e..282c68f6d8 100644 --- a/internal/appsec/trace/httptrace/http_test.go +++ b/instrumentation/appsec/trace/httptrace/http_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/grpc/metadata" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace/httptrace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace/httptrace" ) func TestClientIP(t *testing.T) { diff --git a/internal/appsec/trace/securityholder.go b/instrumentation/appsec/trace/securityholder.go similarity index 100% rename from internal/appsec/trace/securityholder.go rename to instrumentation/appsec/trace/securityholder.go diff --git a/internal/appsec/trace/tagsholder.go b/instrumentation/appsec/trace/tagsholder.go similarity index 100% rename from internal/appsec/trace/tagsholder.go rename to instrumentation/appsec/trace/tagsholder.go diff --git a/internal/appsec/trace/trace.go b/instrumentation/appsec/trace/trace.go similarity index 100% rename from internal/appsec/trace/trace.go rename to instrumentation/appsec/trace/trace.go diff --git a/instrumentation/httptrace/httptrace.go b/instrumentation/httptrace/httptrace.go index cef6a8a568..e9b60604e9 100644 --- a/instrumentation/httptrace/httptrace.go +++ b/instrumentation/httptrace/httptrace.go @@ -17,7 +17,7 @@ import ( "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace/httptrace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace/httptrace" ) var ( diff --git a/instrumentation/instrumentation.go b/instrumentation/instrumentation.go index 7190461310..4693c2e49c 100644 --- a/instrumentation/instrumentation.go +++ b/instrumentation/instrumentation.go @@ -109,6 +109,11 @@ func (i *Instrumentation) DataStreamsEnabled() bool { return internal.BoolEnv("DD_DATA_STREAMS_ENABLED", false) } +// TracerInitialized returns whether the global tracer has been initialized or not. +func (i *Instrumentation) TracerInitialized() bool { + return internal.TracerInitialized() +} + // WithExecutionTraced marks ctx as being associated with an execution trace // task. It is assumed that ctx already contains a trace task. The caller is // responsible for ending the task. diff --git a/instrumentation/internal/namingschematest/aws_sdk_v1_test.go b/instrumentation/internal/namingschematest/aws_sdk_v1_test.go index 7a71e41365..ce9cb2be64 100644 --- a/instrumentation/internal/namingschematest/aws_sdk_v1_test.go +++ b/instrumentation/internal/namingschematest/aws_sdk_v1_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/require" awstrace "github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go/v2/aws" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/aws_sdk_v2_test.go b/instrumentation/internal/namingschematest/aws_sdk_v2_test.go index 84cc4a8537..149747ac58 100644 --- a/instrumentation/internal/namingschematest/aws_sdk_v2_test.go +++ b/instrumentation/internal/namingschematest/aws_sdk_v2_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/require" awstrace "github.com/DataDog/dd-trace-go/contrib/aws/aws-sdk-go-v2/v2/aws" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/chi_v1_test.go b/instrumentation/internal/namingschematest/chi_v1_test.go index a660fc0d2b..929705fd40 100644 --- a/instrumentation/internal/namingschematest/chi_v1_test.go +++ b/instrumentation/internal/namingschematest/chi_v1_test.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/require" chitrace "github.com/DataDog/dd-trace-go/contrib/go-chi/chi/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/chi_v5_test.go b/instrumentation/internal/namingschematest/chi_v5_test.go index f992e082e6..3cc94d742f 100644 --- a/instrumentation/internal/namingschematest/chi_v5_test.go +++ b/instrumentation/internal/namingschematest/chi_v5_test.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/require" chitrace "github.com/DataDog/dd-trace-go/contrib/go-chi/chi.v5/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/confluent_kafka_go_v1/confluent_kafka_go_test.go b/instrumentation/internal/namingschematest/confluent_kafka_go_v1/confluent_kafka_go_test.go index d559f99dda..94a8ca9d5f 100644 --- a/instrumentation/internal/namingschematest/confluent_kafka_go_v1/confluent_kafka_go_test.go +++ b/instrumentation/internal/namingschematest/confluent_kafka_go_v1/confluent_kafka_go_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" kafkatrace "github.com/DataDog/dd-trace-go/contrib/confluentinc/confluent-kafka-go/kafka/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/confluent_kafka_v2_test.go b/instrumentation/internal/namingschematest/confluent_kafka_v2_test.go index 1c795aee5d..89da038606 100644 --- a/instrumentation/internal/namingschematest/confluent_kafka_v2_test.go +++ b/instrumentation/internal/namingschematest/confluent_kafka_v2_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" kafkatrace "github.com/DataDog/dd-trace-go/contrib/confluentinc/confluent-kafka-go/kafka.v2/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/database_sql.go b/instrumentation/internal/namingschematest/database_sql.go index 70507a93da..179ad3831a 100644 --- a/instrumentation/internal/namingschematest/database_sql.go +++ b/instrumentation/internal/namingschematest/database_sql.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/require" sqltrace "github.com/DataDog/dd-trace-go/contrib/database/sql/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/elastic_v6_test.go b/instrumentation/internal/namingschematest/elastic_v6_test.go index 929469e88b..e4ff6788f0 100644 --- a/instrumentation/internal/namingschematest/elastic_v6_test.go +++ b/instrumentation/internal/namingschematest/elastic_v6_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/require" elastictrace "github.com/DataDog/dd-trace-go/contrib/elastic/go-elasticsearch.v6/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/fiber_v2_test.go b/instrumentation/internal/namingschematest/fiber_v2_test.go index b892b765f7..dbf24b7b0d 100644 --- a/instrumentation/internal/namingschematest/fiber_v2_test.go +++ b/instrumentation/internal/namingschematest/fiber_v2_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" fibertrace "github.com/DataDog/dd-trace-go/contrib/gofiber/fiber.v2/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/gcp_pubsub_test.go b/instrumentation/internal/namingschematest/gcp_pubsub_test.go index e5882aa584..38ab73d8bf 100644 --- a/instrumentation/internal/namingschematest/gcp_pubsub_test.go +++ b/instrumentation/internal/namingschematest/gcp_pubsub_test.go @@ -21,7 +21,7 @@ import ( "google.golang.org/grpc/status" pubsubtrace "github.com/DataDog/dd-trace-go/contrib/cloud.google.com/go/pubsub.v1/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/gin_test.go b/instrumentation/internal/namingschematest/gin_test.go index 1ff80c2bed..c3acc6ff10 100644 --- a/instrumentation/internal/namingschematest/gin_test.go +++ b/instrumentation/internal/namingschematest/gin_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" gintrace "github.com/DataDog/dd-trace-go/contrib/gin-gonic/gin/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/go.mod b/instrumentation/internal/namingschematest/go.mod index 756e401b11..882ae4cde0 100644 --- a/instrumentation/internal/namingschematest/go.mod +++ b/instrumentation/internal/namingschematest/go.mod @@ -1,4 +1,4 @@ -module github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest +module github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2 go 1.21 @@ -18,9 +18,20 @@ require ( github.com/DataDog/dd-trace-go/contrib/emicklei/go-restful.v3/v2 v2.0.0-00010101000000-000000000000 github.com/DataDog/dd-trace-go/contrib/gin-gonic/gin/v2 v2.0.0-00010101000000-000000000000 github.com/DataDog/dd-trace-go/contrib/globalsign/mgo/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/go-chi/chi.v5/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/go-chi/chi/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/go-pg/pg.v10/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v7/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v8/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/go-redis/redis/v2 v2.0.0-00010101000000-000000000000 github.com/DataDog/dd-trace-go/contrib/go.mongodb.org/mongo-driver/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/gocql/gocql/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/gofiber/fiber.v2/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/gomodule/redigo/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2 v2.0.0-00010101000000-000000000000 github.com/DataDog/dd-trace-go/contrib/net/http/v2 v2.0.0-20240516153256-8d6fa2bea61d github.com/DataDog/dd-trace-go/contrib/urfave/negroni/v2 v2.0.0-00010101000000-000000000000 + github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2 v2.0.0-00010101000000-000000000000 github.com/DataDog/dd-trace-go/v2 v2.0.0-beta.2 github.com/aws/aws-sdk-go v1.54.20 github.com/aws/aws-sdk-go-v2 v1.30.3 @@ -37,13 +48,21 @@ require ( github.com/emicklei/go-restful/v3 v3.11.0 github.com/gin-gonic/gin v1.10.0 github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 + github.com/go-chi/chi v1.5.5 + github.com/go-chi/chi/v5 v5.1.0 + github.com/go-pg/pg/v10 v10.13.0 + github.com/go-redis/redis v6.15.9+incompatible + github.com/go-redis/redis/v7 v7.4.1 + github.com/go-redis/redis/v8 v8.11.5 github.com/go-sql-driver/mysql v1.8.1 + github.com/gocql/gocql v1.6.0 + github.com/gofiber/fiber/v2 v2.52.5 github.com/lib/pq v1.10.9 github.com/stretchr/testify v1.9.0 github.com/urfave/negroni v1.0.0 go.mongodb.org/mongo-driver v1.16.1 google.golang.org/api v0.191.0 - google.golang.org/grpc v1.64.1 + google.golang.org/grpc v1.65.0 ) require ( @@ -63,6 +82,7 @@ require ( github.com/DataDog/sketches-go v1.4.6 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/agnivade/levenshtein v1.1.1 // indirect + github.com/andybalholm/brotli v1.0.6 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.17.27 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 // indirect @@ -89,6 +109,7 @@ require ( github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dimfeld/httptreemux/v5 v5.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.7.1 // indirect @@ -98,6 +119,7 @@ require ( github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-pg/zerochecker v0.2.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.20.0 // indirect @@ -105,22 +127,28 @@ require ( github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect + github.com/gomodule/redigo v1.8.9 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -130,12 +158,21 @@ require ( github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/rivo/uniseg v0.4.4 // indirect github.com/secure-systems-lab/go-securesystemslib v0.8.0 // indirect github.com/sosodev/duration v1.3.1 // indirect github.com/tinylib/msgp v1.2.0 // indirect + github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasthttp v1.51.0 // indirect + github.com/valyala/tcplisten v1.0.0 // indirect github.com/vektah/gqlparser/v2 v2.5.16 // indirect + github.com/vmihailenco/bufpool v0.1.11 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/tagparser v0.1.2 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect @@ -162,7 +199,9 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + mellium.im/sasl v0.3.1 // indirect ) replace github.com/DataDog/dd-trace-go/contrib/99designs/gqlgen/v2 => ../../../contrib/99designs/gqlgen @@ -191,10 +230,32 @@ replace github.com/DataDog/dd-trace-go/contrib/gin-gonic/gin/v2 => ../../../cont replace github.com/DataDog/dd-trace-go/contrib/globalsign/mgo/v2 => ../../../contrib/globalsign/mgo +replace github.com/DataDog/dd-trace-go/contrib/go-chi/chi.v5/v2 => ../../../contrib/go-chi/chi.v5 + +replace github.com/DataDog/dd-trace-go/contrib/go-chi/chi/v2 => ../../../contrib/go-chi/chi + +replace github.com/DataDog/dd-trace-go/contrib/go-pg/pg.v10/v2 => ../../../contrib/go-pg/pg.v10 + +replace github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v7/v2 => ../../../contrib/go-redis/redis.v7 + +replace github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v8/v2 => ../../../contrib/go-redis/redis.v8 + +replace github.com/DataDog/dd-trace-go/contrib/go-redis/redis/v2 => ../../../contrib/go-redis/redis + replace github.com/DataDog/dd-trace-go/contrib/go.mongodb.org/mongo-driver/v2 => ../../../contrib/go.mongodb.org/mongo-driver +replace github.com/DataDog/dd-trace-go/contrib/gocql/gocql/v2 => ../../../contrib/gocql/gocql + +replace github.com/DataDog/dd-trace-go/contrib/gofiber/fiber.v2/v2 => ../../../contrib/gofiber/fiber.v2 + +replace github.com/DataDog/dd-trace-go/contrib/gomodule/redigo/v2 => ../../../contrib/gomodule/redigo + +replace github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2 => ../../../contrib/google.golang.org/grpc + replace github.com/DataDog/dd-trace-go/contrib/net/http/v2 => ../../../contrib/net/http replace github.com/DataDog/dd-trace-go/contrib/urfave/negroni/v2 => ../../../contrib/urfave/negroni +replace github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2 => ../../testutils/grpc + replace github.com/DataDog/dd-trace-go/v2 => ../../.. diff --git a/instrumentation/internal/namingschematest/go.sum b/instrumentation/internal/namingschematest/go.sum index d453a86762..e2c89cb9ff 100644 --- a/instrumentation/internal/namingschematest/go.sum +++ b/instrumentation/internal/namingschematest/go.sum @@ -66,6 +66,8 @@ github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRB github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI= +github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= @@ -127,6 +129,10 @@ github.com/aws/smithy-go v1.20.3 h1:ryHwveWzPV5BIof6fyDvor6V3iUL7nTfiTKXHiW05nE= github.com/aws/smithy-go v1.20.3/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= +github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 h1:N7oVaKyGp8bttX0bfZGmcGkjz7DLQXhAn3DNd3T0ous= github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c= github.com/buger/goterm v1.0.4 h1:Z9YvGmOih81P0FbVtEYTFF6YsSgxSUKEhf/f9bTMXbY= @@ -184,6 +190,8 @@ github.com/denisenkom/go-mssqldb v0.12.3 h1:pBSGx9Tq67pBOTLmxNuirNTeB8Vjmf886Kx+ github.com/denisenkom/go-mssqldb v0.12.3/go.mod h1:k0mtMFOnU+AihqFxPMiF05rtiDrorD1Vrm1KEz5hxDo= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/dimfeld/httptreemux/v5 v5.5.0 h1:p8jkiMrCuZ0CmhwYLcbNbl7DDo21fozhKHQ2PccwOFQ= @@ -243,6 +251,9 @@ github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= github.com/fsnotify/fsevents v0.1.1 h1:/125uxJvvoSDDBPen6yUZbil8J9ydKZnnl3TWWmvnkw= github.com/fsnotify/fsevents v0.1.1/go.mod h1:+d+hS27T6k5J8CRaPLKFgwKYcpS7GwW3Ule9+SC2ZRc= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fvbommel/sortorder v1.0.2 h1:mV4o8B2hKboCdkJm+a7uX/SIpZob4JzUpc5GGnM45eo= github.com/fvbommel/sortorder v1.0.2/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= @@ -254,6 +265,10 @@ github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/go-chi/chi v1.5.5 h1:vOB/HbEMt9QqBqErz07QehcOKHaWFtuj87tTDVz2qXE= +github.com/go-chi/chi v1.5.5/go.mod h1:C9JqLr3tIYjDOZpzn+BCuxY8z8vmca43EeMgyZt7irw= +github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= +github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -267,6 +282,10 @@ github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2Kv github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-pg/pg/v10 v10.13.0 h1:xMagDE57VP8Y2KvIf9PvrsOAIjX62XqaKmfEzB0c5eU= +github.com/go-pg/pg/v10 v10.13.0/go.mod h1:IXp9Ok9JNNW9yWedbQxxvKUv84XhoH5+tGd+68y+zDs= +github.com/go-pg/zerochecker v0.2.0 h1:pp7f72c3DobMWOb2ErtZsnrPaSvHd2W4o9//8HtF4mU= +github.com/go-pg/zerochecker v0.2.0/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -275,10 +294,20 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= +github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-redis/redis/v7 v7.4.1 h1:PASvf36gyUpr2zdOUS/9Zqc80GbM+9BDyiJSJDDOrTI= +github.com/go-redis/redis/v7 v7.4.1/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= +github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gocql/gocql v1.6.0 h1:IdFdOTbnpbd0pDhl4REKQDM+Q0SzKXQ1Yh+YZZ8T/qU= +github.com/gocql/gocql v1.6.0/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= +github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo= +github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= @@ -315,6 +344,8 @@ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomodule/redigo v1.8.9 h1:Sl3u+2BI/kk+VEatbj0scLdrFhjPmbxOc1myhDP41ws= +github.com/gomodule/redigo v1.8.9/go.mod h1:7ArFNvsTjH8GMMzB4uy1snslv2BwmginuMs06a1uzZE= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -356,6 +387,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= +github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hamba/avro v1.5.6/go.mod h1:3vNT0RLXXpFm2Tb/5KC71ZRJlOroggq1Rcitb6k4Fr8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= @@ -369,6 +402,7 @@ github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/heetch/avro v0.3.1/go.mod h1:4xn38Oz/+hiEUTpbVfGVLfvOg0yKLlRP7Q9+gJJILgA= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= @@ -383,6 +417,8 @@ github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+ github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ= github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= github.com/jhump/protoreflect v1.12.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -428,6 +464,7 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= @@ -487,6 +524,15 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/nrwiersma/avro-benchmarks v0.0.0-20210913175520-21aec48c8f76/go.mod h1:iKyFMidsk/sVYONJRE372sJuX/QTRPacU7imPqqsu7g= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= @@ -521,8 +567,9 @@ github.com/r3labs/sse v0.0.0-20210224172625-26fe804710bc h1:zAsgcP8MhzAbhMnB1QQ2 github.com/r3labs/sse v0.0.0-20210224172625-26fe804710bc/go.mod h1:S8xSOnV3CgpNrWd0GQ/OoQfMtlg2uPRSuTzcSGrzwK8= github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 h1:Qp27Idfgi6ACvFQat5+VJvlYToylpM/hcyLBI3WaKPA= github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052/go.mod h1:uvX/8buq8uVeiZiFht+0lqSLBHF+uGV8BrTv8W/SIwk= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= +github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a/go.mod h1:4r5QyqhjIWCcK8DO4KMclc5Iknq5qVBAlbYYzAbUScQ= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -564,6 +611,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -585,6 +633,8 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= +github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= github.com/tonistiigi/fsutil v0.0.0-20240301111122-7525a1af2bb5 h1:oZS8KCqAg62sxJkEq/Ppzqrb6EooqzWtL8Oaex7bc5c= github.com/tonistiigi/fsutil v0.0.0-20240301111122-7525a1af2bb5/go.mod h1:vbbYqJlnswsbJqWUcJN8fKtBhnEgldDrcagTgnBVKKM= github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0= @@ -597,8 +647,22 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= +github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= +github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= +github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/vektah/gqlparser/v2 v2.5.16 h1:1gcmLTvs3JLKXckwCwlUagVn/IlV2bwqle0vJ0vy5p8= github.com/vektah/gqlparser/v2 v2.5.16/go.mod h1:1lz1OeCqgQbQepsGxPVywrjdBHW2T08PUS3pJqepRww= +github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94= +github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ= +github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc= +github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= @@ -686,11 +750,13 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200505041828-1ed23360d12c/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -718,8 +784,10 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -734,6 +802,7 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= @@ -792,8 +861,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -819,13 +888,18 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v1 v1.0.0/go.mod h1:CxwszS/Xz1C49Ucd2i6Zil5UToP1EmyrFhKaMVbg1mk= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/httprequest.v1 v1.2.1/go.mod h1:x2Otw96yda5+8+6ZeWwHIJTFkEHWP/qP8pJOzqEtWPM= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/retry.v1 v1.0.3/go.mod h1:FJkXmWiMaAo7xB+xhvDF59zhfjDWyzmyAxiT4dB688g= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -854,6 +928,8 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +mellium.im/sasl v0.3.1 h1:wE0LW6g7U83vhvxjC1IY8DnXM+EU095yeo8XClvCdfo= +mellium.im/sasl v0.3.1/go.mod h1:xm59PUYpZHhgQ9ZqoJ5QaCqzWMi8IeS49dhp6plPCzw= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/instrumentation/internal/namingschematest/go_pg_v10_test.go b/instrumentation/internal/namingschematest/go_pg_v10_test.go index d35d5ac3a6..746f668751 100644 --- a/instrumentation/internal/namingschematest/go_pg_v10_test.go +++ b/instrumentation/internal/namingschematest/go_pg_v10_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" pgtrace "github.com/DataDog/dd-trace-go/contrib/go-pg/pg.v10/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/go_redis_v1_test.go b/instrumentation/internal/namingschematest/go_redis_v1_test.go index 2657a2b9f0..a058127da6 100644 --- a/instrumentation/internal/namingschematest/go_redis_v1_test.go +++ b/instrumentation/internal/namingschematest/go_redis_v1_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" redistrace "github.com/DataDog/dd-trace-go/contrib/go-redis/redis/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/go_redis_v7_test.go b/instrumentation/internal/namingschematest/go_redis_v7_test.go index bc7ca1b896..72c863aa26 100644 --- a/instrumentation/internal/namingschematest/go_redis_v7_test.go +++ b/instrumentation/internal/namingschematest/go_redis_v7_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" redistrace "github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v7/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/go_redis_v8_test.go b/instrumentation/internal/namingschematest/go_redis_v8_test.go index e541aec03d..7de7d43485 100644 --- a/instrumentation/internal/namingschematest/go_redis_v8_test.go +++ b/instrumentation/internal/namingschematest/go_redis_v8_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" redistrace "github.com/DataDog/dd-trace-go/contrib/go-redis/redis.v8/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/go_restful_v3_test.go b/instrumentation/internal/namingschematest/go_restful_v3_test.go index 3a0de1e968..9780666122 100644 --- a/instrumentation/internal/namingschematest/go_restful_v3_test.go +++ b/instrumentation/internal/namingschematest/go_restful_v3_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" restfultrace "github.com/DataDog/dd-trace-go/contrib/emicklei/go-restful.v3/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/gocql_test.go b/instrumentation/internal/namingschematest/gocql_test.go index cd45ffe301..72acd1e1f4 100644 --- a/instrumentation/internal/namingschematest/gocql_test.go +++ b/instrumentation/internal/namingschematest/gocql_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" gocqltrace "github.com/DataDog/dd-trace-go/contrib/gocql/gocql/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/gomemcache_test.go b/instrumentation/internal/namingschematest/gomemcache_test.go index 75dba7271d..cad302c1a6 100644 --- a/instrumentation/internal/namingschematest/gomemcache_test.go +++ b/instrumentation/internal/namingschematest/gomemcache_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" memcachetrace "github.com/DataDog/dd-trace-go/contrib/bradfitz/gomemcache/v2/memcache" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/gqlgen_test.go b/instrumentation/internal/namingschematest/gqlgen_test.go index bc0539e53a..bd7e59b699 100644 --- a/instrumentation/internal/namingschematest/gqlgen_test.go +++ b/instrumentation/internal/namingschematest/gqlgen_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/require" gqlgentrace "github.com/DataDog/dd-trace-go/contrib/99designs/gqlgen/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/grpc_test.go b/instrumentation/internal/namingschematest/grpc_test.go new file mode 100644 index 0000000000..bfbb28b14e --- /dev/null +++ b/instrumentation/internal/namingschematest/grpc_test.go @@ -0,0 +1,152 @@ +package namingschematest + +import ( + "context" + "net" + "testing" + "time" + + grpctrace "github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/v2" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" + "github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2/fixturepb" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/instrumentation" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +var ( + grpcServerTest = harness.TestCase{ + Name: instrumentation.PackageGRPC + "_server", + GenSpans: grpcGenSpansFn(false, true), + WantServiceNameV0: harness.ServiceNameAssertions{ + Defaults: harness.RepeatString("grpc.server", 4), + DDService: harness.RepeatString(harness.TestDDService, 4), + ServiceOverride: harness.RepeatString(harness.TestServiceOverride, 4), + }, + AssertOpV0: func(t *testing.T, spans []*mocktracer.Span) { + require.Len(t, spans, 4) + for i := 0; i < 4; i++ { + assert.Equal(t, "grpc.server", spans[i].OperationName()) + } + }, + AssertOpV1: func(t *testing.T, spans []*mocktracer.Span) { + require.Len(t, spans, 4) + for i := 0; i < 4; i++ { + assert.Equal(t, "grpc.server.request", spans[i].OperationName()) + } + }, + } + grpcClientTest = harness.TestCase{ + Name: instrumentation.PackageGRPC + "_client", + GenSpans: grpcGenSpansFn(true, false), + WantServiceNameV0: harness.ServiceNameAssertions{ + Defaults: harness.RepeatString("grpc.client", 4), + DDService: harness.RepeatString("grpc.client", 4), + ServiceOverride: harness.RepeatString(harness.TestServiceOverride, 4), + }, + AssertOpV0: func(t *testing.T, spans []*mocktracer.Span) { + require.Len(t, spans, 4) + for i := 0; i < 4; i++ { + assert.Equal(t, "grpc.client", spans[i].OperationName()) + } + }, + AssertOpV1: func(t *testing.T, spans []*mocktracer.Span) { + require.Len(t, spans, 4) + for i := 0; i < 4; i++ { + assert.Equal(t, "grpc.client.request", spans[i].OperationName()) + } + }, + } +) + +func grpcGenSpansFn(traceClient, traceServer bool) harness.GenSpansFn { + return func(t *testing.T, serviceOverride string) []*mocktracer.Span { + var opts []grpctrace.Option + if serviceOverride != "" { + opts = append(opts, grpctrace.WithService(serviceOverride)) + } + // exclude the grpc.message spans as they are not affected by naming schema + opts = append(opts, grpctrace.WithStreamMessages(false)) + mt := mocktracer.Start() + defer mt.Stop() + + var serverInterceptors []grpc.ServerOption + if traceServer { + serverInterceptors = append(serverInterceptors, + grpc.UnaryInterceptor(grpctrace.UnaryServerInterceptor(opts...)), + grpc.StreamInterceptor(grpctrace.StreamServerInterceptor(opts...)), + grpc.StatsHandler(grpctrace.NewServerStatsHandler(opts...)), + ) + } + clientInterceptors := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} + if traceClient { + clientInterceptors = append(clientInterceptors, + grpc.WithUnaryInterceptor(grpctrace.UnaryClientInterceptor(opts...)), + grpc.WithStreamInterceptor(grpctrace.StreamClientInterceptor(opts...)), + grpc.WithStatsHandler(grpctrace.NewClientStatsHandler(opts...)), + ) + } + client := startGRPCTestServer(t, serverInterceptors, clientInterceptors) + _, err := client.Ping(context.Background(), &fixturepb.FixtureRequest{Name: "pass"}) + require.NoError(t, err) + + stream, err := client.StreamPing(context.Background()) + require.NoError(t, err) + err = stream.Send(&fixturepb.FixtureRequest{Name: "break"}) + require.NoError(t, err) + _, err = stream.Recv() + require.NoError(t, err) + err = stream.CloseSend() + require.NoError(t, err) + // to flush the spans + _, _ = stream.Recv() + + waitForSpans(t, mt, 4, 2*time.Second) + return mt.FinishedSpans() + } +} + +func startGRPCTestServer( + t *testing.T, + serverInterceptors []grpc.ServerOption, + clientInterceptors []grpc.DialOption, +) fixturepb.FixtureClient { + server := grpc.NewServer(serverInterceptors...) + srv := fixturepb.NewFixtureServer() + fixturepb.RegisterFixtureServer(server, srv) + + li, err := net.Listen("tcp", "127.0.0.1:0") + require.NoError(t, err) + + _, port, _ := net.SplitHostPort(li.Addr().String()) + // start our test server + go server.Serve(li) + t.Cleanup(server.Stop) + + conn, err := grpc.NewClient("localhost:"+port, clientInterceptors...) + require.NoError(t, err) + + return fixturepb.NewFixtureClient(conn) +} + +func waitForSpans(t *testing.T, mt mocktracer.Tracer, minSpans int, timeout time.Duration) { + timeoutChan := time.After(timeout) + ticker := time.NewTicker(100 * time.Millisecond) + defer ticker.Stop() + + for { + if len(mt.FinishedSpans()) >= minSpans { + return + } + select { + case <-ticker.C: + continue + case <-timeoutChan: + assert.FailNow(t, "timeout waiting for spans", "(want: %d, got: %d)", minSpans, len(mt.FinishedSpans())) + } + } +} diff --git a/instrumentation/internal/namingschematest/httptreemux_v5_test.go b/instrumentation/internal/namingschematest/httptreemux_v5_test.go index ebe0e0562a..55865d0de9 100644 --- a/instrumentation/internal/namingschematest/httptreemux_v5_test.go +++ b/instrumentation/internal/namingschematest/httptreemux_v5_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" httptrace "github.com/DataDog/dd-trace-go/contrib/dimfeld/httptreemux.v5/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/main_test.go b/instrumentation/internal/namingschematest/main_test.go index 1e731d51e0..a0dc3ee042 100644 --- a/instrumentation/internal/namingschematest/main_test.go +++ b/instrumentation/internal/namingschematest/main_test.go @@ -9,7 +9,7 @@ import ( "os" "testing" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" ) func TestNamingSchema(t *testing.T) { @@ -41,6 +41,8 @@ func TestNamingSchema(t *testing.T) { goRedisV7Test, goRedisV8Test, gocqlTest, + grpcServerTest, + grpcClientTest, fiberV2Test, redigoTest, netHTTPServer, diff --git a/instrumentation/internal/namingschematest/mgo_test.go b/instrumentation/internal/namingschematest/mgo_test.go index 40ca22f2b4..31f8066657 100644 --- a/instrumentation/internal/namingschematest/mgo_test.go +++ b/instrumentation/internal/namingschematest/mgo_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" mgotrace "github.com/DataDog/dd-trace-go/contrib/globalsign/mgo/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/mongodriver_test.go b/instrumentation/internal/namingschematest/mongodriver_test.go index 2f88aa8255..f7d0a3c9f6 100644 --- a/instrumentation/internal/namingschematest/mongodriver_test.go +++ b/instrumentation/internal/namingschematest/mongodriver_test.go @@ -17,7 +17,7 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" mongotrace "github.com/DataDog/dd-trace-go/contrib/go.mongodb.org/mongo-driver/v2/mongo" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/negroni_test.go b/instrumentation/internal/namingschematest/negroni_test.go index adf6ffa7ac..eb156eed08 100644 --- a/instrumentation/internal/namingschematest/negroni_test.go +++ b/instrumentation/internal/namingschematest/negroni_test.go @@ -15,7 +15,7 @@ import ( "github.com/urfave/negroni" negronitrace "github.com/DataDog/dd-trace-go/contrib/urfave/negroni/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/net_http_test.go b/instrumentation/internal/namingschematest/net_http_test.go index 0b4e859146..1cbd57adea 100644 --- a/instrumentation/internal/namingschematest/net_http_test.go +++ b/instrumentation/internal/namingschematest/net_http_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" httptrace "github.com/DataDog/dd-trace-go/contrib/net/http/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/internal/namingschematest/redigo_test.go b/instrumentation/internal/namingschematest/redigo_test.go index 95eed3698c..a1ee1f981e 100644 --- a/instrumentation/internal/namingschematest/redigo_test.go +++ b/instrumentation/internal/namingschematest/redigo_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" redigotrace "github.com/DataDog/dd-trace-go/contrib/gomodule/redigo/v2" - "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/harness" + "github.com/DataDog/dd-trace-go/instrumentation/internal/namingschematest/v2/harness" "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/DataDog/dd-trace-go/v2/instrumentation" ) diff --git a/instrumentation/packages.go b/instrumentation/packages.go index 7775737bf0..d71a9678f0 100644 --- a/instrumentation/packages.go +++ b/instrumentation/packages.go @@ -39,7 +39,7 @@ const ( PackageGoFiberV2 Package = "gofiber/fiber.v2" PackageRedigo Package = "gomodule/redigo" PackageGoogleAPI Package = "google.golang.org/api" - + PackageGRPC Package = "google.golang.org/grpc" // TODO: ... PackageNetHTTP Package = "net/http" @@ -424,7 +424,24 @@ var packages = map[Package]PackageInfo{ EnvVarPrefix: "GOOGLE_API", naming: nil, // this package does not use naming schema }, - + PackageGRPC: { + TracedPackage: "google.golang.org/grpc", + EnvVarPrefix: "GRPC", + naming: map[Component]componentNames{ + ComponentServer: { + useDDServiceV0: true, + buildServiceNameV0: staticName("grpc.server"), + buildOpNameV0: staticName("grpc.server"), + buildOpNameV1: staticName("grpc.server.request"), + }, + ComponentClient: { + useDDServiceV0: false, + buildServiceNameV0: staticName("grpc.client"), + buildOpNameV0: staticName("grpc.client"), + buildOpNameV1: staticName("grpc.client.request"), + }, + }, + }, // TODO PackageNetHTTP: { diff --git a/instrumentation/testutils/grpc/fixturepb/fixture.go b/instrumentation/testutils/grpc/fixturepb/fixture.go new file mode 100644 index 0000000000..215bb9d029 --- /dev/null +++ b/instrumentation/testutils/grpc/fixturepb/fixture.go @@ -0,0 +1,76 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +//go:generate sh ./gen_proto.sh . + +package fixturepb + +import ( + "context" + "sync/atomic" + + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// FixtureSrv a dummy implementation of FixtureServer. +type FixtureSrv struct { + UnimplementedFixtureServer + LastRequestMetadata atomic.Value +} + +func NewFixtureServer() *FixtureSrv { + return &FixtureSrv{} +} + +func (s *FixtureSrv) StreamPing(stream Fixture_StreamPingServer) (err error) { + for { + msg, err := stream.Recv() + if err != nil { + return err + } + + reply, err := s.Ping(stream.Context(), msg) + if err != nil { + return err + } + + err = stream.Send(reply) + if err != nil { + return err + } + + if msg.Name == "break" { + return nil + } + } +} + +func (s *FixtureSrv) Ping(ctx context.Context, in *FixtureRequest) (*FixtureReply, error) { + if md, ok := metadata.FromIncomingContext(ctx); ok { + s.LastRequestMetadata.Store(md) + } + switch { + case in.Name == "child": + span, _ := tracer.StartSpanFromContext(ctx, "child") + span.Finish() + return &FixtureReply{Message: "child"}, nil + case in.Name == "disabled": + if _, ok := tracer.SpanFromContext(ctx); ok { + panic("should be disabled") + } + return &FixtureReply{Message: "disabled"}, nil + case in.Name == "invalid": + return nil, status.Error(codes.InvalidArgument, "invalid") + case in.Name == "errorDetails": + s, _ := status.New(codes.Unknown, "unknown"). + WithDetails(&FixtureReply{Message: "a"}, &FixtureReply{Message: "b"}) + return nil, s.Err() + } + return &FixtureReply{Message: "passed"}, nil +} diff --git a/contrib/google.golang.org/grpc/fixtures_test.pb.go b/instrumentation/testutils/grpc/fixturepb/fixture.pb.go similarity index 54% rename from contrib/google.golang.org/grpc/fixtures_test.pb.go rename to instrumentation/testutils/grpc/fixturepb/fixture.pb.go index 083542dc72..f4ad5d9216 100644 --- a/contrib/google.golang.org/grpc/fixtures_test.pb.go +++ b/instrumentation/testutils/grpc/fixturepb/fixture.pb.go @@ -1,22 +1,21 @@ // Unless explicitly stated otherwise all files in this repository are licensed // under the Apache License Version 2.0. // This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2023 Datadog, Inc. +// Copyright 2024 Datadog, Inc. // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 -// source: fixtures_test.proto +// protoc v5.27.3 +// source: fixture.proto -package grpc +package fixturepb import ( - reflect "reflect" - sync "sync" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -38,7 +37,7 @@ type FixtureRequest struct { func (x *FixtureRequest) Reset() { *x = FixtureRequest{} if protoimpl.UnsafeEnabled { - mi := &file_fixtures_test_proto_msgTypes[0] + mi := &file_fixture_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -51,7 +50,7 @@ func (x *FixtureRequest) String() string { func (*FixtureRequest) ProtoMessage() {} func (x *FixtureRequest) ProtoReflect() protoreflect.Message { - mi := &file_fixtures_test_proto_msgTypes[0] + mi := &file_fixture_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -64,7 +63,7 @@ func (x *FixtureRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use FixtureRequest.ProtoReflect.Descriptor instead. func (*FixtureRequest) Descriptor() ([]byte, []int) { - return file_fixtures_test_proto_rawDescGZIP(), []int{0} + return file_fixture_proto_rawDescGZIP(), []int{0} } func (x *FixtureRequest) GetName() string { @@ -86,7 +85,7 @@ type FixtureReply struct { func (x *FixtureReply) Reset() { *x = FixtureReply{} if protoimpl.UnsafeEnabled { - mi := &file_fixtures_test_proto_msgTypes[1] + mi := &file_fixture_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99,7 +98,7 @@ func (x *FixtureReply) String() string { func (*FixtureReply) ProtoMessage() {} func (x *FixtureReply) ProtoReflect() protoreflect.Message { - mi := &file_fixtures_test_proto_msgTypes[1] + mi := &file_fixture_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112,7 +111,7 @@ func (x *FixtureReply) ProtoReflect() protoreflect.Message { // Deprecated: Use FixtureReply.ProtoReflect.Descriptor instead. func (*FixtureReply) Descriptor() ([]byte, []int) { - return file_fixtures_test_proto_rawDescGZIP(), []int{1} + return file_fixture_proto_rawDescGZIP(), []int{1} } func (x *FixtureReply) GetMessage() string { @@ -122,51 +121,52 @@ func (x *FixtureReply) GetMessage() string { return "" } -var File_fixtures_test_proto protoreflect.FileDescriptor - -var file_fixtures_test_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x66, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x73, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x24, 0x0a, 0x0e, 0x46, - 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x22, 0x28, 0x0a, 0x0c, 0x46, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x7b, 0x0a, 0x07, 0x46, - 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x12, 0x32, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x14, - 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x69, 0x78, 0x74, - 0x75, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x0a, 0x53, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, +var File_fixture_proto protoreflect.FileDescriptor + +var file_fixture_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x66, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x24, 0x0a, 0x0e, 0x46, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x28, 0x0a, 0x0c, 0x46, + 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x7b, 0x0a, 0x07, 0x46, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, + 0x12, 0x32, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x6c, 0x0a, 0x19, 0x69, 0x6f, 0x2e, 0x67, - 0x72, 0x70, 0x63, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x67, 0x72, 0x70, 0x63, 0x42, 0x0d, 0x54, 0x65, 0x73, 0x74, 0x47, 0x52, 0x50, 0x43, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x6f, 0x70, 0x6b, 0x67, 0x2e, 0x69, 0x6e, - 0x2f, 0x44, 0x61, 0x74, 0x61, 0x44, 0x6f, 0x67, 0x2f, 0x64, 0x64, 0x2d, 0x74, 0x72, 0x61, 0x63, - 0x65, 0x2d, 0x67, 0x6f, 0x2e, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2f, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, - 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x50, 0x69, + 0x6e, 0x67, 0x12, 0x14, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x69, 0x78, 0x74, 0x75, 0x72, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x46, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x28, 0x01, + 0x30, 0x01, 0x42, 0x7e, 0x0a, 0x19, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x67, 0x72, 0x70, 0x63, 0x42, + 0x0d, 0x54, 0x65, 0x73, 0x74, 0x47, 0x52, 0x50, 0x43, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x61, 0x74, + 0x61, 0x44, 0x6f, 0x67, 0x2f, 0x64, 0x64, 0x2d, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2d, 0x67, 0x6f, + 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x66, 0x69, 0x78, 0x74, 0x75, 0x72, 0x65, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_fixtures_test_proto_rawDescOnce sync.Once - file_fixtures_test_proto_rawDescData = file_fixtures_test_proto_rawDesc + file_fixture_proto_rawDescOnce sync.Once + file_fixture_proto_rawDescData = file_fixture_proto_rawDesc ) -func file_fixtures_test_proto_rawDescGZIP() []byte { - file_fixtures_test_proto_rawDescOnce.Do(func() { - file_fixtures_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_fixtures_test_proto_rawDescData) +func file_fixture_proto_rawDescGZIP() []byte { + file_fixture_proto_rawDescOnce.Do(func() { + file_fixture_proto_rawDescData = protoimpl.X.CompressGZIP(file_fixture_proto_rawDescData) }) - return file_fixtures_test_proto_rawDescData + return file_fixture_proto_rawDescData } -var file_fixtures_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_fixtures_test_proto_goTypes = []interface{}{ +var file_fixture_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_fixture_proto_goTypes = []interface{}{ (*FixtureRequest)(nil), // 0: grpc.FixtureRequest (*FixtureReply)(nil), // 1: grpc.FixtureReply } -var file_fixtures_test_proto_depIdxs = []int32{ +var file_fixture_proto_depIdxs = []int32{ 0, // 0: grpc.Fixture.Ping:input_type -> grpc.FixtureRequest 0, // 1: grpc.Fixture.StreamPing:input_type -> grpc.FixtureRequest 1, // 2: grpc.Fixture.Ping:output_type -> grpc.FixtureReply @@ -178,13 +178,13 @@ var file_fixtures_test_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_fixtures_test_proto_init() } -func file_fixtures_test_proto_init() { - if File_fixtures_test_proto != nil { +func init() { file_fixture_proto_init() } +func file_fixture_proto_init() { + if File_fixture_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_fixtures_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_fixture_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FixtureRequest); i { case 0: return &v.state @@ -196,7 +196,7 @@ func file_fixtures_test_proto_init() { return nil } } - file_fixtures_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_fixture_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FixtureReply); i { case 0: return &v.state @@ -213,18 +213,18 @@ func file_fixtures_test_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_fixtures_test_proto_rawDesc, + RawDescriptor: file_fixture_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_fixtures_test_proto_goTypes, - DependencyIndexes: file_fixtures_test_proto_depIdxs, - MessageInfos: file_fixtures_test_proto_msgTypes, + GoTypes: file_fixture_proto_goTypes, + DependencyIndexes: file_fixture_proto_depIdxs, + MessageInfos: file_fixture_proto_msgTypes, }.Build() - File_fixtures_test_proto = out.File - file_fixtures_test_proto_rawDesc = nil - file_fixtures_test_proto_goTypes = nil - file_fixtures_test_proto_depIdxs = nil + File_fixture_proto = out.File + file_fixture_proto_rawDesc = nil + file_fixture_proto_goTypes = nil + file_fixture_proto_depIdxs = nil } diff --git a/contrib/google.golang.org/grpc/fixtures_test.proto b/instrumentation/testutils/grpc/fixturepb/fixture.proto similarity index 93% rename from contrib/google.golang.org/grpc/fixtures_test.proto rename to instrumentation/testutils/grpc/fixturepb/fixture.proto index 5395336ace..eadf63c248 100644 --- a/contrib/google.golang.org/grpc/fixtures_test.proto +++ b/instrumentation/testutils/grpc/fixturepb/fixture.proto @@ -3,7 +3,7 @@ syntax = "proto3"; option java_multiple_files = true; option java_package = "io.grpc.examples.testgrpc"; option java_outer_classname = "TestGRPCProto"; -option go_package = "github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc";/v2 +option go_package = "github.com/DataDog/dd-trace-go/contrib/google.golang.org/grpc/internal/fixturepb"; package grpc; diff --git a/contrib/google.golang.org/grpc/fixtures_test_grpc.pb.go b/instrumentation/testutils/grpc/fixturepb/fixture_grpc.pb.go similarity index 97% rename from contrib/google.golang.org/grpc/fixtures_test_grpc.pb.go rename to instrumentation/testutils/grpc/fixturepb/fixture_grpc.pb.go index 0a13df6756..c0081b9bbd 100644 --- a/contrib/google.golang.org/grpc/fixtures_test_grpc.pb.go +++ b/instrumentation/testutils/grpc/fixturepb/fixture_grpc.pb.go @@ -1,19 +1,18 @@ // Unless explicitly stated otherwise all files in this repository are licensed // under the Apache License Version 2.0. // This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2023 Datadog, Inc. +// Copyright 2024 Datadog, Inc. // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 -// source: fixtures_test.proto +// - protoc v5.27.3 +// source: fixture.proto -package grpc +package fixturepb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -181,5 +180,5 @@ var Fixture_ServiceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "fixtures_test.proto", + Metadata: "fixture.proto", } diff --git a/contrib/google.golang.org/grpc/gen_proto.sh b/instrumentation/testutils/grpc/fixturepb/gen_proto.sh similarity index 93% rename from contrib/google.golang.org/grpc/gen_proto.sh rename to instrumentation/testutils/grpc/fixturepb/gen_proto.sh index 3affdf0783..5945f667d9 100755 --- a/contrib/google.golang.org/grpc/gen_proto.sh +++ b/instrumentation/testutils/grpc/fixturepb/gen_proto.sh @@ -1,5 +1,8 @@ #!/bin/sh +OUT_DIR=$1 +cd $OUT_DIR + YEAR=$(date +'%Y') COPYRIGHT_HEADER="// Unless explicitly stated otherwise all files in this repository are licensed // under the Apache License Version 2.0. @@ -10,7 +13,7 @@ COPYRIGHT_HEADER="// Unless explicitly stated otherwise all files in this reposi go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0 -protoc fixtures_test.proto \ +protoc fixture.proto \ --go_out=. \ --go_opt=paths=source_relative \ --go-grpc_out=. \ diff --git a/instrumentation/testutils/grpc/go.mod b/instrumentation/testutils/grpc/go.mod new file mode 100644 index 0000000000..77237aab9a --- /dev/null +++ b/instrumentation/testutils/grpc/go.mod @@ -0,0 +1,42 @@ +module github.com/DataDog/dd-trace-go/instrumentation/testutils/grpc/v2 + +go 1.21 + +require ( + github.com/DataDog/dd-trace-go/v2 v2.0.0-00010101000000-000000000000 + google.golang.org/grpc v1.65.0 + google.golang.org/protobuf v1.34.2 +) + +require ( + github.com/DataDog/appsec-internal-go v1.5.0 // indirect + github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 // indirect + github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 // indirect + github.com/DataDog/datadog-go/v5 v5.3.0 // indirect + github.com/DataDog/go-libddwaf/v2 v2.4.2 // indirect + github.com/DataDog/go-tuf v1.0.2-0.5.2 // indirect + github.com/DataDog/sketches-go v1.4.3 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/ebitengine/purego v0.6.0-alpha.5 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/outcaste-io/ristretto v0.2.3 // indirect + github.com/philhofer/fwd v1.1.2 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/secure-systems-lab/go-securesystemslib v0.8.0 // indirect + github.com/tinylib/msgp v1.1.9 // indirect + go.uber.org/atomic v1.11.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + golang.org/x/time v0.5.0 // indirect + golang.org/x/tools v0.16.1 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect +) + +replace github.com/DataDog/dd-trace-go/v2 => ../../.. diff --git a/instrumentation/testutils/grpc/go.sum b/instrumentation/testutils/grpc/go.sum new file mode 100644 index 0000000000..053637aff4 --- /dev/null +++ b/instrumentation/testutils/grpc/go.sum @@ -0,0 +1,153 @@ +github.com/DataDog/appsec-internal-go v1.5.0 h1:8kS5zSx5T49uZ8dZTdT19QVAvC/B8ByyZdhQKYQWHno= +github.com/DataDog/appsec-internal-go v1.5.0/go.mod h1:pEp8gjfNLtEOmz+iZqC8bXhu0h4k7NUsW/qiQb34k1U= +github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 h1:bUMSNsw1iofWiju9yc1f+kBd33E3hMJtq9GuU602Iy8= +github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0/go.mod h1:HzySONXnAgSmIQfL6gOv9hWprKJkx8CicuXuUbmgWfo= +github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 h1:5nE6N3JSs2IG3xzMthNFhXfOaXlrsdgqmJ73lndFf8c= +github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1/go.mod h1:Vc+snp0Bey4MrrJyiV2tVxxJb6BmLomPvN1RgAvjGaQ= +github.com/DataDog/datadog-go/v5 v5.3.0 h1:2q2qjFOb3RwAZNU+ez27ZVDwErJv5/VpbBPprz7Z+s8= +github.com/DataDog/datadog-go/v5 v5.3.0/go.mod h1:XRDJk1pTc00gm+ZDiBKsjh7oOOtJfYfglVCmFb8C2+Q= +github.com/DataDog/go-libddwaf/v2 v2.4.2 h1:ilquGKUmN9/Ty0sIxiEyznVRxP3hKfmH15Y1SMq5gjA= +github.com/DataDog/go-libddwaf/v2 v2.4.2/go.mod h1:gsCdoijYQfj8ce/T2bEDNPZFIYnmHluAgVDpuQOWMZE= +github.com/DataDog/go-tuf v1.0.2-0.5.2 h1:EeZr937eKAWPxJ26IykAdWA4A0jQXJgkhUjqEI/w7+I= +github.com/DataDog/go-tuf v1.0.2-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= +github.com/DataDog/gostackparse v0.7.0 h1:i7dLkXHvYzHV308hnkvVGDL3BR4FWl7IsXNPz/IGQh4= +github.com/DataDog/gostackparse v0.7.0/go.mod h1:lTfqcJKqS9KnXQGnyQMCugq3u1FP6UZMfWR0aitKFMM= +github.com/DataDog/sketches-go v1.4.3 h1:ZB9nijteJRFUQixkQfatCqASartGNfiolIlMiEv3u/w= +github.com/DataDog/sketches-go v1.4.3/go.mod h1:XR0ns2RtEEF09mDKXiKZiQg+nfZStrq1ZuL1eezeZe0= +github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/ebitengine/purego v0.6.0-alpha.5 h1:EYID3JOAdmQ4SNZYJHu9V6IqOeRQDBYxqKAg9PyoHFY= +github.com/ebitengine/purego v0.6.0-alpha.5/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +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/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b h1:h9U78+dx9a4BKdQkBBos92HalKpaGKHrp+3Uo6yTodo= +github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +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/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/outcaste-io/ristretto v0.2.3 h1:AK4zt/fJ76kjlYObOeNwh4T3asEuaCmp26pOvUOL9w0= +github.com/outcaste-io/ristretto v0.2.3/go.mod h1:W8HywhmtlopSB1jeMg3JtdIhf+DYkLAr0VN/s4+MHac= +github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= +github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 h1:Qp27Idfgi6ACvFQat5+VJvlYToylpM/hcyLBI3WaKPA= +github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052/go.mod h1:uvX/8buq8uVeiZiFht+0lqSLBHF+uGV8BrTv8W/SIwk= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA= +github.com/secure-systems-lab/go-securesystemslib v0.8.0/go.mod h1:UH2VZVuJfCYR8WgMlCU1uFsOUU+KeyrTWcSS73NBOzU= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= +github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +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/tinylib/msgp v1.1.9 h1:SHf3yoO2sGA0veCJeCBYLHuttAVFHGm2RHgNodW7wQU= +github.com/tinylib/msgp v1.1.9/go.mod h1:BCXGB54lDD8qUEPmiG0cQQUANC4IUQyB2ItS2UDlO/k= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +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= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/gotraceui v0.2.0 h1:dmNsfQ9Vl3GwbiVD7Z8d/osC6WtGGrasyrC2suc4ZIQ= +honnef.co/go/gotraceui v0.2.0/go.mod h1:qHo4/W75cA3bX0QQoSvDjbJa4R8mAyyFjbWAj63XElc= diff --git a/internal/appsec/appsec.go b/internal/appsec/appsec.go index 49dde04bb9..19c5fe540f 100644 --- a/internal/appsec/appsec.go +++ b/internal/appsec/appsec.go @@ -13,8 +13,8 @@ import ( appsecLog "github.com/DataDog/appsec-internal-go/log" waf "github.com/DataDog/go-libddwaf/v2" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/internal/appsec/config" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/internal/log" ) diff --git a/internal/appsec/listener/graphqlsec/graphql.go b/internal/appsec/listener/graphqlsec/graphql.go index fdeb912bcb..efde5a3cf2 100644 --- a/internal/appsec/listener/graphqlsec/graphql.go +++ b/internal/appsec/listener/graphqlsec/graphql.go @@ -12,13 +12,13 @@ import ( waf "github.com/DataDog/go-libddwaf/v2" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/graphqlsec/types" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" "github.com/DataDog/dd-trace-go/v2/internal/appsec/config" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener" shared "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener/sharedsec" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/DataDog/dd-trace-go/v2/internal/samplernames" ) diff --git a/internal/appsec/listener/grpcsec/grpc.go b/internal/appsec/listener/grpcsec/grpc.go index cdda42bb07..8633c92262 100644 --- a/internal/appsec/listener/grpcsec/grpc.go +++ b/internal/appsec/listener/grpcsec/grpc.go @@ -14,10 +14,10 @@ import ( waf "github.com/DataDog/go-libddwaf/v2" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/grpcsec/types" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/appsec/config" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/grpcsec/types" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener" "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener/httpsec" shared "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener/sharedsec" diff --git a/internal/appsec/listener/httpsec/http.go b/internal/appsec/listener/httpsec/http.go index b87dfcf029..21af4de5c0 100644 --- a/internal/appsec/listener/httpsec/http.go +++ b/internal/appsec/listener/httpsec/http.go @@ -14,10 +14,10 @@ import ( waf "github.com/DataDog/go-libddwaf/v2" "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/httpsec/types" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/appsec/config" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener" shared "github.com/DataDog/dd-trace-go/v2/internal/appsec/listener/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/log" diff --git a/internal/appsec/listener/sharedsec/shared.go b/internal/appsec/listener/sharedsec/shared.go index 2a2bd07114..5d6798f53f 100644 --- a/internal/appsec/listener/sharedsec/shared.go +++ b/internal/appsec/listener/sharedsec/shared.go @@ -12,9 +12,9 @@ import ( "github.com/DataDog/appsec-internal-go/limiter" waf "github.com/DataDog/go-libddwaf/v2" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" "github.com/DataDog/dd-trace-go/v2/internal/log" ) diff --git a/internal/appsec/listener/sharedsec/shared_test.go b/internal/appsec/listener/sharedsec/shared_test.go index 5d5559b057..3c9fe74977 100644 --- a/internal/appsec/listener/sharedsec/shared_test.go +++ b/internal/appsec/listener/sharedsec/shared_test.go @@ -11,7 +11,7 @@ import ( waf "github.com/DataDog/go-libddwaf/v2" "github.com/stretchr/testify/require" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/trace" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/trace" ) const ( diff --git a/internal/appsec/waf.go b/internal/appsec/waf.go index 288f4dcf5d..44ef57ad29 100644 --- a/internal/appsec/waf.go +++ b/internal/appsec/waf.go @@ -9,9 +9,9 @@ import ( "github.com/DataDog/appsec-internal-go/limiter" waf "github.com/DataDog/go-libddwaf/v2" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/appsec/config" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" - "github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec" "github.com/DataDog/dd-trace-go/v2/internal/log" ) diff --git a/internal/log/log.go b/internal/log/log.go index adbc51e442..c3ad618877 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -55,10 +55,6 @@ var prefixMsg = fmt.Sprintf("Datadog Tracer %s", version.Tag) type Logger interface { // Log prints the given message. Log(msg string) - //Debug(msg string, args ...any) - //Info(msg string, args ...any) - //Warn(msg string, args ...any) - //Error(msg string, args ...any) } var ( diff --git a/internal/tracer.go b/internal/tracer.go new file mode 100644 index 0000000000..da7a4c5f2f --- /dev/null +++ b/internal/tracer.go @@ -0,0 +1,20 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package internal + +import "sync/atomic" + +var ( + tracerInit atomic.Bool +) + +func SetTracerInitialized(val bool) { + tracerInit.Store(val) +} + +func TracerInitialized() bool { + return tracerInit.Load() +} diff --git a/internal/v1.go b/internal/v1.go deleted file mode 100644 index 0c42064e94..0000000000 --- a/internal/v1.go +++ /dev/null @@ -1,12 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016 Datadog, Inc. - -package internal - -import "github.com/DataDog/dd-trace-go/v2/ddtrace" - -// SetPropagatingTag is an intermediary holder to push the propagating tag code -// into the internal package, so that it can be used by v1internal. -var SetPropagatingTag func(ctx ddtrace.SpanContext, k, v string) diff --git a/tools/fixmodules/main.go b/tools/fixmodules/main.go index 690679f421..1649f4294d 100644 --- a/tools/fixmodules/main.go +++ b/tools/fixmodules/main.go @@ -126,18 +126,17 @@ func main() { replacesSet := make(map[string]Replace) for _, im := range imports { - if im == mod.Module.Path { - // exclude self - continue - } // the module name and the import path might be different (when the imported package is a sub-package) importModule := im if strings.HasPrefix(im, "github.com/DataDog/dd-trace-go") { if left, _, ok := strings.Cut(im, "/v2"); ok { - fmt.Println(left) importModule = left + "/v2" } } + if importModule == mod.Module.Path { + // exclude self + continue + } // it's a local module _, ok := allModules[importModule] if ok { diff --git a/v1internal/v1internal.go b/v1internal/v1internal.go deleted file mode 100644 index 03ef1e8911..0000000000 --- a/v1internal/v1internal.go +++ /dev/null @@ -1,20 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2024 Datadog, Inc. - -// Package v1internal provides support for v1 as frontend of v2 implementation. -// Note that this package is for dd-trace-go internal usage only. -// This package is not intended for use by external consumers, no API stability is guaranteed. -package v1internal - -import ( - "github.com/DataDog/dd-trace-go/v2/ddtrace" - "github.com/DataDog/dd-trace-go/v2/internal" -) - -// SetPropagatingTag sets the key/value pair as a trace propagating tag. -// This function is not intended for use by external consumers, no API stability is guaranteed. -func SetPropagatingTag(ctx ddtrace.SpanContext, k, v string) { - internal.SetPropagatingTag(ctx, k, v) -}