Skip to content

feat: make endpoint report the upstream status code #5510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add _status to alerta endpoint() return
btasker committed Nov 26, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
btasker Ben Tasker
commit 0c61c78f45c43610d40b7b55ef32ccc0120a12d5
41 changes: 19 additions & 22 deletions stdlib/contrib/bonitoo-io/alerta/alerta.flux
Original file line number Diff line number Diff line change
@@ -195,28 +195,25 @@ endpoint = (url, apiKey, environment="", origin="") =>
|> map(
fn: (r) => {
obj = mapFn(r: r)
resp =
alert(
url: url,
apiKey: apiKey,
resource: obj.resource,
event: obj.event,
environment: environment,
severity: obj.severity,
service: obj.service,
group: obj.group,
value: obj.value,
text: obj.text,
tags: obj.tags,
attributes: obj.attributes,
origin: origin,
type: obj.type,
timestamp: obj.timestamp,
)

return {r with _sent:
string(
v:
2 == alert(
url: url,
apiKey: apiKey,
resource: obj.resource,
event: obj.event,
environment: environment,
severity: obj.severity,
service: obj.service,
group: obj.group,
value: obj.value,
text: obj.text,
tags: obj.tags,
attributes: obj.attributes,
origin: origin,
type: obj.type,
timestamp: obj.timestamp,
) / 100,
),
}
return {r with _status: string(v: resp), _sent: string(v: 2 == resp / 100)}
},
)