opentelemetry-js
opentelemetry-js copied to clipboard
ignoreMethods doesn't work
Please answer these questions before submitting a bug report.
What version of OpenTelemetry are you using?
0.17.0
What version of Node are you using?
14.x
Please provide the code you used to setup the OpenTelemetry SDK
registerInstrumentations({
instrumentations: [
{
plugins: {
'@grpc/grpc-js': {
enabled: true,
path: '@opentelemetry/plugin-grpc-js',
ignoreMethods: ['/grpc.health.v1.Health/Check'],
}
},
},
]
})
What did you do?
If possible, provide a recipe for reproducing the error.
What did you expect to see?
ignoreMethods should be respected.
What did you see instead?
NOTE: It is possible to set ignoreGrpcMethods (ie use @ts-ignore and use ['Check']), but current implementation to ignore methods is limited (please see Additional context).
ignoreMethods is ignored, because ignoreGrpcMethods is used inside the code everywhere.
It looks that config.ignoreGrpcMethods reference should be replaced with config.ignoreMethods.
Additional context
Current implementation respects only last segment of a path and it means it is not possible to ignore methods using fully qualified path ie /grpc.health.v1.Health/Check.
It would be nice if shouldNotTraceServerCall-method supports that case:
function shouldNotTraceServerCall(
metadata: grpcJs.Metadata,
methodName: string,
ignoreGrpcMethods?: IgnoreMatcher[]
): boolean {
return methodIsIgnored(
methodName,
ignoreGrpcMethods
);
}