You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @dinowernli and other creators.
I want to add custom label "errorCode" to my metric. Is it even possible?
I have such Configuration of GrpcMonitoringInterceptor:
@GRpcGlobalInterceptor
public class GrpcMonitoringInterceptor implements ServerInterceptor {
private final MonitoringServerInterceptor interceptor;
public GrpcMonitoringInterceptor(CollectorRegistry collectorRegistry) {
Configuration configuration = Configuration
.cheapMetricsOnly().withCollectorRegistry(collectorRegistry);
interceptor = MonitoringServerInterceptor.create(configuration);
}
@Override
public <ReqT, RespT> Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers,
ServerCallHandler<ReqT, RespT> next) {
return interceptor.interceptCall(call, headers, next);
}
}
I have such grpc_server_handled_total metric:
expr: |
((sum by (job, namespace, grpc_method) ((grpc_server_handled_total{job=~"wallet.*",code!="OK"}) - (grpc_server_handled_total{job=~"wallet.*",code!="OK"} offset 5m))) / sum by (job, namespace, grpc_method) ((grpc_server_handled_total{job=~"wallet.*"}) - (grpc_server_handled_total{job=~"wallet.*"} offset 5m)) * 100) > 10 and (sum by (job, namespace, grpc_method) ((grpc_server_handled_total{job=~"wallet.*"}) - (grpc_server_handled_total{job=~"wallet.*"} offset 5m)) > 20)
I want to change the metric to this:
((sum by (job, namespace, grpc_method) ((grpc_server_handled_total{job=~"wallet.*",code!="OK",errorCode!="IP_BLOCKED"}) - (grpc_server_handled_total{job=~"wallet.*",code!="OK",errorCode!="IP_BLOCKED"} offset 5m))) / sum by (job, namespace, grpc_method) ((grpc_server_handled_total{job=~"wallet.*"}) - (grpc_server_handled_total{job=~"wallet.*"} offset 5m)) * 100) > 10 and (sum by (job, namespace, grpc_method) ((grpc_server_handled_total{job=~"wallet.*"}) - (grpc_server_handled_total{job=~"wallet.*"} offset 5m)) > 20)
I tried to make some changes with collectorRegistry when intercepotr is creating, but it doesn't work.
public GrpcMonitoringInterceptor(CollectorRegistry collectorRegistry) {
Counter tmp = Counter.build()
.namespace("grpc")
.subsystem("server")
.name("handled_total")
.labelNames("grpc_type", "grpc_service", "grpc_method", "code", "errorCode")
.help("Total number of RPCs completed on the server, regardless of success or failure.").register();
collectorRegistry.register(tmp);
public GrpcMonitoringInterceptor(CollectorRegistry collectorRegistry) {
Counter tmp = Counter.build()
.namespace("grpc")
.subsystem("server")
.name("handled_total")
.labelNames("grpc_type", "grpc_service", "grpc_method", "code", "errorCode")
.help("Total number of RPCs completed on the server, regardless of success or failure.").register();
collectorRegistry.register(tmp);
Configuration configuration = Configuration
.cheapMetricsOnly().withCollectorRegistry(collectorRegistry);
interceptor = MonitoringServerInterceptor.create(configuration);
}
Configuration configuration = Configuration
.cheapMetricsOnly().withCollectorRegistry(collectorRegistry);
interceptor = MonitoringServerInterceptor.create(configuration);
}
The text was updated successfully, but these errors were encountered:
Hi @dinowernli and other creators.
I want to add custom label "errorCode" to my metric. Is it even possible?
I have such Configuration of GrpcMonitoringInterceptor:
I have such grpc_server_handled_total metric:
I want to change the metric to this:
I tried to make some changes with collectorRegistry when intercepotr is creating, but it doesn't work.
The text was updated successfully, but these errors were encountered: