Skip to content

Commit 0c61c78

Browse files
committedNov 26, 2024
feat: add _status to alerta endpoint() return
1 parent a315021 commit 0c61c78

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed
 

‎stdlib/contrib/bonitoo-io/alerta/alerta.flux

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -195,28 +195,25 @@ endpoint = (url, apiKey, environment="", origin="") =>
195195
|> map(
196196
fn: (r) => {
197197
obj = mapFn(r: r)
198+
resp =
199+
alert(
200+
url: url,
201+
apiKey: apiKey,
202+
resource: obj.resource,
203+
event: obj.event,
204+
environment: environment,
205+
severity: obj.severity,
206+
service: obj.service,
207+
group: obj.group,
208+
value: obj.value,
209+
text: obj.text,
210+
tags: obj.tags,
211+
attributes: obj.attributes,
212+
origin: origin,
213+
type: obj.type,
214+
timestamp: obj.timestamp,
215+
)
198216

199-
return {r with _sent:
200-
string(
201-
v:
202-
2 == alert(
203-
url: url,
204-
apiKey: apiKey,
205-
resource: obj.resource,
206-
event: obj.event,
207-
environment: environment,
208-
severity: obj.severity,
209-
service: obj.service,
210-
group: obj.group,
211-
value: obj.value,
212-
text: obj.text,
213-
tags: obj.tags,
214-
attributes: obj.attributes,
215-
origin: origin,
216-
type: obj.type,
217-
timestamp: obj.timestamp,
218-
) / 100,
219-
),
220-
}
217+
return {r with _status: string(v: resp), _sent: string(v: 2 == resp / 100)}
221218
},
222219
)

0 commit comments

Comments
 (0)