This repository was archived by the owner on Jan 21, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -73,14 +73,14 @@ func newCollector() *metricCollector {
7373 Name : "rr_grpc_call_total" ,
7474 Help : "Total number of handled grpc requests after server restart." ,
7575 },
76- []string {"code" },
76+ []string {"code" , "method" },
7777 ),
7878 callDuration : prometheus .NewHistogramVec (
7979 prometheus.HistogramOpts {
8080 Name : "rr_grpc_call_duration_seconds" ,
8181 Help : "GRPC call duration." ,
8282 },
83- []string {"code" },
83+ []string {"code" , "method" },
8484 ),
8585 workersMemory : prometheus .NewGauge (
8686 prometheus.GaugeOpts {
@@ -103,8 +103,12 @@ func (c *metricCollector) listener(event int, ctx interface{}) {
103103 code = st .Code ().String ()
104104 }
105105
106- c .callDuration .With (prometheus.Labels {"code" : code }).Observe (uc .Elapsed ().Seconds ())
107- c .callCounter .With (prometheus.Labels {"code" : code }).Inc ()
106+ method := "Unknown"
107+ if uc .Info != nil {
108+ method = uc .Info .FullMethod
109+ }
110+ c .callDuration .With (prometheus.Labels {"code" : code , "method" : method }).Observe (uc .Elapsed ().Seconds ())
111+ c .callCounter .With (prometheus.Labels {"code" : code , "method" : method }).Inc ()
108112 }
109113}
110114
You can’t perform that action at this time.
0 commit comments