[#20] metrics: Add grpc msg send metrics
All checks were successful
DCO action / DCO (pull_request) Successful in 28s
Tests and linters / Tests (pull_request) Successful in 36s
Tests and linters / Tests with -race (pull_request) Successful in 1m2s
Tests and linters / Lint (pull_request) Successful in 1m33s
Tests and linters / Staticcheck (pull_request) Successful in 1m40s

Streaming RPC has two main metrics: send message and receive message.
But the first one was missed.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-02-12 14:17:18 +03:00
parent ec6f880337
commit d34e1329c8
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0

View file

@ -15,6 +15,9 @@ var clientMetrics = grpcprom.NewClientMetrics(
grpcprom.WithClientStreamRecvHistogram(
grpcprom.WithHistogramBuckets(prometheus.DefBuckets),
),
grpcprom.WithClientStreamSendHistogram(
grpcprom.WithHistogramBuckets(prometheus.DefBuckets),
),
)
func init() {
@ -57,6 +60,12 @@ func init() {
Help: "Histogram of response latency (seconds) of the gRPC single message receive.",
VariableLabels: []string{"grpc_type", "grpc_service", "grpc_method"},
},
{
Name: "grpc_client_msg_send_handling_seconds",
Type: dto.MetricType_HISTOGRAM.String(),
Help: "Histogram of response latency (seconds) of the gRPC single message send.",
VariableLabels: []string{"grpc_type", "grpc_service", "grpc_method"},
},
}
metrics.MustRegister(clientMetrics, descs...)
}