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

prometheus: Add ip labels to server metrics #730

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

diabloneo
Copy link

Add two labels grpc_server_ip and grpc_client_ip to the server metrics when option WithServerIPLabelsEnabled() is set. These labels are not added by default for compatibility.

This pr proposes an implementation for issue #644

Changes

  • Add WithServerIPLabelsEnabled() option for ServerMetrics
  • Add labels grpc_server_ip and grpc_client_ip to server metrics when the option is turned on. The IPs are extracted from peer context.

Verification

The metric scraped into Prometheus likes:

grpc_server_handled_total{component="controller",grpc_client_ip="10.16.18.58",grpc_code="OK",grpc_method="StreamResourceGroup",grpc_server_ip="10.16.18.58",grpc_service="controller.Controller",grpc_type="server_stream",instance="10.16.18.58:6013",job="app-internal-metrics"}

Add two labels grpc_server_ip and grpc_client_ip to the server metrics
when option WithServerIPLabelsEnabled() is set. These labels are not
added by default for compatibility.

Signed-off-by: diabloneo <[email protected]>
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.

1 participant