Description
Description
otelgrpc.WithSpanOption
is not considered when using a otelgrpc
stats handler.
Environment
- OS: any
- Architecture: any
- Go Version: any
otelgrpc
version: v0.60.0
Steps To Reproduce
using this code does nothing:
grpcServer := grpc.NewServer(
grpc.StatsHandler(otelgrpc.NewServerHandler(
otelgrpc.WithSpanOptions(trace.WithNewRoot()),
)),
)
because the option that is being set is never used.
Expected behavior
The Option should either be deprecated along with the interceptors or implemented.
I do think otelgrpc.WithSpanOptions
is quite dangerous and using it requires one to understand the workings of the stats handler and might override things like the span kind and other things otherwise set by the stats handler. So it might be a good idea to also deprecate it and rather add more options that cover other use-cases. On the otelhttp
package there is an Option PublicEndpoint
which provides the WithNewRoot()
option, and maybe we rather want something like that here as well? I would also suggest to set a link to the incoming trace context like it is suggested in the documentation and also present in the otelhttp
implementation.