Skip to content

Commit 76b9706

Browse files
authored
Merge pull request #1220 from cloudflare/docs
Update docs
2 parents a7062a5 + 1b9a6d6 commit 76b9706

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

docs/changelog.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
### Added
66

77
- Added `schema` option to the `parser` configuration block for setting rule validation
8-
schema. Default value is `prometheus` and tells pint to expect rules with the schema
8+
schema. This option is only used when files are parsed in strict mode - which is when
9+
rule file path does NOT match any of the `parser:relaxed` regex values or when simply
10+
`parser:relaxed` is not set at all.
11+
Default value is `prometheus` and tells pint to expect rule files with the schema
912
expected by Prometheus itself. If you use pint to validate rules loaded into Thanos Rule
1013
component then set `schema` to `thanos` in your pint config file:
1114

@@ -15,6 +18,31 @@
1518
}
1619
```
1720

21+
File schema when using `schema: prometheus` (default):
22+
23+
```yaml
24+
groups:
25+
- name: example
26+
rules:
27+
- record: ...
28+
expr: ...
29+
- alert: ...
30+
expr: ...
31+
```
32+
33+
When using `schema: thanos`:
34+
35+
```yaml
36+
groups:
37+
- name: example
38+
partial_response_strategy: abort
39+
rules:
40+
- record: ...
41+
expr: ...
42+
- alert: ...
43+
expr: ...
44+
```
45+
1846
- Rules configured in `pint` config can now be locked - when a rule is locked it cannot
1947
be disabled by users by adding a `# pint disable ...` or `# pint snooze ...` comments.
2048

docs/configuration.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,47 @@ parser {
7171
}
7272
```
7373

74-
- `schema` - rule file schema to use, valid values are `prometheus` and `thanos`.
75-
Setting it to `prometheus` means that pint will assume that all rules have the schema
74+
- `schema` - rule file schema to use when using `strict` parser mode, valid values are `prometheus` and `thanos`.
75+
This option is has no effect when `relaxed` mode is enabled, see below.
76+
Setting it to `prometheus` means that pint will assume that all rule files have the schema
7677
as defined in [alerting rules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)
7778
and [recording rules](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/)
7879
Prometheus docs.
7980
Setting it to `thanos` will tell pint to use the schema as defined
80-
in [Thanos Rule](https://thanos.io/tip/components/rule.md/) docs.
81+
in [Thanos Rule](https://thanos.io/tip/components/rule.md/) docs, which currently allows for setting
82+
an extra key on the rule group object - `partial_response_strategy`.
8183
Default value is `prometheus`.
8284
- `include` - list of file patterns to check when running checks. Only files
8385
matching those regexp rules will be checked, other modified files will be ignored.
8486
- `exclude` - list of file patterns to ignore when running checks.
8587
This option takes precedence over `include`, so if a file path matches both
8688
`include` & `exclude` patterns, it will be excluded.
8789
- `relaxed` - by default, pint will parse all files in strict mode, where
88-
all rule files must have the exact syntax Prometheus expects:
90+
all rule files must have the exact syntax Prometheus or Thanos expects:
91+
92+
When using `schema: prometheus` (default):
93+
94+
```yaml
95+
groups:
96+
- name: example
97+
rules:
98+
- record: ...
99+
expr: ...
100+
- alert: ...
101+
expr: ...
102+
```
103+
104+
When using `schema: thanos`:
89105

90106
```yaml
91107
groups:
92108
- name: example
109+
partial_response_strategy: abort
93110
rules:
94111
- record: ...
95112
expr: ...
113+
- alert: ...
114+
expr: ...
96115
```
97116

98117
If you're using pint to lint rules that are embedded inside a different structure

0 commit comments

Comments
 (0)