Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

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

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