Skip to content

Instantly share code, notes, and snippets.

@theothertomelliott
Created November 13, 2022 00:13
Show Gist options
  • Save theothertomelliott/8e0f6df45206e93deb36cdbdd49b66d5 to your computer and use it in GitHub Desktop.
Save theothertomelliott/8e0f6df45206e93deb36cdbdd49b66d5 to your computer and use it in GitHub Desktop.
How to filter gRPC health checks from opentelemetry incerceptors
import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/filters"
// ...
grpc.UnaryInterceptor(
otelgrpc.UnaryServerInterceptor(
otelgrpc.WithInterceptorFilter(
filters.Not(
filters.HealthCheck(),
),
),
),
),
@fpaganetto
Copy link

thanks

@theothertomelliott
Copy link
Author

thanks

Glad it was useful!

@ekkinox
Copy link

ekkinox commented Oct 4, 2023

man, exactly what I needed, many thx !

@FedeBev
Copy link

FedeBev commented Dec 8, 2023

Thanks for this!

Any idea how to do this now that otelgrpc.UnaryServerInterceptor is deprecated?

@ConnorsApps
Copy link

Thanks for this!

Any idea how to do this now that otelgrpc.UnaryServerInterceptor is deprecated?

Looks like there isn't an alternative yet. See open-telemetry/opentelemetry-go-contrib#4575

@Jackhu-gc
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment