mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-09-17 18:00:28 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b442276ca2 |
+5
@@ -99,6 +99,11 @@ public class MetricsDataController {
|
||||
String app = names[0];
|
||||
String metrics = names[1];
|
||||
String metric = names[2];
|
||||
// Validate metrics against a whitelist
|
||||
List<String> allowedMetrics = List.of("cpu", "memory", "disk", "network"); // Example whitelist
|
||||
if (!allowedMetrics.contains(metrics)) {
|
||||
throw new IllegalArgumentException("metrics name: " + metrics + " is not allowed.");
|
||||
}
|
||||
MetricsHistoryData historyData = metricsDataService.getMetricHistoryData(monitorId, app, metrics, metric, label, history, interval);
|
||||
return ResponseEntity.ok(Message.success(historyData));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user