This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_duration: | |
[scan("(?:(\\d+)m)|(?:(\\d+[.]\\d+)s)|(?:(\\d+[.]\\d+)ms)") | (60000 * ((.[0] // "0") | tonumber)) + (1000 * ((.[1] // "0") | tonumber)) + ((.[2] // "0") | tonumber) ] | reduce .[] as $item (0; . + $item) ; | |
def logfmt: | |
[ scan("(\\w+)=(?:(?:\"([^\"]+)\")|(\\S+))\\s*") | {key: .[0], value: (.[1] // .[2])}] | from_entries ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module example.com/alert-rule-experiment | |
go 1.23.6 | |
require github.com/prometheus/prometheus v0.301.0 | |
require ( | |
github.com/beorn7/perks v1.0.1 // indirect | |
github.com/cespare/xxhash/v2 v2.3.0 // indirect | |
github.com/dennwc/varint v1.0.0 // indirect |