mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-09-17 09:40:58 +00:00
Compare commits
3
Commits
9dbe018119
...
fix-memory
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
696432b59c | ||
|
|
299f41b769 | ||
|
|
0776480256 |
+1
@@ -63,6 +63,7 @@ public class GroupAlert {
|
||||
private Long id;
|
||||
|
||||
@Schema(title = "Group Key", example = "HighCPUUsage{alertname=\"HighCPUUsage\", instance=\"server1\"}")
|
||||
@Column(length = 2048)
|
||||
private String groupKey;
|
||||
|
||||
@Schema(title = "Status", example = "resolved")
|
||||
|
||||
+4
-2
@@ -59,8 +59,9 @@ public class SingleAlert {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Schema(title = "Threshold Id", example = "87584674384", accessMode = READ_ONLY)
|
||||
private Long id;
|
||||
|
||||
@Schema(title = "Fingerprint", example = "dxsdfdsf")
|
||||
|
||||
@Schema(title = "Fingerprint", example = "alertname:demo")
|
||||
@Column(length = 2048)
|
||||
private String fingerprint;
|
||||
|
||||
@Schema(title = "Labels", example = "{\"alertname\": \"HighCPUUsage\", \"priority\": \"critical\", \"instance\": \"343483943\"}")
|
||||
@@ -74,6 +75,7 @@ public class SingleAlert {
|
||||
private Map<String, String> annotations;
|
||||
|
||||
@Schema(title = "Content", example = "CPU usage is above 80% for the last 5 minutes on instance server1.example.com.")
|
||||
@Column(length = 4096)
|
||||
private String content;
|
||||
|
||||
@Schema(title = "Status", example = "firing|resolved")
|
||||
|
||||
+7
-4
@@ -73,10 +73,13 @@ public class DataStorageDispatch {
|
||||
if (metricsData == null) {
|
||||
continue;
|
||||
}
|
||||
calculateMonitorStatus(metricsData);
|
||||
historyDataWriter.ifPresent(dataWriter -> dataWriter.saveData(metricsData));
|
||||
pluginRunner.pluginExecute(PostCollectPlugin.class, ((postCollectPlugin, pluginContext) -> postCollectPlugin.execute(metricsData, pluginContext)));
|
||||
realTimeDataWriter.saveData(metricsData);
|
||||
try {
|
||||
calculateMonitorStatus(metricsData);
|
||||
historyDataWriter.ifPresent(dataWriter -> dataWriter.saveData(metricsData));
|
||||
pluginRunner.pluginExecute(PostCollectPlugin.class, ((postCollectPlugin, pluginContext) -> postCollectPlugin.execute(metricsData, pluginContext)));
|
||||
} finally {
|
||||
realTimeDataWriter.saveData(metricsData);
|
||||
}
|
||||
} catch (InterruptedException interruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (Exception e) {
|
||||
|
||||
+1
@@ -70,6 +70,7 @@ public class MemoryDataStorage extends AbstractRealTimeDataStorage {
|
||||
Long monitorId = metricsData.getId();
|
||||
String metrics = metricsData.getMetrics();
|
||||
if (metricsData.getCode() != CollectRep.Code.SUCCESS) {
|
||||
metricsData.close();
|
||||
return;
|
||||
}
|
||||
Map<String, CollectRep.MetricsData> metricsDataMap =
|
||||
|
||||
+1
@@ -63,6 +63,7 @@ public class RedisDataStorage extends AbstractRealTimeDataStorage {
|
||||
String hashKey = metricsData.getMetrics();
|
||||
if (metricsData.getCode() == CollectRep.Code.SUCCESS) {
|
||||
redisCommandDelegate.operate().hset(key, hashKey, metricsData, future -> future.thenAccept(response -> {
|
||||
metricsData.close();
|
||||
if (response) {
|
||||
log.debug("[warehouse] redis add new data {}:{}.", key, hashKey);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user