@intentius/chant-lexicon-prometheus 0.97.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/alertmanager.d.ts +4 -2
- package/dist/alertmanager.d.ts.map +1 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/codegen/docs.d.ts.map +1 -1
- package/dist/import/embedded.d.ts +14 -0
- package/dist/import/embedded.d.ts.map +1 -0
- package/dist/import/generator.d.ts +50 -0
- package/dist/import/generator.d.ts.map +1 -0
- package/dist/import/parser.d.ts +52 -0
- package/dist/import/parser.d.ts.map +1 -0
- package/dist/import/slo.d.ts +15 -0
- package/dist/import/slo.d.ts.map +1 -0
- package/dist/integrations.d.ts +531 -0
- package/dist/integrations.d.ts.map +1 -0
- package/dist/integrity.json +7 -7
- package/dist/lint/rules/literal-credential.d.ts.map +1 -1
- package/dist/lint/rules/prom-ast.d.ts +8 -0
- package/dist/lint/rules/prom-ast.d.ts.map +1 -1
- package/dist/lint/rules/promql-literal.d.ts.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/model.d.ts +77 -121
- package/dist/model.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/rules/literal-credential.ts +52 -15
- package/dist/rules/prom-ast.ts +36 -0
- package/dist/rules/promql-literal.ts +15 -1
- package/dist/skills/chant-prometheus-alertmanager.md +4 -0
- package/dist/skills/chant-prometheus.md +11 -0
- package/package.json +2 -2
- package/src/alertmanager.ts +4 -1
- package/src/build.ts +2 -0
- package/src/codegen/docs.ts +5 -1
- package/src/import/cli.test.ts +98 -0
- package/src/import/embedded.test.ts +56 -0
- package/src/import/embedded.ts +44 -0
- package/src/import/generated-types.e2e.test.ts +77 -0
- package/src/import/generator.test.ts +138 -0
- package/src/import/generator.ts +578 -0
- package/src/import/parser.test.ts +133 -0
- package/src/import/parser.ts +365 -0
- package/src/import/roundtrip.test.ts +358 -0
- package/src/import/slo.ts +175 -0
- package/src/import/testdata/alertmanager-full.yml +89 -0
- package/src/import/testdata/alertmanager-integrations.yml +215 -0
- package/src/import/testdata/fixtures.ts +122 -0
- package/src/import/testdata/rules-full.yml +42 -0
- package/src/import/testdata/upstream/alertmanager-conf-good.yml +120 -0
- package/src/import/testdata/upstream/alertmanager-mattermost-default-webhook-url-file.yml +16 -0
- package/src/import/testdata/upstream/alertmanager-opsgenie-default-apikey-file.yml +27 -0
- package/src/import/testdata/upstream/alertmanager-rocketchat-default-token-file.yml +25 -0
- package/src/import/testdata/upstream/alertmanager-route-labels.yml +65 -0
- package/src/import/testdata/upstream/alertmanager-simple.yml +130 -0
- package/src/import/testdata/upstream/alertmanager-sns-topic-arn.yml +17 -0
- package/src/import/testdata/upstream/alertmanager-telegram-default-bot-token-file.yml +16 -0
- package/src/import/testdata/upstream/alertmanager-victorops-default-apikey-file.yml +23 -0
- package/src/import/testdata/upstream/alertmanager-wechat-default-api-secret-file.yml +18 -0
- package/src/import/testdata/upstream/prometheus-alerting-rules.yml +15 -0
- package/src/import/testdata/upstream/prometheus-alerting-templates.yml +23 -0
- package/src/import/testdata/upstream/prometheus-recording-rules.yml +7 -0
- package/src/integrations.ts +538 -0
- package/src/lint/rules/literal-credential.ts +52 -15
- package/src/lint/rules/prom-ast.ts +36 -0
- package/src/lint/rules/promql-literal.ts +15 -1
- package/src/lint/rules/rules.test.ts +58 -0
- package/src/model.ts +157 -109
- package/src/plugin.ts +15 -0
- package/src/skills/chant-prometheus-alertmanager.md +4 -0
- package/src/skills/chant-prometheus.md +11 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Vendored from github.com/prometheus/alertmanager v0.34.1, doc/examples/simple.yml
|
|
2
|
+
# (https://github.com/prometheus/alertmanager/blob/v0.34.1/doc/examples/simple.yml). Apache-2.0.
|
|
3
|
+
# Unchanged below this header.
|
|
4
|
+
global:
|
|
5
|
+
# The smarthost and SMTP sender used for mail notifications.
|
|
6
|
+
smtp_smarthost: 'localhost:25'
|
|
7
|
+
smtp_from: 'alertmanager@example.org'
|
|
8
|
+
smtp_auth_username: 'alertmanager'
|
|
9
|
+
smtp_auth_password: 'password'
|
|
10
|
+
|
|
11
|
+
# The directory from which notification templates are read.
|
|
12
|
+
templates:
|
|
13
|
+
- '/etc/alertmanager/template/*.tmpl'
|
|
14
|
+
|
|
15
|
+
# The root route on which each incoming alert enters.
|
|
16
|
+
route:
|
|
17
|
+
# The labels by which incoming alerts are grouped together. For example,
|
|
18
|
+
# multiple alerts coming in for cluster=A and alertname=LatencyHigh would
|
|
19
|
+
# be batched into a single group.
|
|
20
|
+
#
|
|
21
|
+
# To aggregate by all possible labels use '...' as the sole label name.
|
|
22
|
+
# This effectively disables aggregation entirely, passing through all
|
|
23
|
+
# alerts as-is. This is unlikely to be what you want, unless you have
|
|
24
|
+
# a very low alert volume or your upstream notification system performs
|
|
25
|
+
# its own grouping. Example: group_by: [...]
|
|
26
|
+
group_by: ['alertname', 'cluster', 'service']
|
|
27
|
+
|
|
28
|
+
# When a new group of alerts is created by an incoming alert, wait at
|
|
29
|
+
# least 'group_wait' to send the initial notification.
|
|
30
|
+
# This way ensures that you get multiple alerts for the same group that start
|
|
31
|
+
# firing shortly after another are batched together on the first
|
|
32
|
+
# notification.
|
|
33
|
+
group_wait: 30s
|
|
34
|
+
|
|
35
|
+
# When the first notification was sent, wait 'group_interval' to send a batch
|
|
36
|
+
# of new alerts that started firing for that group.
|
|
37
|
+
group_interval: 5m
|
|
38
|
+
|
|
39
|
+
# If an alert has successfully been sent, wait 'repeat_interval' to
|
|
40
|
+
# resend them.
|
|
41
|
+
repeat_interval: 3h
|
|
42
|
+
|
|
43
|
+
# A default receiver
|
|
44
|
+
receiver: team-X-mails
|
|
45
|
+
|
|
46
|
+
# All the above attributes are inherited by all child routes and can
|
|
47
|
+
# overwritten on each.
|
|
48
|
+
|
|
49
|
+
# The child route trees.
|
|
50
|
+
routes:
|
|
51
|
+
# This routes performs a regular expression match on alert labels to
|
|
52
|
+
# catch alerts that are related to a list of services.
|
|
53
|
+
- matchers:
|
|
54
|
+
- service=~"foo1|foo2|baz"
|
|
55
|
+
receiver: team-X-mails
|
|
56
|
+
# The service has a sub-route for critical alerts, any alerts
|
|
57
|
+
# that do not match, i.e. severity != critical, fall-back to the
|
|
58
|
+
# parent node and are sent to 'team-X-mails'
|
|
59
|
+
routes:
|
|
60
|
+
- matchers:
|
|
61
|
+
- severity="critical"
|
|
62
|
+
receiver: team-X-pager
|
|
63
|
+
- matchers:
|
|
64
|
+
- service="files"
|
|
65
|
+
receiver: team-Y-mails
|
|
66
|
+
|
|
67
|
+
routes:
|
|
68
|
+
- matchers:
|
|
69
|
+
- severity="critical"
|
|
70
|
+
receiver: team-Y-pager
|
|
71
|
+
|
|
72
|
+
# This route handles all alerts coming from a database service. If there's
|
|
73
|
+
# no team to handle it, it defaults to the DB team.
|
|
74
|
+
- matchers:
|
|
75
|
+
- service="database"
|
|
76
|
+
receiver: team-DB-pager
|
|
77
|
+
# Also group alerts by affected database.
|
|
78
|
+
group_by: [alertname, cluster, database]
|
|
79
|
+
routes:
|
|
80
|
+
- matchers:
|
|
81
|
+
- owner="team-X"
|
|
82
|
+
receiver: team-X-pager
|
|
83
|
+
continue: true
|
|
84
|
+
- matchers:
|
|
85
|
+
- owner="team-Y"
|
|
86
|
+
receiver: team-Y-pager
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Inhibition rules allow to mute a set of alerts given that another alert is
|
|
90
|
+
# firing.
|
|
91
|
+
# We use this to mute any warning-level notifications if the same alert is
|
|
92
|
+
# already critical.
|
|
93
|
+
inhibit_rules:
|
|
94
|
+
- source_matchers: [severity="critical"]
|
|
95
|
+
target_matchers: [severity="warning"]
|
|
96
|
+
# Apply inhibition if the alertname is the same.
|
|
97
|
+
# CAUTION:
|
|
98
|
+
# If all label names listed in `equal` are missing
|
|
99
|
+
# from both the source and target alerts,
|
|
100
|
+
# the inhibition rule will apply!
|
|
101
|
+
equal: [alertname, cluster, service]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
receivers:
|
|
105
|
+
- name: 'team-X-mails'
|
|
106
|
+
email_configs:
|
|
107
|
+
- to: 'team-X+alerts@example.org'
|
|
108
|
+
|
|
109
|
+
- name: 'team-X-pager'
|
|
110
|
+
email_configs:
|
|
111
|
+
- to: 'team-X+alerts-critical@example.org'
|
|
112
|
+
pagerduty_configs:
|
|
113
|
+
- service_key: <team-X-key>
|
|
114
|
+
|
|
115
|
+
- name: 'team-Y-mails'
|
|
116
|
+
email_configs:
|
|
117
|
+
- to: 'team-Y+alerts@example.org'
|
|
118
|
+
|
|
119
|
+
- name: 'team-Y-pager'
|
|
120
|
+
pagerduty_configs:
|
|
121
|
+
- service_key: <team-Y-key>
|
|
122
|
+
|
|
123
|
+
- name: 'team-DB-pager'
|
|
124
|
+
pagerduty_configs:
|
|
125
|
+
- service_key: <team-DB-key>
|
|
126
|
+
|
|
127
|
+
tracing:
|
|
128
|
+
endpoint: localhost:4317
|
|
129
|
+
insecure: true
|
|
130
|
+
sampling_fraction: 1.0
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Vendored from github.com/prometheus/alertmanager v0.34.1, config/testdata/conf.sns-topic-arn.yml
|
|
2
|
+
# (https://github.com/prometheus/alertmanager/blob/v0.34.1/config/testdata/conf.sns-topic-arn.yml). Apache-2.0.
|
|
3
|
+
# Unchanged below this header.
|
|
4
|
+
route:
|
|
5
|
+
receiver: 'sns-api-notifications'
|
|
6
|
+
group_by: [alertname]
|
|
7
|
+
receivers:
|
|
8
|
+
- name: 'sns-api-notifications'
|
|
9
|
+
sns_configs:
|
|
10
|
+
- api_url: https://sns.us-east-2.amazonaws.com
|
|
11
|
+
topic_arn: arn:aws:sns:us-east-2:123456789012:My-Topic
|
|
12
|
+
sigv4:
|
|
13
|
+
region: us-east-2
|
|
14
|
+
access_key: access_key
|
|
15
|
+
secret_key: secret_ket
|
|
16
|
+
attributes:
|
|
17
|
+
severity: Sev2
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Vendored from github.com/prometheus/alertmanager v0.34.1, config/testdata/conf.telegram-default-bot-token-file.yml
|
|
2
|
+
# (https://github.com/prometheus/alertmanager/blob/v0.34.1/config/testdata/conf.telegram-default-bot-token-file.yml). Apache-2.0.
|
|
3
|
+
# Unchanged below this header.
|
|
4
|
+
global:
|
|
5
|
+
telegram_bot_token_file: /global_file
|
|
6
|
+
route:
|
|
7
|
+
receiver: team-X-telegram
|
|
8
|
+
|
|
9
|
+
receivers:
|
|
10
|
+
- name: team-X-telegram
|
|
11
|
+
telegram_configs:
|
|
12
|
+
- chat_id: 123
|
|
13
|
+
- name: team-Y-telegram
|
|
14
|
+
telegram_configs:
|
|
15
|
+
- chat_id: 456
|
|
16
|
+
bot_token_file: /override_file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Vendored from github.com/prometheus/alertmanager v0.34.1, config/testdata/conf.victorops-default-apikey-file.yml
|
|
2
|
+
# (https://github.com/prometheus/alertmanager/blob/v0.34.1/config/testdata/conf.victorops-default-apikey-file.yml). Apache-2.0.
|
|
3
|
+
# Unchanged below this header.
|
|
4
|
+
global:
|
|
5
|
+
victorops_api_key_file: '/global_file'
|
|
6
|
+
route:
|
|
7
|
+
group_by: ['alertname', 'cluster', 'service']
|
|
8
|
+
group_wait: 30s
|
|
9
|
+
group_interval: 5m
|
|
10
|
+
repeat_interval: 3h
|
|
11
|
+
receiver: team-Y-victorops
|
|
12
|
+
routes:
|
|
13
|
+
- match:
|
|
14
|
+
service: foo
|
|
15
|
+
receiver: team-X-victorops
|
|
16
|
+
receivers:
|
|
17
|
+
- name: 'team-X-victorops'
|
|
18
|
+
victorops_configs:
|
|
19
|
+
- routing_key: 'team-X'
|
|
20
|
+
- name: 'team-Y-victorops'
|
|
21
|
+
victorops_configs:
|
|
22
|
+
- routing_key: 'team-Y'
|
|
23
|
+
api_key_file: /override_file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Vendored from github.com/prometheus/alertmanager v0.34.1, config/testdata/conf.wechat-default-api-secret-file.yml
|
|
2
|
+
# (https://github.com/prometheus/alertmanager/blob/v0.34.1/config/testdata/conf.wechat-default-api-secret-file.yml). Apache-2.0.
|
|
3
|
+
# Unchanged below this header.
|
|
4
|
+
global:
|
|
5
|
+
wechat_api_secret_file: '/global_file'
|
|
6
|
+
wechat_api_corp_id: 'my_corp_id'
|
|
7
|
+
route:
|
|
8
|
+
receiver: 'wechat-notifications'
|
|
9
|
+
group_by: [alertname, datacenter, app]
|
|
10
|
+
receivers:
|
|
11
|
+
- name: 'wechat-notifications'
|
|
12
|
+
wechat_configs:
|
|
13
|
+
# Use global
|
|
14
|
+
- {}
|
|
15
|
+
# Override global with other file
|
|
16
|
+
- api_secret_file: '/override_file'
|
|
17
|
+
# Override global with inline API secret
|
|
18
|
+
- api_secret: 'my_inline_secret'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# From github.com/prometheus/prometheus v3.15.0, docs/configuration/alerting_rules.md,
|
|
2
|
+
# "Defining alerting rules" (https://github.com/prometheus/prometheus/blob/v3.15.0/docs/configuration/alerting_rules.md). Apache-2.0.
|
|
3
|
+
groups:
|
|
4
|
+
- name: example
|
|
5
|
+
labels:
|
|
6
|
+
team: myteam
|
|
7
|
+
rules:
|
|
8
|
+
- alert: HighRequestLatency
|
|
9
|
+
expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
|
|
10
|
+
for: 10m
|
|
11
|
+
keep_firing_for: 5m
|
|
12
|
+
labels:
|
|
13
|
+
severity: page
|
|
14
|
+
annotations:
|
|
15
|
+
summary: High request latency
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# From github.com/prometheus/prometheus v3.15.0, docs/configuration/alerting_rules.md,
|
|
2
|
+
# "Templating" example (https://github.com/prometheus/prometheus/blob/v3.15.0/docs/configuration/alerting_rules.md). Apache-2.0.
|
|
3
|
+
groups:
|
|
4
|
+
- name: example
|
|
5
|
+
rules:
|
|
6
|
+
|
|
7
|
+
# Alert for any instance that is unreachable for >5 minutes.
|
|
8
|
+
- alert: InstanceDown
|
|
9
|
+
expr: up == 0
|
|
10
|
+
for: 5m
|
|
11
|
+
labels:
|
|
12
|
+
severity: page
|
|
13
|
+
annotations:
|
|
14
|
+
summary: "Instance {{ $labels.instance }} down"
|
|
15
|
+
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."
|
|
16
|
+
|
|
17
|
+
# Alert for any instance that has a median request latency >1s.
|
|
18
|
+
- alert: APIHighRequestLatency
|
|
19
|
+
expr: api_http_request_latencies_second{quantile="0.5"} > 1
|
|
20
|
+
for: 10m
|
|
21
|
+
annotations:
|
|
22
|
+
summary: "High request latency on {{ $labels.instance }}"
|
|
23
|
+
description: "{{ $labels.instance }} has a median request latency above 1s (current value: {{ $value }}s)"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# From github.com/prometheus/prometheus v3.15.0, docs/configuration/recording_rules.md,
|
|
2
|
+
# "A simple example rules file" (https://github.com/prometheus/prometheus/blob/v3.15.0/docs/configuration/recording_rules.md). Apache-2.0.
|
|
3
|
+
groups:
|
|
4
|
+
- name: example
|
|
5
|
+
rules:
|
|
6
|
+
- record: code:prometheus_http_requests_total:sum
|
|
7
|
+
expr: sum by (code) (prometheus_http_requests_total)
|