File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -102,12 +102,27 @@ private function isPrometheusEnabled(): bool
102
102
return config ('prometheus.enabled ' );
103
103
}
104
104
105
+ private function apcuNgAdapterIsUsed (): bool
106
+ {
107
+ return isset ($ this ->config ['apcu-ng ' ]);
108
+ }
109
+
105
110
public function update (string $ name , $ value , array $ labelValues = []): void
106
111
{
107
112
if (!$ this ->isPrometheusEnabled ()) {
108
113
return ;
109
114
}
110
115
116
+ if ($ this ->apcuNgAdapterIsUsed ()) {
117
+ $ labelValues = array_map (function ($ labelValue ) {
118
+ if (!is_string ($ labelValue )) {
119
+ $ labelValue = json_encode ($ labelValue );
120
+ }
121
+
122
+ return $ labelValue ;
123
+ }, $ labelValues );
124
+ }
125
+
111
126
$ metric = $ this ->metrics [$ name ] ?? null ;
112
127
$ metric ?->update($ value , $ labelValues );
113
128
}
You can’t perform that action at this time.
0 commit comments