@@ -130,6 +130,20 @@ type Exporter struct {
130130	extstoreBytesFragmented   * prometheus.Desc 
131131	extstoreIOQueueDepth      * prometheus.Desc 
132132	acceptingConnections      * prometheus.Desc 
133+ 	proxyConnRequests         * prometheus.Desc 
134+ 	proxyConnErrors           * prometheus.Desc 
135+ 	proxyConnOOM              * prometheus.Desc 
136+ 	proxyReqActive            * prometheus.Desc 
137+ 	proxyConfigReloads        * prometheus.Desc 
138+ 	proxyConfigReloadFails    * prometheus.Desc 
139+ 	proxyConfigCronRuns       * prometheus.Desc 
140+ 	proxyConfigCronFails      * prometheus.Desc 
141+ 	proxyBackendTotal         * prometheus.Desc 
142+ 	proxyBackendMarkedBad     * prometheus.Desc 
143+ 	proxyBackendFailed        * prometheus.Desc 
144+ 	proxyRequestFailedDepth   * prometheus.Desc 
145+ 	roundRobinFallback        * prometheus.Desc 
146+ 	unexpectedNapiIDs         * prometheus.Desc 
133147}
134148
135149// New returns an initialized exporter. 
@@ -673,6 +687,76 @@ func New(server string, timeout time.Duration, logger *slog.Logger, tlsConfig *t
673687			nil ,
674688			nil ,
675689		),
690+ 		proxyConnRequests : prometheus .NewDesc (
691+ 			prometheus .BuildFQName (Namespace , "" , "proxy_conn_requests_total" ),
692+ 			"Total number of times the proxy opened a backend connection." ,
693+ 			nil , nil ,
694+ 		),
695+ 		proxyConnErrors : prometheus .NewDesc (
696+ 			prometheus .BuildFQName (Namespace , "" , "proxy_conn_errors_total" ),
697+ 			"Total number of backend connection errors in proxy mode." ,
698+ 			nil , nil ,
699+ 		),
700+ 		proxyConnOOM : prometheus .NewDesc (
701+ 			prometheus .BuildFQName (Namespace , "" , "proxy_conn_oom_total" ),
702+ 			"Total number of times the proxy ran out of memory allocating a connection." ,
703+ 			nil , nil ,
704+ 		),
705+ 		proxyReqActive : prometheus .NewDesc (
706+ 			prometheus .BuildFQName (Namespace , "" , "proxy_req_active" ),
707+ 			"Number of in-flight requests currently forwarded by the proxy." ,
708+ 			nil , nil ,
709+ 		),
710+ 		proxyConfigReloads : prometheus .NewDesc (
711+ 			prometheus .BuildFQName (Namespace , "" , "proxy_config_reloads_total" ),
712+ 			"Total attempts to reload the proxy configuration." ,
713+ 			nil , nil ,
714+ 		),
715+ 		proxyConfigReloadFails : prometheus .NewDesc (
716+ 			prometheus .BuildFQName (Namespace , "" , "proxy_config_reload_fails_total" ),
717+ 			"Total failed attempts to reload the proxy configuration." ,
718+ 			nil , nil ,
719+ 		),
720+ 		proxyConfigCronRuns : prometheus .NewDesc (
721+ 			prometheus .BuildFQName (Namespace , "" , "proxy_config_cron_runs_total" ),
722+ 			"Total times the proxy’s Lua cron hooks have run." ,
723+ 			nil , nil ,
724+ 		),
725+ 		proxyConfigCronFails : prometheus .NewDesc (
726+ 			prometheus .BuildFQName (Namespace , "" , "proxy_config_cron_fails_total" ),
727+ 			"Total errors from the proxy’s Lua cron hooks." ,
728+ 			nil , nil ,
729+ 		),
730+ 		proxyBackendTotal : prometheus .NewDesc (
731+ 			prometheus .BuildFQName (Namespace , "" , "proxy_backend_total" ),
732+ 			"Number of backend servers configured in proxy mode." ,
733+ 			nil , nil ,
734+ 		),
735+ 		proxyBackendMarkedBad : prometheus .NewDesc (
736+ 			prometheus .BuildFQName (Namespace , "" , "proxy_backend_marked_bad_total" ),
737+ 			"Total times a backend was marked unhealthy by the proxy." ,
738+ 			nil , nil ,
739+ 		),
740+ 		proxyBackendFailed : prometheus .NewDesc (
741+ 			prometheus .BuildFQName (Namespace , "" , "proxy_backend_failed" ),
742+ 			"Number of backends currently in a failed state." ,
743+ 			nil , nil ,
744+ 		),
745+ 		proxyRequestFailedDepth : prometheus .NewDesc (
746+ 			prometheus .BuildFQName (Namespace , "" , "proxy_request_failed_depth_total" ),
747+ 			"Total requests dropped due to backend depth limits." ,
748+ 			nil , nil ,
749+ 		),
750+ 		roundRobinFallback : prometheus .NewDesc (
751+ 			prometheus .BuildFQName (Namespace , "" , "round_robin_fallback_total" ),
752+ 			"Total times the proxy fell back to round-robin routing." ,
753+ 			nil , nil ,
754+ 		),
755+ 		unexpectedNapiIDs : prometheus .NewDesc (
756+ 			prometheus .BuildFQName (Namespace , "" , "unexpected_napi_ids_total" ),
757+ 			"Total unexpected internal event-loop IDs seen by the proxy." ,
758+ 			nil , nil ,
759+ 		),
676760	}
677761}
678762
@@ -769,6 +853,20 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
769853	ch  <-  e .extstoreBytesLimit 
770854	ch  <-  e .extstoreIOQueueDepth 
771855	ch  <-  e .acceptingConnections 
856+ 	ch  <-  e .proxyConnRequests 
857+ 	ch  <-  e .proxyConnErrors 
858+ 	ch  <-  e .proxyConnOOM 
859+ 	ch  <-  e .proxyReqActive 
860+ 	ch  <-  e .proxyConfigReloads 
861+ 	ch  <-  e .proxyConfigReloadFails 
862+ 	ch  <-  e .proxyConfigCronRuns 
863+ 	ch  <-  e .proxyConfigCronFails 
864+ 	ch  <-  e .proxyBackendTotal 
865+ 	ch  <-  e .proxyBackendMarkedBad 
866+ 	ch  <-  e .proxyBackendFailed 
867+ 	ch  <-  e .proxyRequestFailedDepth 
868+ 	ch  <-  e .roundRobinFallback 
869+ 	ch  <-  e .unexpectedNapiIDs 
772870}
773871
774872// Collect fetches the statistics from the configured memcached server, and 
@@ -901,6 +999,30 @@ func (e *Exporter) parseStats(ch chan<- prometheus.Metric, stats map[net.Addr]me
901999			}
9021000		}
9031001
1002+ 		// proxy stats are only included if memcached server is in proxy mode. Take the presence of the 
1003+ 		// proxy_backend_total key as a signal that they all should be there and do the parsing 
1004+ 		if  _ , ok  :=  s ["proxy_backend_total" ]; ok  {
1005+ 			err  =  firstError (
1006+ 				e .parseAndNewMetric (ch , e .proxyConnRequests , prometheus .CounterValue , s , "proxy_conn_requests" ),
1007+ 				e .parseAndNewMetric (ch , e .proxyConnErrors , prometheus .CounterValue , s , "proxy_conn_errors" ),
1008+ 				e .parseAndNewMetric (ch , e .proxyConnOOM , prometheus .CounterValue , s , "proxy_conn_oom" ),
1009+ 				e .parseAndNewMetric (ch , e .proxyReqActive , prometheus .GaugeValue , s , "proxy_req_active" ),
1010+ 				e .parseAndNewMetric (ch , e .proxyConfigReloads , prometheus .CounterValue , s , "proxy_config_reloads" ),
1011+ 				e .parseAndNewMetric (ch , e .proxyConfigReloadFails , prometheus .CounterValue , s , "proxy_config_reload_fails" ),
1012+ 				e .parseAndNewMetric (ch , e .proxyConfigCronRuns , prometheus .CounterValue , s , "proxy_config_cron_runs" ),
1013+ 				e .parseAndNewMetric (ch , e .proxyConfigCronFails , prometheus .CounterValue , s , "proxy_config_cron_fails" ),
1014+ 				e .parseAndNewMetric (ch , e .proxyBackendTotal , prometheus .GaugeValue , s , "proxy_backend_total" ),
1015+ 				e .parseAndNewMetric (ch , e .proxyBackendMarkedBad , prometheus .CounterValue , s , "proxy_backend_marked_bad" ),
1016+ 				e .parseAndNewMetric (ch , e .proxyBackendFailed , prometheus .GaugeValue , s , "proxy_backend_failed" ),
1017+ 				e .parseAndNewMetric (ch , e .proxyRequestFailedDepth , prometheus .CounterValue , s , "proxy_request_failed_depth" ),
1018+ 				e .parseAndNewMetric (ch , e .roundRobinFallback , prometheus .CounterValue , s , "round_robin_fallback" ),
1019+ 				e .parseAndNewMetric (ch , e .unexpectedNapiIDs , prometheus .CounterValue , s , "unexpected_napi_ids" ),
1020+ 			)
1021+ 			if  err  !=  nil  {
1022+ 				parseError  =  err 
1023+ 			}
1024+ 		}
1025+ 
9041026		err  =  firstError (
9051027			e .parseTimevalAndNewMetric (ch , e .rusageUser , prometheus .CounterValue , s , "rusage_user" ),
9061028			e .parseTimevalAndNewMetric (ch , e .rusageSystem , prometheus .CounterValue , s , "rusage_system" ),
0 commit comments