File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
pkg/apiserver/controllers/v1 Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,13 @@ func PrometheusMachinesMiddleware() gin.HandlerFunc {
3030 return func (c * gin.Context ) {
3131 machineID , _ := getMachineIDFromContext (c )
3232 if machineID != "" {
33+ fullPath := c .FullPath ()
34+ if fullPath == "" {
35+ fullPath = "invalid-endpoint"
36+ }
3337 metrics .LapiMachineHits .With (prometheus.Labels {
3438 "machine" : machineID ,
35- "route" : c . FullPath () ,
39+ "route" : fullPath ,
3640 "method" : c .Request .Method ,
3741 }).Inc ()
3842 }
@@ -45,9 +49,13 @@ func PrometheusBouncersMiddleware() gin.HandlerFunc {
4549 return func (c * gin.Context ) {
4650 bouncer , _ := getBouncerFromContext (c )
4751 if bouncer != nil {
52+ fullPath := c .FullPath ()
53+ if fullPath == "" {
54+ fullPath = "invalid-endpoint"
55+ }
4856 metrics .LapiBouncerHits .With (prometheus.Labels {
4957 "bouncer" : bouncer .Name ,
50- "route" : c . FullPath () ,
58+ "route" : fullPath ,
5159 "method" : c .Request .Method ,
5260 }).Inc ()
5361 }
@@ -60,8 +68,13 @@ func PrometheusMiddleware() gin.HandlerFunc {
6068 return func (c * gin.Context ) {
6169 startTime := time .Now ()
6270
71+ fullPath := c .FullPath ()
72+ if fullPath == "" {
73+ fullPath = "invalid-endpoint"
74+ }
75+
6376 metrics .LapiRouteHits .With (prometheus.Labels {
64- "route" : c . FullPath () ,
77+ "route" : fullPath ,
6578 "method" : c .Request .Method ,
6679 }).Inc ()
6780 c .Next ()
You can’t perform that action at this time.
0 commit comments