@@ -124,9 +124,9 @@ public function getNodesMetrics(DateTimeInterface $startDataTime, string ...$met
124
124
foreach ($ metricCategories as $ category ) {
125
125
$ rs = $ this ->db ->YieldAll (
126
126
(new Select ())
127
- ->columns (['node.id ' , 'node.name ' , 'node_metric.timestamp ' , 'node_metric.value ' ])
127
+ ->columns (['node.uuid ' , 'node.name ' , 'node_metric.timestamp ' , 'node_metric.value ' ])
128
128
->from ('prometheus_node_metric AS node_metric ' )
129
- ->join ('node ' , 'node_metric.node_id = node.id ' )
129
+ ->join ('node ' , 'node_metric.node_uuid = node.uuid ' )
130
130
->where (
131
131
'node_metric.category = ? AND node_metric.timestamp > ? ' ,
132
132
$ category ,
@@ -160,9 +160,9 @@ public function getNodeMetrics(DateTimeInterface $startDataTime, string $nodeId,
160
160
(new Select ())
161
161
->columns (['node_metric.timestamp ' , 'node_metric.value ' ])
162
162
->from ('prometheus_node_metric AS node_metric ' )
163
- ->join ('node ' , 'node_metric.node_id = node.id ' )
163
+ ->join ('node ' , 'node_metric.node_uuid = node.uuid ' )
164
164
->where (
165
- 'node_id = ? AND node_metric.category = ? AND node_metric.timestamp > ? ' ,
165
+ 'node_uuid = ? AND node_metric.category = ? AND node_metric.timestamp > ? ' ,
166
166
$ nodeId ,
167
167
$ category ,
168
168
$ startDataTime ->getTimestamp () * 1000
@@ -194,17 +194,17 @@ public function getNodeMetricsCurrent(string $nodeId, string ...$metricCategorie
194
194
(new Select ())
195
195
->columns (['node_metric.value ' ])
196
196
->from ('prometheus_node_metric AS node_metric ' )
197
- ->join ('node ' , 'node_metric.node_id = node.id ' )
197
+ ->join ('node ' , 'node_metric.node_uuid = node.uuid ' )
198
198
->join (
199
199
[
200
200
'latest_metrics ' => (new Select ())
201
201
->columns (['MAX(timestamp) AS latest_timestamp ' ])
202
202
->from ('prometheus_node_metric ' )
203
- ->where ('node_id = ? AND category = ? ' , $ nodeId , $ category )
203
+ ->where ('node_uuid = ? AND category = ? ' , $ nodeId , $ category )
204
204
],
205
205
'node_metric.timestamp = latest_metrics.latest_timestamp '
206
206
)
207
- ->where ('node_id = ? AND node_metric.category = ? ' , $ nodeId , $ category ),
207
+ ->where ('node_uuid = ? AND node_metric.category = ? ' , $ nodeId , $ category ),
208
208
PDO ::FETCH_ASSOC
209
209
);
210
210
@@ -223,18 +223,18 @@ public function getPodsMetricsCurrent(string ...$metricCategories): array
223
223
foreach ($ metricCategories as $ category ) {
224
224
$ rs = $ this ->db ->YieldAll (
225
225
(new Select ())
226
- ->columns (['pod.id ' , 'pod.name ' , 'pod_metric.value ' ])
226
+ ->columns (['pod.uuid ' , 'pod.name ' , 'pod_metric.value ' ])
227
227
->from ('prometheus_pod_metric AS pod_metric ' )
228
- ->join ('pod ' , 'pod_metric.pod_id = pod.id ' )
228
+ ->join ('pod ' , 'pod_metric.pod_uuid = pod.uuid ' )
229
229
->join (
230
230
[
231
231
'latest_metrics ' => (new Select ())
232
- ->columns (['pod_id ' , 'MAX(timestamp) AS latest_timestamp ' ])
232
+ ->columns (['pod_uuid ' , 'MAX(timestamp) AS latest_timestamp ' ])
233
233
->from ('prometheus_pod_metric ' )
234
234
->where ('category = ? ' , $ category )
235
- ->groupBy ('pod_id ' )
235
+ ->groupBy ('pod_uuid ' )
236
236
],
237
- 'pod_metric.pod_id = latest_metrics.pod_id '
237
+ 'pod_metric.pod_uuid = latest_metrics.pod_uuid '
238
238
. ' AND pod_metric.timestamp = latest_metrics.latest_timestamp '
239
239
)
240
240
->where ('pod_metric.category = ? ' , $ category ),
@@ -260,17 +260,17 @@ public function getPodMetricsCurrent(string $podId, string ...$metricCategories)
260
260
(new Select ())
261
261
->columns (['pod_metric.value ' ])
262
262
->from ('prometheus_pod_metric AS pod_metric ' )
263
- ->join ('pod ' , 'pod_metric.pod_id = pod.id ' )
263
+ ->join ('pod ' , 'pod_metric.pod_uuid = pod.uuid ' )
264
264
->join (
265
265
[
266
266
'latest_metrics ' => (new Select ())
267
267
->columns (['MAX(timestamp) AS latest_timestamp ' ])
268
268
->from ('prometheus_pod_metric ' )
269
- ->where ('pod_id = ? AND category = ? ' , $ podId , $ category )
269
+ ->where ('pod_uuid = ? AND category = ? ' , $ podId , $ category )
270
270
],
271
271
'pod_metric.timestamp = latest_metrics.latest_timestamp '
272
272
)
273
- ->where ('pod_id = ? AND pod_metric.category = ? ' , $ podId , $ category ),
273
+ ->where ('pod_uuid = ? AND pod_metric.category = ? ' , $ podId , $ category ),
274
274
PDO ::FETCH_ASSOC
275
275
);
276
276
@@ -289,9 +289,9 @@ public function getPodsMetrics(DateTimeInterface $startDateTime, string ...$metr
289
289
foreach ($ metricCategories as $ category ) {
290
290
$ rs = $ this ->db ->YieldAll (
291
291
(new Select ())
292
- ->columns (['pod.id ' , 'pod.name ' , 'pod_metric.timestamp ' , 'pod_metric.value ' ])
292
+ ->columns (['pod.uuid ' , 'pod.name ' , 'pod_metric.timestamp ' , 'pod_metric.value ' ])
293
293
->from ('prometheus_pod_metric AS pod_metric ' )
294
- ->join ('pod ' , 'pod_metric.pod_id = pod.id ' )
294
+ ->join ('pod ' , 'pod_metric.pod_uuid = pod.uuid ' )
295
295
->where (
296
296
'pod_metric.category = ? AND pod_metric.timestamp > ? ' ,
297
297
$ category ,
@@ -329,9 +329,9 @@ public function getPodMetrics(DateTimeInterface $startDateTime, string $podId, s
329
329
(new Select ())
330
330
->columns (['pod_metric.timestamp ' , 'pod_metric.value ' ])
331
331
->from ('prometheus_pod_metric AS pod_metric ' )
332
- ->join ('pod ' , 'pod_metric.pod_id = pod.id ' )
332
+ ->join ('pod ' , 'pod_metric.pod_uuid = pod.uuid ' )
333
333
->where (
334
- 'pod.id = ? AND pod_metric.category = ? AND pod_metric.timestamp > ? ' ,
334
+ 'pod.uuid = ? AND pod_metric.category = ? AND pod_metric.timestamp > ? ' ,
335
335
$ podId ,
336
336
$ category ,
337
337
$ startDateTime ->getTimestamp () * 1000
0 commit comments