194 lines
8 KiB
Text
194 lines
8 KiB
Text
[
|
|
{"type":"CommentSingle","value":"# A metric with label filtering"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"NameVariable","value":"go_gc_duration_seconds"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"NameLabel","value":"instance"},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"localhost:9090"},
|
|
{"type":"Punctuation","value":"\","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameLabel","value":"job"},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"alertmanager"},
|
|
{"type":"Punctuation","value":"\"}"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# Aggregation operators"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"Keyword","value":"sum"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Keyword","value":"by"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"NameVariable","value":"app"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"proc"},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"NameVariable","value":"instance_memory_limit_bytes"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"-"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"instance_memory_usage_bytes"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"/"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"1024"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"/"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"1024"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# Metric with multiple lables and whitespaces"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"NameVariable","value":"go_gc_duration_seconds"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameLabel","value":"instance"},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"localhost:9090"},
|
|
{"type":"Punctuation","value":"\","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameLabel","value":"job"},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"alertmanager"},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# Expression and comment"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"NameVariable","value":"go_gc_duration_seconds"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"NameLabel","value":"instance"},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"localhost:9090"},
|
|
{"type":"Punctuation","value":"\"}"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"CommentSingle","value":"# single comment"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# Delta function"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"KeywordReserved","value":"delta"},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"NameVariable","value":"cpu_temp_celsius"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"NameLabel","value":"host"},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"zeus"},
|
|
{"type":"Punctuation","value":"\"}["},
|
|
{"type":"LiteralString","value":"2h"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# Sum with arguments"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"Keyword","value":"sum"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Keyword","value":"by"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"NameVariable","value":"app"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"proc"},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"NameVariable","value":"instance_memory_usage_bytes"},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# Multi-line with offset"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"KeywordReserved","value":"label_replace"},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Keyword","value":"avg"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Keyword","value":"by"},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"NameVariable","value":"instance"},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"KeywordReserved","value":"irate"},
|
|
{"type":"Operator","value":"("},
|
|
{"type":"NameVariable","value":"node_cpu_seconds_total"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"NameLabel","value":"mode"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"idle"},
|
|
{"type":"Punctuation","value":"\"}["},
|
|
{"type":"LiteralString","value":"5m"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Keyword","value":"offset"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"3s"},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"*"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"100"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"device"},
|
|
{"type":"Punctuation","value":"\","},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"cpu"},
|
|
{"type":"Punctuation","value":"\","},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":"instance"},
|
|
{"type":"Punctuation","value":"\","},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"LiteralString","value":".*"},
|
|
{"type":"Punctuation","value":"\""},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"Operator","value":")"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# Values for labels enclosed within single quotes"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"NameVariable","value":"metric_test_app"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"NameLabel","value":"app"},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Punctuation","value":"'"},
|
|
{"type":"LiteralString","value":"turtle"},
|
|
{"type":"Punctuation","value":"',"},
|
|
{"type":"NameLabel","value":"proc"},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Punctuation","value":"'"},
|
|
{"type":"LiteralString","value":"web"},
|
|
{"type":"Punctuation","value":"'}"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# Use label matching operator `!~`"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"NameVariable","value":"metric_test_app"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"NameLabel","value":"status"},
|
|
{"type":"Operator","value":"!~"},
|
|
{"type":"Punctuation","value":"'"},
|
|
{"type":"LiteralString","value":"(4|5).."},
|
|
{"type":"Punctuation","value":"'}"},
|
|
{"type":"TextWhitespace","value":"\n"}
|
|
]
|