Skip to content

feat(metric): add interceptors to monitor gRPC using Prometheus#5884

Closed
halibobo1205 wants to merge 1 commit intotronprotocol:developfrom
halibobo1205:feat/metric_http_grpc
Closed

feat(metric): add interceptors to monitor gRPC using Prometheus#5884
halibobo1205 wants to merge 1 commit intotronprotocol:developfrom
halibobo1205:feat/metric_http_grpc

Conversation

@halibobo1205
Copy link
Contributor

@halibobo1205 halibobo1205 commented Jun 25, 2024

What does this PR do?
Add interceptors to monitor gRPC services using Prometheus, inspired by https://github.com/grpc-ecosystem/java-grpc-prometheus
Why are these changes required?
1. Decoupled from the ApiAccessInterceptor.
2. Fix the response latency monitor of RPCs handled by the server, the startCall is asynchronous, so the latency is not recorded correctly.

    Histogram.Timer requestTimer = Metrics.histogramStartTimer(
          MetricKeys.Histogram.GRPC_SERVICE_LATENCY, endpoint);
      Listener<ReqT> res = next.startCall(call, headers); //  Starts asynchronous processing of an incoming call.
      Metrics.histogramObserve(requestTimer);
      return res;

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@halibobo1205
Copy link
Contributor Author

close with #6097.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants