feat(alerting): show execution errors in alert list
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ type AlertSeverityType string
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AlertStatePending AlertStateType = "pending"
|
AlertStatePending AlertStateType = "pending"
|
||||||
AlertStateExeuctionError AlertStateType = "exeuction_error"
|
AlertStateExeuctionError AlertStateType = "execution_error"
|
||||||
AlertStatePaused AlertStateType = "paused"
|
AlertStatePaused AlertStateType = "paused"
|
||||||
AlertStateCritical AlertStateType = "critical"
|
AlertStateCritical AlertStateType = "critical"
|
||||||
AlertStateWarning AlertStateType = "warning"
|
AlertStateWarning AlertStateType = "warning"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func NewResultHandler() *DefaultResultHandler {
|
|||||||
func (handler *DefaultResultHandler) Handle(ctx *EvalContext) {
|
func (handler *DefaultResultHandler) Handle(ctx *EvalContext) {
|
||||||
oldState := ctx.Rule.State
|
oldState := ctx.Rule.State
|
||||||
|
|
||||||
exeuctionError := " "
|
exeuctionError := ""
|
||||||
if ctx.Error != nil {
|
if ctx.Error != nil {
|
||||||
handler.log.Error("Alert Rule Result Error", "ruleId", ctx.Rule.Id, "error", ctx.Error)
|
handler.log.Error("Alert Rule Result Error", "ruleId", ctx.Rule.Id, "error", ctx.Error)
|
||||||
ctx.Rule.State = m.AlertStateExeuctionError
|
ctx.Rule.State = m.AlertStateExeuctionError
|
||||||
|
|||||||
@@ -61,28 +61,36 @@ function getStateDisplayModel(state) {
|
|||||||
iconClass: 'icon-gf icon-gf-critical',
|
iconClass: 'icon-gf icon-gf-critical',
|
||||||
stateClass: 'alert-state-critical'
|
stateClass: 'alert-state-critical'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'warning': {
|
case 'warning': {
|
||||||
return {
|
return {
|
||||||
text: 'WARNING',
|
text: 'WARNING',
|
||||||
iconClass: 'icon-gf icon-gf-warning',
|
iconClass: 'icon-gf icon-gf-warning',
|
||||||
stateClass: 'alert-state-warning'
|
stateClass: 'alert-state-warning'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'pending': {
|
case 'pending': {
|
||||||
return {
|
return {
|
||||||
text: 'PENDING',
|
text: 'PENDING',
|
||||||
iconClass: "fa fa-question",
|
iconClass: "fa fa-question",
|
||||||
stateClass: 'alert-state-warning'
|
stateClass: 'alert-state-warning'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'paused': {
|
case 'execution_error': {
|
||||||
|
return {
|
||||||
|
text: 'EXECUTION ERROR',
|
||||||
|
iconClass: 'icon-gf icon-gf-critical',
|
||||||
|
stateClass: 'alert-state-critical'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'paused': {
|
||||||
return {
|
return {
|
||||||
text: 'paused',
|
text: 'paused',
|
||||||
iconClass: "fa fa-pause",
|
iconClass: "fa fa-pause",
|
||||||
stateClass: 'alert-state-paused'
|
stateClass: 'alert-state-paused'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,6 @@
|
|||||||
<i class="icon-gf icon-gf-settings"></i>
|
<i class="icon-gf icon-gf-settings"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-item-notice" ng-show="alert.executionError">
|
|
||||||
<span>Execution Error</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-item-body">
|
<div class="card-item-body">
|
||||||
<div class="card-item-details">
|
<div class="card-item-details">
|
||||||
@@ -49,7 +46,9 @@
|
|||||||
<i class="{{alert.stateModel.iconClass}}"></i>
|
<i class="{{alert.stateModel.iconClass}}"></i>
|
||||||
{{alert.stateModel.text}}
|
{{alert.stateModel.text}}
|
||||||
</span> for {{alert.newStateDateAgo}}
|
</span> for {{alert.newStateDateAgo}}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="small muted" ng-show="alert.executionError">
|
||||||
|
{{alert.executionError}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user