mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-09-17 18:10:28 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3bc2ee436 | ||
|
|
a84ff2f791 | ||
|
|
e9503d9743 |
+6
@@ -378,6 +378,12 @@ public class VictoriaMetricsClusterDataStorage extends AbstractHistoryDataStorag
|
||||
if (CommonConstants.PROMETHEUS.equals(app)) {
|
||||
labelName = metrics;
|
||||
}
|
||||
// Validate the metrics input against a predefined whitelist
|
||||
List<String> allowedMetrics = List.of("cpu", "memory", "disk", "network"); // Example whitelist
|
||||
if (!allowedMetrics.contains(metrics)) {
|
||||
throw new IllegalArgumentException("Invalid metrics value: " + metrics);
|
||||
}
|
||||
|
||||
String timeSeriesSelector = Stream.of(
|
||||
LABEL_KEY_NAME + "=\"" + labelName + "\"",
|
||||
LABEL_KEY_INSTANCE + "=\"" + monitorId + "\"",
|
||||
|
||||
Reference in New Issue
Block a user