Skip to content

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 <diabloneo@gmail.com>
@diabloneo diabloneo marked this pull request as ready for review February 13, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant