fix(notification/rule): pagerduty helper functions need key ar… (#15047)
fix(notification/rule): pagerduty helper functions need key argspull/15048/head
commit
55e124735c
|
@ -113,16 +113,6 @@ func Call(fn ast.Expression, args *ast.ObjectExpression) *ast.CallExpression {
|
|||
}
|
||||
}
|
||||
|
||||
// DirectCall returns a *ast.CallExpression that is a function call of fn with args.
|
||||
func DirectCall(fn ast.Expression, args ast.Expression) *ast.CallExpression {
|
||||
return &ast.CallExpression{
|
||||
Callee: fn,
|
||||
Arguments: []ast.Expression{
|
||||
args,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ExpressionStatement returns an *ast.ExpressionStagement of e.
|
||||
func ExpressionStatement(e ast.Expression) *ast.ExpressionStatement {
|
||||
return &ast.ExpressionStatement{Expression: e}
|
||||
|
|
|
@ -150,7 +150,7 @@ func (s *PagerDuty) generateFluxASTNotifyPipe(url string) ast.Statement {
|
|||
// required
|
||||
// string
|
||||
// The unique location of the affected system, preferably a hostname or FQDN
|
||||
endpointProps = append(endpointProps, flux.Property("source", flux.Member("r", "_notification_rule_name")))
|
||||
endpointProps = append(endpointProps, flux.Property("source", flux.Member("notification", "_notification_rule_name")))
|
||||
|
||||
// summary:
|
||||
// required
|
||||
|
@ -177,16 +177,20 @@ func (s *PagerDuty) generateFluxASTNotifyPipe(url string) ast.Statement {
|
|||
}
|
||||
|
||||
func severityFromLevel() *ast.CallExpression {
|
||||
return flux.DirectCall(
|
||||
return flux.Call(
|
||||
flux.Member("pagerduty", "severityFromLevel"),
|
||||
flux.Member("r", "_level"),
|
||||
flux.Object(
|
||||
flux.Property("level", flux.Member("r", "_level")),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
func actionFromLevel() *ast.CallExpression {
|
||||
return flux.DirectCall(
|
||||
return flux.Call(
|
||||
flux.Member("pagerduty", "actionFromLevel"),
|
||||
flux.Member("r", "_level"),
|
||||
flux.Object(
|
||||
flux.Property("level", flux.Member("r", "_level")),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ statuses
|
|||
clientURL: "http://localhost:7777",
|
||||
class: r._check_name,
|
||||
group: r._source_measurement,
|
||||
severity: pagerduty.severityFromLevel(r._level),
|
||||
eventAction: pagerduty.actionFromLevel(r._level),
|
||||
source: r._notification_rule_name,
|
||||
severity: pagerduty.severityFromLevel(level: r._level),
|
||||
eventAction: pagerduty.actionFromLevel(level: r._level),
|
||||
source: notification._notification_rule_name,
|
||||
summary: r._message,
|
||||
timestamp: time(v: r._source_timestamp),
|
||||
})))`
|
||||
|
|
Loading…
Reference in New Issue