Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/google.golang.org/grpc: WithUntracedMethods #2371

Closed
rafaeljusto opened this issue Nov 20, 2023 · 3 comments
Closed

contrib/google.golang.org/grpc: WithUntracedMethods #2371

rafaeljusto opened this issue Nov 20, 2023 · 3 comments
Labels
bug unintended behavior that has to be fixed

Comments

@rafaeljusto
Copy link
Contributor

Version of dd-trace-go
v1.58.0-rc.1

Describe what happened:

Not sure this should be considered a bug, but as Github's discussion section is disabled I couldn't find other official places to ask this question. Please let me know if there's a better channel so I can close this one.

I'm currently trying to exclude client gRPC spans that are related to health check calls:
image

As you can see in the image below, the full_method is /grpc.health.v1.Health/Check.

image

But when adding the WithUntracedMethods option to the code nothing happens.

import (
  "google.golang.org/grpc"
  grpcddtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/grpc"
)

// ...

opts := []grpc.DialOption{
  grpc.WithStreamInterceptor(grpcddtrace.StreamClientInterceptor(
    grpcddtrace.WithServiceName("grpc-hub"),
    grpcddtrace.WithUntracedMethods("/grpc.health.v1.Health/Check"),
  )),
}

From what I can see checking the source code, the rpc.grpc.full_method should match what I need to provide as an argument for WithUntracedMethods.

tracer.Tag(ext.GRPCFullMethod, method),

So it's unclear why the spans are not being dropped. Big chance I'm doing something wrong. 😄 Would you have an idea what it could be?

Describe what you expected:
gRPC spans with rpc.grpc.full_method matching the attribute from WithUntracedMethods to be dropped from the trace.

Steps to reproduce the issue:
Use the WithUntracedMethods in the gRPC client.

Additional environment details (Version of Go, Operating System, etc.):
Go version: 1.21
OS: Linux

@rafaeljusto rafaeljusto added the bug unintended behavior that has to be fixed label Nov 20, 2023
@eyasy1217
Copy link
Contributor

Hi
Because it is not set to grpc.WithUnaryInterceptor?
You can also use Health_Check_FullMethodName in package grpc_health_v1 instead of "/grpc.health.v1.Health/Check".

@rafaeljusto
Copy link
Contributor Author

Because it is not set to grpc.WithUnaryInterceptor?

🤦 Sorry, I will add it to the grpc.WithUnaryInterceptor section and check this again. I'm on holiday, so will be able to check only in January.

opts := []grpc.DialOption{
  grpc.WithStreamInterceptor(grpcddtrace.StreamClientInterceptor(
    grpcddtrace.WithServiceName("grpc-hub"),
    grpcddtrace.WithUntracedMethods("/grpc.health.v1.Health/Check"),
  )),
  grpc.WithUnaryInterceptor(grpcmiddleware.ChainUnaryClient(
    grpcddtrace.UnaryClientInterceptor(
      grpcddtrace.WithServiceName("grpc-hub"),
      grpcddtrace.WithUntracedMethods("/grpc.health.v1.Health/Check"),
    ),
  )),
}

@rafaeljusto
Copy link
Contributor Author

Looks like it worked, thank you! Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unintended behavior that has to be fixed
Projects
None yet
Development

No branches or pull requests

2 participants