Skip to content

Commit

Permalink
Merge branch 'main' of github.com:m-cmp/mc-observability
Browse files Browse the repository at this point in the history
  • Loading branch information
ish-hcc committed Oct 14, 2024
2 parents ca118b2 + 379069c commit 5c9c638
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TriggerAlertInfo {
@JsonProperty("target_name")
private String targetName;

@JsonProperty("metric")
@JsonProperty("measurement")
private String metric;

@JsonProperty("data")
Expand All @@ -49,7 +49,7 @@ public String getAlertMessage() {
appendIfNotNull(sb, "ID", this.targetId);
appendIfNotNull(sb, "Namespace ID", this.nsId);
appendIfNotNull(sb, "Target Name", this.targetName);
appendIfNotNull(sb, "Metric", this.metric);
appendIfNotNull(sb, "Measurement", this.metric);
appendIfNotNull(sb, "Level", this.level);
appendIfNotNull(sb, "Threshold", this.threshold);
appendIfNotNull(sb, "Occur Time", this.occurTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class TriggerHistoryInfo {
private String targetId;

@ApiModelProperty(value = "Trigger event target metric name")
@JsonProperty("metric")
@JsonProperty("measurement")
private String metric;

@ApiModelProperty(value = "Trigger event alarm details")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TriggerPolicyUpdateDto {
private String description;

@ApiModelProperty(value = "Trigger target metric", example = "cpu")
@JsonProperty("metric")
@JsonProperty("measurement")
private String metric;

@ApiModelProperty(value = "Trigger target metric field", example = "usage_idle")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package mcmp.mc.observability.mco11yagent.trigger.service;

import static mcmp.mc.observability.mco11yagent.trigger.enums.TaskStatus.*;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import mcmp.mc.observability.mco11yagent.trigger.enums.TaskStatus;
import mcmp.mc.observability.mco11yagent.trigger.exception.TriggerResultCodeException;
import mcmp.mc.observability.mco11yagent.monitoring.enums.ResultCode;
import mcmp.mc.observability.mco11yagent.trigger.client.KapacitorClient;
Expand Down Expand Up @@ -87,7 +90,7 @@ public boolean updateTask(TriggerPolicyInfo policyInfo, ManageTriggerTargetStora

updateTask(kapacitorUrl, kapacitorTaskId, updateTaskParam);

if(policyInfo.getStatus().equals("enabled")) {
if(policyInfo.getStatus().equals(ENABLED)) {
updateTask(kapacitorUrl, kapacitorTaskId, Collections.singletonMap("status", "disabled"));
updateTask(kapacitorUrl, kapacitorTaskId, Collections.singletonMap("status", "enabled"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void sendEmail(TriggerAlertInfo alertInfo) {
context.setVariable("targetId", alertInfo.getTargetId());
context.setVariable("nsId", alertInfo.getNsId());
context.setVariable("targetName", alertInfo.getTargetName());
context.setVariable("metric", alertInfo.getMetric());
context.setVariable("measurement", alertInfo.getMetric());
context.setVariable("level", alertInfo.getLevel());
context.setVariable("threshold", alertInfo.getThreshold());
context.setVariable("occurTime", alertInfo.getOccurTime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div style=" margin-top: 10px; text-align: center; align-content: center; justify-content: center">
<h3>M-CMP Trigger Event Alert</h3><br/>
[Alert :
<strong style="color:#006dff;font-weight: bold;" th:text="${metric}">metric</strong>
<strong style="color:#006dff;font-weight: bold;" th:text="${measurement}">measurement</strong>
alarm has been triggered in
<strong style="color:#006dff;font-weight: bold;" th:text="${policyName}">policyName</strong>
]
Expand All @@ -44,8 +44,8 @@ <h3>M-CMP Trigger Event Alert</h3><br/>
<td style="border-bottom:1px solid #e7e9ee;color:#142337;background-color:#fefbf7;padding:10px 15px" th:text="${targetName}"></td>
</tr>
<tr>
<th width="110" height="35" style="width:110px;height:35px;background-color:#fcf3e7;border-bottom:1px solid #e7e9ee;padding-left:15px;text-align:left;font-weight:normal;color:#142337">Metric</th>
<td style="border-bottom:1px solid #e7e9ee;color:#142337;background-color:#fefbf7;padding:10px 15px" th:text="${metric}"></td>
<th width="110" height="35" style="width:110px;height:35px;background-color:#fcf3e7;border-bottom:1px solid #e7e9ee;padding-left:15px;text-align:left;font-weight:normal;color:#142337">Measurement</th>
<td style="border-bottom:1px solid #e7e9ee;color:#142337;background-color:#fefbf7;padding:10px 15px" th:text="${measurement}"></td>
</tr>
<tr>
<th width="110" height="35" style="width:110px;height:35px;background-color:#fcf3e7;border-bottom:1px solid #e7e9ee;padding-left:15px;text-align:left;font-weight:normal;color:#142337">Level</th>
Expand Down

0 comments on commit 5c9c638

Please sign in to comment.