Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Feb 16, 2022
1 parent 10f9b9c commit 2b7383f
Show file tree
Hide file tree
Showing 14 changed files with 441 additions and 31 deletions.
13 changes: 9 additions & 4 deletions docs/checks/alerts/annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,18 @@ checks {

Or you can disable it per rule by adding a comment to it.

### If `value` is set
`# pint disable alerts/annotation`

If you want to disable only individual instances of this check
you can add a more specific comment.

### If `value` is NOT set

```yaml
groups:
- name: ...
rules:
# pint disable alerts/annotation($pattern:$value:$required)
# pint disable alerts/annotation($pattern:$required)
- record: ...
expr: ...
```
Expand All @@ -90,13 +95,13 @@ Example comment disabling that rule:

`# pint disable alerts/annotation(summary:true)`

### If `value` is NOT set
### If `value` is set

```yaml
groups:
- name: ...
rules:
# pint disable alerts/annotation($pattern:$required)
# pint disable alerts/annotation($pattern:$value:$required)
- record: ...
expr: ...
```
Expand Down
5 changes: 5 additions & 0 deletions docs/checks/alerts/count.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ checks {

Or you can disable it per rule by adding a comment to it.

`# pint disable alerts/count`

If you want to disable only individual instances of this check
you can add a more specific comment.

`# pint disable alerts/count($prometheus)`

Where `$prometheus` is the name of Prometheus server to disable.
Expand Down
7 changes: 6 additions & 1 deletion docs/checks/promq/aggregate.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ checks {
}
```

Or you can disable it per rule by adding a comment to it.
Or you can disable it per rule by adding a comment to it:

`# pint disable promql/aggregate`

If you want to disable only individual instances of this check
you can add a more specific comment.

### If `keep` is set

Expand Down
7 changes: 6 additions & 1 deletion docs/checks/promq/rate.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ checks {
}
```

Or you can disable it per rule by adding a comment to it.
Or you can disable it per rule by adding a comment to it:

`# pint disable promql/rate`

If you want to disable only individual instances of this check
you can add a more specific comment.

`# pint disable promql/rate($prometheus)`

Expand Down
26 changes: 25 additions & 1 deletion docs/checks/promq/series.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ checks {
}
```

Or you can disable it per rule by adding a comment to it.
Or you can disable it per rule by adding a comment to it:

`# pint disable promql/series`

If you want to disable only individual instances of this check
you can add a more specific comment.

`# pint disable promql/series($prometheus)`

Expand All @@ -64,3 +69,22 @@ Where `$prometheus` is the name of Prometheus server to disable.
Example:

`# pint disable promql/series(prod)`

You can also disable `promql/series` for specific metric using
`# pint disable promql/series($selector)` comment.

Just like with PromQL if a selector doesn't have any labels then it will match all instances,
if you pass any labels it will only pass time series with those labels.

Disable warnings about missing `my_metric_name`:

```YAML
# pint disable promql/series(my_metric_name)
```

Disable it only for `my_metric_name{cluster="dev"}` but still warn about
`my_metric_name{cluster="prod"}`:

```YAML
# pint disable promql/series(my_metric_name{cluster="dev"})
```
7 changes: 6 additions & 1 deletion docs/checks/promq/vector_matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ checks {
}
```

Or you can disable it per rule by adding a comment to it.
Or you can disable it per rule by adding a comment to it:

`# pint disable promql/vector_matching`

If you want to disable only individual instances of this check
you can add a more specific comment.

`# pint disable promql/vector_matching($prometheus)`

Expand Down
15 changes: 10 additions & 5 deletions docs/checks/query/cost.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,29 @@ checks {
}
```

Or you can disable it per rule by adding a comment to it.
Or you can disable it per rule by adding a comment to it:

`# pint disable query/cost`

If you want to disable only individual instances of this check
you can add a more specific comment.

### If `maxSeries` is set

`# pint disable promql/aggregate($prometheus:$maxSeries)`
`# pint disable query/cost($prometheus:$maxSeries)`

Where `$prometheus` is the name of Prometheus server to disable.

Example:

`# pint disable promql/aggregate(dev:5000)`
`# pint disable query/cost(dev:5000)`

### If `maxSeries` is NOT set

`# pint disable promql/aggregate($prometheus)`
`# pint disable query/cost($prometheus)`

Where `$prometheus` is the name of Prometheus server to disable.

Example:

`# pint disable promql/aggregate(dev)`
`# pint disable query/cost(dev)`
67 changes: 63 additions & 4 deletions docs/checks/rule/label.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,38 @@ parent: Checks
grand_parent: Documentation
---

## rule/label
# rule/label

This check works the same way as `annotation` check, but it operates on
labels instead.
This check works the same way as [alerts/annotation](../alerts/annotation.md) check,
but it operates on labels instead.
It uses static labels set on alerting or recording rule. It doesn't use
labels on time series used in those rules.

## Configuration

Syntax:

```js
label "(.*)" {
label "$pattern" {
severity = "bug|warning|info"
value = "..."
required = true|false
}
```

- `$pattern` - regexp pattern to match label name on
- `severity` - set custom severity for reported issues, defaults to a warning
- `value` - optional value pattern to enforce, if not set only the
- `required` - if `true` pint will require every rule to have this label set,
if `false` it will only check values where label is set

## How to enable it

This check is not enabled by default as it requires explicit configuration
to work.
To enable it add one or more `rule {...}` blocks and specify all required
labels there.

Example:

Require `severity` label to be set on alert rules with two all possible values:
Expand All @@ -37,3 +52,47 @@ rule {
}
}
```

## How to disable it

You can disable this check globally by adding this config block:

```js
checks {
disabled = ["rule/label"]
}
```

Or you can disable it per rule by adding a comment to it:

`# pint disable rule/label`

If you want to disable only individual instances of this check
you can add a more specific comment.

`# pint disable rule/label($label:$required)`

Where `$label` is the label name and `$required` is the configure value
of `required` option.

```yaml
groups:
- name: ...
rules:
# pint disable rule/label($pattern:$required)
- record: ...
expr: ...
```
Example rule:
```js
label "severity" {
value = "(warning|critical)"
required = true
}
```

Example comment disabling that rule:

`# pint disable rule/label(severity:true)`
59 changes: 55 additions & 4 deletions docs/checks/rule/reject.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ parent: Checks
grand_parent: Documentation
---

## rule/reject
# rule/reject

This check allows rejecting label or annotations keys and values
using regexp rules.
This check allows rejecting label or annotations keys and values using regexp
rules.

## Configuration

Syntax:

```js
reject "(.*)" {
reject "$pattern" {
severity = "bug|warning|info"
label_keys = true|false
label_values = true|false
Expand All @@ -21,6 +23,7 @@ reject "(.*)" {
}
```

- `$pattern` - regexp pattern to reject
- `severity` - set custom severity for reported issues, defaults to a bug.
- `label_keys` - if true label keys for recording and alerting rules will
be checked.
Expand All @@ -29,6 +32,13 @@ reject "(.*)" {
- `annotation_keys` - if true annotation keys for alerting rules will be checked.
- `annotation_values` - if true label values for alerting rules will be checked.

## How to enable it

This check is not enabled by default as it requires explicit configuration
to work.
To enable it add one or more `rule {...}` blocks and specify all rejected patterns
there.

Example:

Disallow using URLs as label keys or values:
Expand Down Expand Up @@ -56,3 +66,44 @@ rule {
}
}
```

## How to disable it

You can disable this check globally by adding this config block:

```js
checks {
disabled = ["rule/reject"]
}
```

You can disable this check globally by adding this config block:

```js
checks {
disabled = ["rule/reject"]
}
```

Or you can disable it per rule by adding a comment to it.

`# pint disable rule/reject`

If you want to disable only individual instances of this check
you can add a more specific comment.

### If `label_keys` or `annotation_keys` is set

`# pint disable rule/reject(key=~'$pattern`)`

Example:

`# pint disable rule/reject(key=~'^https?://.+$')`

### If `label_values` or `annotation_values` is set

`# pint disable promql/aggregate($label:false)`

Example:

`# pint disable rule/reject(val=~'^https?://.+$')`
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Available metrics:

## Release Notes

See [changelog](changelog.html) for history of changes.
See [changelog](changelog.md) for history of changes.

## Quick start

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.32.1
github.com/prometheus/prometheus v1.8.2-0.20220202150209-4e08110891fd
github.com/prometheus/prometheus v1.8.2-0.20220211202545-56e14463bccf
github.com/rogpeppe/go-internal v1.8.1
github.com/rs/zerolog v1.26.1
github.com/stretchr/testify v1.7.0
Expand All @@ -26,7 +26,7 @@ require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/aws/aws-sdk-go v1.42.51 // indirect
github.com/aws/aws-sdk-go v1.42.53 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
Expand Down Expand Up @@ -65,7 +65,7 @@ require (
github.com/zclconf/go-cty v1.10.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
Expand Down
Loading

0 comments on commit 2b7383f

Please sign in to comment.