When I tried to integrate the OpenTelemetry with this interceptor,
it will throw the following exception.
Traceback (most recent call last):
File "/home/appuser/.local/lib/python3.8/site-packages/grpc/_server.py", line 435, in _call_behavior
response_or_iterator = behavior(argument, context)
File "/home/appuser/.local/lib/python3.8/site-packages/opentelemetry/instrumentation/grpc/_server.py", line 273, in telemetry_interceptor
raise error
File "/home/appuser/.local/lib/python3.8/site-packages/opentelemetry/instrumentation/grpc/_server.py", line 264, in telemetry_interceptor
return behavior(request_or_iterator, context)
File "/home/appuser/.local/lib/python3.8/site-packages/py_grpc_prometheus/prometheus_server_interceptor.py", line 88, in new_behavior
self._compute_status_code(
File "/home/appuser/.local/lib/python3.8/site-packages/py_grpc_prometheus/prometheus_server_interceptor.py", line 122, in _compute_status_code
if servicer_context._state.client == "cancelled":
AttributeError: '_OpenTelemetryServicerContext' object has no attribute '_state'
I propose to have an environment variable or configuration in the interceptor to ignore all the exception raised in the interceptor.
Instead, those exceptions can either stream to the logger or mute it.
All in all, the interceptor should not fail the request when it has an issue with it.
Setting it via a configuration to be able to turn it off sounds like a good idea, would you mind send a PR? I think we are already doing so for another config.
When I tried to integrate the OpenTelemetry with this interceptor, it will throw the following exception.
I propose to have an environment variable or configuration in the interceptor to ignore all the exception raised in the interceptor. Instead, those exceptions can either stream to the logger or mute it. All in all, the interceptor should not fail the request when it has an issue with it.