lchenn / py-grpc-prometheus

Python gRPC Prometheus
Apache License 2.0
48 stars 25 forks source link

Repeated Status Code Name Extraction #14

Closed RyanSiu1995 closed 3 years ago

RyanSiu1995 commented 3 years ago

When the exception raise, it will return this error.

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/py_grpc_prometheus/prometheus_server_interceptor.py", line 95, in new_behavior
    self._compute_error_code(e).name)
AttributeError: "str" object has no attribute "name"

This is because _compute_error_code is returning a string instead of StatusCode enum.