Open mywkaa opened 6 years ago
In go templating this field looks like :
{{ range $val := .Alerts -}} Alert duration: {{$val.Duration}} {{ end }}
result:
Alert duration : 1m0s
So is result human-readable? Simple duration output is usually in milliseconds.
Can you also update README, please?
So is result human-readable? Simple duration output is usually in milliseconds.
Yes result is human readable, added "Truncate" to seconds to avoid ms output. Here is an example https://play.golang.org/p/vUR15ehvd8T
Can you also update README, please?
README has no fields related documentation. Should I add new testdata file ?
@mywkaa Please add usage to readme and I'll be able to merge this
Hello,
Added new field "Duration" with time.Duration format , it equals of subtraction between endsAt and startsAt fields.
Example alert resolved:
{ "alerts":[ { "annotations":{ "resolve_message":"node-exporter is available test12345", "summary":"node-exporter is not available during 5 minute test12345" }, "endsAt":"2018-06-05T09:18:45.237509292Z", "generatorURL":"1111", "labels":{ "alertname":"Node exporter availability during 5 minute 12345", "instance":"22222", "severity":"critical" }, "startsAt":"2018-06-05T09:17:45.237509292Z", "Duration":60000000000 } ] }