cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/changelog.md
2234lines · modecode
| 1 | # Changelog |
| 2 | |
| 3 | ## v0.75.0 |
| 4 | |
| 5 | ### Added |
| 6 | |
| 7 | - Added [promql/selector](checks/promql/selector.md) check - [#1416](https://github.com/cloudflare/pint/issues/1416) |
| 8 | and [#1540](https://github.com/cloudflare/pint/issues/1540). |
| 9 | |
| 10 | ## v0.74.8 |
| 11 | |
| 12 | ### Fixed |
| 13 | |
| 14 | - Fixed incorrect suggestions from [query/cost](checks/query/cost.md) for function calls with different arguments. |
| 15 | |
| 16 | ## v0.74.7 |
| 17 | |
| 18 | ### Fixed |
| 19 | |
| 20 | - Fixed a bug in GitLab integration causing problems fail to create comments when they are reported on deleted lines. |
| 21 | - Fixed incorrect suggestions from [query/cost](checks/query/cost.md) for rules joining on multiple metrics. |
| 22 | |
| 23 | ## v0.74.6 |
| 24 | |
| 25 | ### Fixed |
| 26 | |
| 27 | - Fixed a bug in GitLab integration causing some problems fail to create comments when files were renamed and modified. |
| 28 | |
| 29 | ## v0.74.5 |
| 30 | |
| 31 | ### Fixed |
| 32 | |
| 33 | - Fixed incorrect incorrect suggestions generated by [query/cost](checks/query/cost.md) check. |
| 34 | - Fixed unmodified lines incorrectly marked as modified when running `pint ci`. |
| 35 | |
| 36 | ## v0.74.4 |
| 37 | |
| 38 | ### Fixed |
| 39 | |
| 40 | - Fixed false positive reports from [promql/rate](checks/promql/rate.md) check when native histograms or summaries are used. |
| 41 | |
| 42 | ## v0.74.3 |
| 43 | |
| 44 | ### Fixed |
| 45 | |
| 46 | - Fixed false positive reports from [promql/fragile](checks/promql/fragile.md) check - [#1466](https://github.com/cloudflare/pint/issues/1466). |
| 47 | - Fixed incorrect reports from [query/cost](checks/query/cost.md) when multiple rules with `rate(...)` were present |
| 48 | and each had a different rate time window. |
| 49 | |
| 50 | ## v0.74.2 |
| 51 | |
| 52 | ### Fixed |
| 53 | |
| 54 | - Fixed an issue where pint would fail to create MR comment if GitLab API returned empty diff body. |
| 55 | |
| 56 | ## v0.74.1 |
| 57 | |
| 58 | ### Fixed |
| 59 | |
| 60 | - Fixed incorrect suggestion from [query/cost](checks/query/cost.md) when a query uses joins or unless. |
| 61 | |
| 62 | ## v0.74.0 |
| 63 | |
| 64 | ### Added |
| 65 | |
| 66 | - [promql/fragile](checks/promql/fragile.md) check will now warn about alerting rules using |
| 67 | aggregations that might cause false positives when Prometheus restarts. |
| 68 | - [query/cost](checks/query/cost.md) check will now try to find queries that perform operations |
| 69 | for which there is a recording rule, and suggest using these recording rules instead to speed |
| 70 | up the query. |
| 71 | |
| 72 | ### Fixed |
| 73 | |
| 74 | - Improved accuracy of messages produced by the [promql/impossible](checks/promql/impossible.md) check. |
| 75 | |
| 76 | ## v0.73.7 |
| 77 | |
| 78 | ### Fixed |
| 79 | |
| 80 | - Fixed a bug in GitLab integration causing incorrect line numbers to be used for comments. |
| 81 | |
| 82 | ## v0.73.6 |
| 83 | |
| 84 | ### Fixed |
| 85 | |
| 86 | - Fixed a bug in GitLab integration causing some problems fail to create comments when files were renamed. |
| 87 | |
| 88 | ## v0.73.5 |
| 89 | |
| 90 | ### Fixed |
| 91 | |
| 92 | - Fixed incorrect error message for some problems reported by [alerts/template](checks/alerts/template.md) check. |
| 93 | |
| 94 | ## v0.73.4 |
| 95 | |
| 96 | ### Fixed |
| 97 | |
| 98 | - Fixed handling of resolved comments when using GitLab with `pint ci` command. |
| 99 | |
| 100 | ## v0.73.3 |
| 101 | |
| 102 | ### Fixed |
| 103 | |
| 104 | - Fixed incorrect value in `This pint run would create N comment(s), which is more than the limit ...` comments |
| 105 | when using GitHub or GitLab with `pint ci` command. |
| 106 | |
| 107 | ## v0.73.2 |
| 108 | |
| 109 | ### Fixed |
| 110 | |
| 111 | - Fixed handling of stale comments when using GitLab with `pint ci` command. |
| 112 | |
| 113 | ## v0.73.1 |
| 114 | |
| 115 | ### Fixed |
| 116 | |
| 117 | - Fixed `relaxed` parsing mode not finding all rules in some files - [#1405](https://github.com/cloudflare/pint/issues/1405). |
| 118 | |
| 119 | ## v0.73.0 |
| 120 | |
| 121 | ### Changed |
| 122 | |
| 123 | - When pint finds the exact same problem generating multiple problem reports it will now hide duplicated reports. |
| 124 | There is a new flag `pint --show-duplicates ...` that you can use to show all instances of each problem. |
| 125 | For example if we have three different rules with the same smelly selector: |
| 126 | |
| 127 | ```yaml |
| 128 | groups: |
| 129 | - name: foo |
| 130 | rules: |
| 131 | - record: events:a |
| 132 | expr: events_total{instance="a", job=~"foo.+"} |
| 133 | - record: events:b |
| 134 | expr: events_total{instance="b", job=~"foo.+"} |
| 135 | - record: events:c |
| 136 | expr: events_total{instance="c", job=~"foo.+"} |
| 137 | ``` |
| 138 | |
| 139 | Previous versions of pint would print each problem: |
| 140 | |
| 141 | ```yaml |
| 142 | Warning: smelly regexp selector (promql/regexp) |
| 143 | ---> rules/1.yaml:5 -> `events:a` |
| 144 | 5 | expr: events_total{instance="a", job=~"foo.+"} |
| 145 | ^^^^^^^^^^^^ `{job=~"foo.+"}` looks like a smelly selector ... |
| 146 | |
| 147 | Warning: smelly regexp selector (promql/regexp) |
| 148 | ---> rules/1.yaml:7 -> `events:b` |
| 149 | 7 | expr: events_total{instance="b", job=~"foo.+"} |
| 150 | ^^^^^^^^^^^^ `{job=~"foo.+"}` looks like a smelly selector ... |
| 151 | |
| 152 | Warning: smelly regexp selector (promql/regexp) |
| 153 | ---> rules/1.yaml:9 -> `events:c` |
| 154 | 9 | expr: events_total{instance="c", job=~"foo.+"} |
| 155 | ^^^^^^^^^^^^ `{job=~"foo.+"}` looks like a smelly selector ... |
| 156 | ``` |
| 157 | |
| 158 | This release of pint will (by default) show it only once: |
| 159 | |
| 160 | ```yaml |
| 161 | Warning: smelly regexp selector (promql/regexp) |
| 162 | ---> rules/1.yaml:5 -> `events:a` [+2 duplicates] |
| 163 | 5 | expr: events_total{instance="a", job=~"foo.+"} |
| 164 | ^^^^^^^^^^^^ `{job=~"foo.+"}` looks like a smelly selector ... |
| 165 | ``` |
| 166 | |
| 167 | ## v0.72.1 |
| 168 | |
| 169 | ### Fixed |
| 170 | |
| 171 | - `pint_problem` metrics exposed when running `pint watch` were lacking problem details. |
| 172 | |
| 173 | ## v0.72.0 |
| 174 | |
| 175 | ### Added |
| 176 | |
| 177 | - Labels set on [the group level](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group) are now supported by pint. |
| 178 | - [promql/series](checks/promql/series.md) check now supports `snooze` comments with a metric selector. |
| 179 | |
| 180 | ### Fixed |
| 181 | |
| 182 | - [alerts/comparison](checks/alerts/comparison.md) was refactored to output more accurate reports. |
| 183 | - [alerts/template](checks/alerts/template.md) was refactored to output more accurate reports. |
| 184 | - [promql/vector_matching](checks/promql/vector_matching.md) will now produce more accurate messages with more details. |
| 185 | |
| 186 | ## v0.71.8 |
| 187 | |
| 188 | ### Fixed |
| 189 | |
| 190 | - Don't try to report problems to BitBucket for unmodified rules. |
| 191 | |
| 192 | ## v0.71.7 |
| 193 | |
| 194 | ### Fixed |
| 195 | |
| 196 | - Fixed a panic when parsing empty documents - [#1355](https://github.com/cloudflare/pint/issues/1355). |
| 197 | |
| 198 | ## v0.71.6 |
| 199 | |
| 200 | ### Fixed |
| 201 | |
| 202 | - [promql/series](checks/promql/series.md) check will now output more accurate comments. |
| 203 | |
| 204 | ## v0.71.5 |
| 205 | |
| 206 | ### Fixed |
| 207 | |
| 208 | - [alerts/template](checks/alerts/template.md) check will now output more accurate comments. |
| 209 | |
| 210 | ## v0.71.4 |
| 211 | |
| 212 | ### Fixed |
| 213 | |
| 214 | - Fix [promql/series](checks/promql/series.md) to not fail on `absent({...})` calls. |
| 215 | - Fix formatting of BitBucket comments. |
| 216 | |
| 217 | ## v0.71.3 |
| 218 | |
| 219 | ### Fixed |
| 220 | |
| 221 | - Some parts of comments reported to GitHub & GitLab were not using collapsible blocks as intended. |
| 222 | |
| 223 | ## v0.71.2 |
| 224 | |
| 225 | ### Fixed |
| 226 | |
| 227 | - Print only relevant lines when reporting problems. |
| 228 | - Make comments reported to GitHub & GitLab more compact by using collapsible blocks. |
| 229 | |
| 230 | ## v0.71.1 |
| 231 | |
| 232 | ### Fixed |
| 233 | |
| 234 | - Don't create empty markdown blocks when reporting problems to GitHub & GitLab. |
| 235 | - Added missing problem details to comments reported to BitBucket. |
| 236 | |
| 237 | ## v0.71.0 |
| 238 | |
| 239 | ### Added |
| 240 | |
| 241 | - Added `names` option to the `parser` block, which controls how does Prometheus validates |
| 242 | label names. |
| 243 | - Added [promql/impossible](checks/promql/impossible.md) check. This check duplicates some |
| 244 | of the functionality of the [promql/vector_matching](checks/promql/vector_matching.md) so |
| 245 | in the future the scope of [promql/vector_matching](checks/promql/vector_matching.md) checks |
| 246 | will be reduced to avoid duplicated reports for the same issue. |
| 247 | - Added `ignoreMatchingElsewhere` option to [promql/series](checks/promql/series.md) check. |
| 248 | |
| 249 | ### Changed |
| 250 | |
| 251 | - Removed aggregation checks from the [promql/fragile](checks/promql/fragile.md) check - #1289. |
| 252 | - [promql/regexp](checks/promql/regexp.md) check severity was reduced from `bug` to a `warning`. |
| 253 | - This release contains some major changes to the way problems are reported by pint. |
| 254 | Each problem might now point to the specific part of the PromQL query that caused the issue |
| 255 | rather than just the line range on which the query is defined. Most, but not all, checks |
| 256 | were updated to emit more detailed problem descriptions. |
| 257 | |
| 258 | ### Fixed |
| 259 | |
| 260 | - Improved the logic of [promql/series](checks/promql/series.md) check to skip checks on some selectors |
| 261 | which absence might be expected. For example using `foo unless bar` will now only have `foo` |
| 262 | tested while `bar` is ignored by this check. This is because the query implies that `bar` |
| 263 | might be present or missing and depending on that `foo` is evaluated. |
| 264 | - Don't report regexp matchers with only digits in them (`{code=~"5.*"}`) as smelly in [promql/regexp](checks/promql/regexp.md) check. |
| 265 | |
| 266 | ## v0.70.0 |
| 267 | |
| 268 | ### Added |
| 269 | |
| 270 | - When running `pint watch` command `/health` HTTP endpoint can now be used for liveness probes. |
| 271 | |
| 272 | ### Changed |
| 273 | |
| 274 | - When pint runs online checks against Thanos or other service that implements some, but not all, Prometheus APIs |
| 275 | it would reports errors due to some API requests returning `404 Not Found` HTTP errors. |
| 276 | Now pint will automatically disable checks that rely on Prometheus API endpoints that are not supported |
| 277 | and create a summary comment (when running `pint ci`) that lists disabled checks. |
| 278 | This applies to these API endpoints: |
| 279 | |
| 280 | - `/api/v1/status/config` |
| 281 | - `/api/v1/status/flags` |
| 282 | - `/api/v1/metadata` |
| 283 | |
| 284 | ## v0.69.1 |
| 285 | |
| 286 | ### Fixed |
| 287 | |
| 288 | - `# pint file/owner` comments were not validated properly for files with no rules. |
| 289 | This is now fixed. |
| 290 | |
| 291 | ## v0.69.0 |
| 292 | |
| 293 | ### Added |
| 294 | |
| 295 | - Added `schema` option to the `parser` configuration block for setting rule validation |
| 296 | schema. This option is only used when files are parsed in strict mode - which is when |
| 297 | rule file path does NOT match any of the `parser:relaxed` regex values or when simply |
| 298 | `parser:relaxed` is not set at all. |
| 299 | Default value is `prometheus` and tells pint to expect rule files with the schema |
| 300 | expected by Prometheus itself. If you use pint to validate rules loaded into Thanos Rule |
| 301 | component then set `schema` to `thanos` in your pint config file: |
| 302 | |
| 303 | ```js |
| 304 | parser { |
| 305 | schema = "thanos" |
| 306 | } |
| 307 | ``` |
| 308 | |
| 309 | File schema when using `schema: prometheus` (default): |
| 310 | |
| 311 | ```yaml |
| 312 | groups: |
| 313 | - name: example |
| 314 | rules: |
| 315 | - record: ... |
| 316 | expr: ... |
| 317 | - alert: ... |
| 318 | expr: ... |
| 319 | ``` |
| 320 | |
| 321 | When using `schema: thanos`: |
| 322 | |
| 323 | ```yaml |
| 324 | groups: |
| 325 | - name: example |
| 326 | partial_response_strategy: abort |
| 327 | rules: |
| 328 | - record: ... |
| 329 | expr: ... |
| 330 | - alert: ... |
| 331 | expr: ... |
| 332 | ``` |
| 333 | |
| 334 | - Rules configured in `pint` config can now be locked - when a rule is locked it cannot |
| 335 | be disabled by users by adding a `# pint disable ...` or `# pint snooze ...` comments. |
| 336 | |
| 337 | ### Fixed |
| 338 | |
| 339 | - The console reporter won't color the output if `--no-color` flag is set. |
| 340 | |
| 341 | ## v0.68.0 |
| 342 | |
| 343 | ### Added |
| 344 | |
| 345 | - Added [rule/report](checks/rule/report.md) check. |
| 346 | |
| 347 | ### Changed |
| 348 | |
| 349 | - pint now uses [Prometheus 3.0](https://prometheus.io/blog/2024/11/14/prometheus-3-0/) libraries |
| 350 | for parsing PromQL, which adds support for new query syntax that allows for dots and UTF-8 chars |
| 351 | in metric/label names, example: |
| 352 | |
| 353 | ```js |
| 354 | {"status.üp"} == 0 |
| 355 | ``` |
| 356 | |
| 357 | - [promql/rate](checks/promql/rate.md) will now report a warning if it detects a `rate(sum(...))` |
| 358 | but doesn't have metadata to confirm if `...` is a counter or not. |
| 359 | |
| 360 | ## v0.67.3 |
| 361 | |
| 362 | ### Fixed |
| 363 | |
| 364 | - Fixed a crash when parsing `vector()` calls with non-number arguments. |
| 365 | |
| 366 | ## v0.67.2 |
| 367 | |
| 368 | ### Fixed |
| 369 | |
| 370 | - Improved the accuracy of [alerts/template](checks/alerts/template.md) check. |
| 371 | |
| 372 | ## v0.67.1 |
| 373 | |
| 374 | ### Fixed |
| 375 | |
| 376 | - Improved message formatting in the [alerts/template](checks/alerts/template.md) check. |
| 377 | - Fixed problem reports for multi line queries. |
| 378 | |
| 379 | ## v0.67.0 |
| 380 | |
| 381 | ### Added |
| 382 | |
| 383 | - Added `--checkstyle` flag to `pint lint` & `pint ci` for writing XML report file |
| 384 | in `checkstyle` format - [#1129](https://github.com/cloudflare/pint/pull/1129). |
| 385 | - Added `--json` flag to both `pint lint` and `pint ci` commands, this enables writing a JSON file |
| 386 | with the report of all problems [#606](https://github.com/cloudflare/pint/issues/606). |
| 387 | - [promql/fragile](checks/promql/fragile.md) will now warn when alerting rules are using |
| 388 | one of the aggregation operation that can return different series on every evaluation, |
| 389 | which can cause alert floppiness - [#820](https://github.com/cloudflare/pint/issues/820). |
| 390 | - [promql/regexp](checks/promql/regexp.md) check now supports extra configuration options |
| 391 | to disable reports on smelly selector - [#1096](https://github.com/cloudflare/pint/issues/1096). |
| 392 | - Checks can be enabled or disabled specifically for some Prometheus rules via `rule {}` config blocks. |
| 393 | Adding `enable` or `disable` option with a list of checks names allows to selectively enable or disable |
| 394 | checks only for Prometheus rules that match given `rule {}` definition. |
| 395 | Enabling checks only for matching rules will only work if these checks are disabled globally via |
| 396 | `check { disabled = [] }` config block. |
| 397 | For example to disable `promql/rate` check for all rules except alerting rules in the `rules/critical` folder: |
| 398 | |
| 399 | ```js |
| 400 | checks { |
| 401 | // This will disable promql/rate by default. |
| 402 | disabled = [ "promql/rate" ] |
| 403 | } |
| 404 | rule { |
| 405 | match { |
| 406 | path = "rules/critical/.*" |
| 407 | kind = "alerting" |
| 408 | } |
| 409 | // This will enable promql/rate only for Prometheus rules matching all our match conditions above. |
| 410 | enable = [ "promql/rate" ] |
| 411 | } |
| 412 | ``` |
| 413 | |
| 414 | ### Changed |
| 415 | |
| 416 | - [alerts/template](checks/alerts/template.md) check was refactored and will now produce more accurate results. |
| 417 | Messages produced by this check might include details of the PromQL query fragment causing the problem |
| 418 | if the query is complex enough. |
| 419 | |
| 420 | ### Fixed |
| 421 | |
| 422 | - Don't try to create GitLab comments on unmodified lines - [#1147](https://github.com/cloudflare/pint/pull/1147). |
| 423 | |
| 424 | ## v0.66.1 |
| 425 | |
| 426 | ### Fixed |
| 427 | |
| 428 | - Fixed message formatting in the [promql/series](checks/promql/series.md) check. |
| 429 | |
| 430 | ## v0.66.0 |
| 431 | |
| 432 | ### Added |
| 433 | |
| 434 | - Added `fallbackTimeout` option to the [promql/series](checks/promql/series.md) check |
| 435 | that controls how much time pint can spend checking other Prometheus servers for missing |
| 436 | metrics. |
| 437 | |
| 438 | ### Fixed |
| 439 | |
| 440 | - Reverted `Fixed colored output on some environments - #1106` change |
| 441 | as it was breaking GitHub report comments. |
| 442 | - Fixed panics in [rule/duplicate](checks/rule/duplicate.md) check. |
| 443 | |
| 444 | ## v0.65.3 |
| 445 | |
| 446 | ### Fixed |
| 447 | |
| 448 | - Fixed GitHub actions permissions. |
| 449 | |
| 450 | ## v0.65.2 |
| 451 | |
| 452 | ### Fixed |
| 453 | |
| 454 | - Improved accuracy of the [rule/duplicate](checks/rule/duplicate.md) check. |
| 455 | - Fixed GitHub reporter trying to create pull request comments to unmodified lines - #1120. |
| 456 | - Fixed colored output on some environments - #1106. |
| 457 | - Show correct line number when reporting YAML syntax errors. |
| 458 | |
| 459 | ## v0.65.1 |
| 460 | |
| 461 | ### Fixed |
| 462 | |
| 463 | - Fixed a bug in `match` block `state` handling that caused all rules to always match any state. |
| 464 | |
| 465 | ## v0.65.0 |
| 466 | |
| 467 | ### Added |
| 468 | |
| 469 | - [promql/regexp](checks/promql/regexp.md) check will now look for smelly regexp selectors. |
| 470 | See check docs for details. |
| 471 | - [promql/range_query](checks/promql/range_query.md) now allows to configure a custom maximum |
| 472 | duration for range queries - #1064. |
| 473 | - Added `--enabled` flag to the pint command. Passing this flag will only run selected check(s). |
| 474 | - Added `state` option to the rule `match` block. See [configuration](configuration.md) docs for details. |
| 475 | |
| 476 | ### Fixed |
| 477 | |
| 478 | - Don't try to report problem on unmodified files when using GitHub reporter. |
| 479 | - If there is a pint config file present then pint will now always add it to the `parser` block `exclude` list. |
| 480 | This is to avoid trying to parse it as a rule file if it's included in the same folder as rules. |
| 481 | |
| 482 | ## v0.64.1 |
| 483 | |
| 484 | ### Fixed |
| 485 | |
| 486 | - Validate `ignoreLabelsValue` option values in the pint config. |
| 487 | |
| 488 | ## v0.64.0 |
| 489 | |
| 490 | ### Added |
| 491 | |
| 492 | - Added `ignoreLabelsValue` to [promql/series](checks/promql/series.md) check settings. |
| 493 | - Added `include` & `exclude` options were moved from the `ci` to the `parser` configuration block. |
| 494 | They now apply to all pint commands, not just `pint ci` - #631. |
| 495 | |
| 496 | ## v0.63.0 |
| 497 | |
| 498 | ### Added |
| 499 | |
| 500 | - Added [alerts/absent](checks/alerts/absent.md) check. |
| 501 | - Added [rule/name](checks/rule/name.md) check - #1020. |
| 502 | |
| 503 | ### Changed |
| 504 | |
| 505 | - [promql/vector_matching](checks/promql/vector_matching.md) will now report more details, including which Prometheus server reports problems and which part of the query is the issue. |
| 506 | - GitHub report code was refactored, it should behave as before. |
| 507 | - When running `pint ci` pint will now run all checks on unmodified rules when a `file/disable` comment was removed. |
| 508 | |
| 509 | ### Fixed |
| 510 | |
| 511 | - Fixed false positive warnings from [alerts/comparison](checks/alerts/comparison.md) when using `absent_over_time()`. |
| 512 | - GitHub reporter will now wait before making more requests if it's rate limited - #699. |
| 513 | |
| 514 | ## v0.62.2 |
| 515 | |
| 516 | ### Fixed |
| 517 | |
| 518 | - When using BitBucket reporter `pint ci` might create a comment longer than the limit allowed by BitBucket. |
| 519 | To avoid this pint will now truncate long comments. |
| 520 | |
| 521 | ## v0.62.1 |
| 522 | |
| 523 | ### Fixed |
| 524 | |
| 525 | - Fixed false positive warnings from [rule/dependency](checks/rule/dependency.md) check. |
| 526 | |
| 527 | ## v0.62.0 |
| 528 | |
| 529 | ### Added |
| 530 | |
| 531 | - [promql/series](checks/promql/series.md) check will now generate warnings if there are `# pint disable` |
| 532 | or `# pint rule/set` comments that are not matching any valid query selector or Prometheus server. |
| 533 | |
| 534 | ### Fixed |
| 535 | |
| 536 | - [promql/series](checks/promql/series.md) will now parse `rule/set` comments that target specific |
| 537 | time series selectors in PromQL the same way as `# pint disable` comments do. |
| 538 | |
| 539 | ## v0.61.2 |
| 540 | |
| 541 | ### Fixed |
| 542 | |
| 543 | - Fixed false positive reports about removed rules when running `pint ci` on a branch that |
| 544 | contains YAML syntax errors. |
| 545 | |
| 546 | ## v0.61.1 |
| 547 | |
| 548 | ### Fixed |
| 549 | |
| 550 | - Fixed release workflow on GitHub. |
| 551 | |
| 552 | ## v0.61.0 |
| 553 | |
| 554 | ### Fixed |
| 555 | |
| 556 | - Don't suggest using `humanize` when alert template is already using printf on format the `$value`. |
| 557 | - Fixed git history parsing when running `pint ci` on a branch that include merge commits. |
| 558 | |
| 559 | ### Changed |
| 560 | |
| 561 | - Refactored YAML syntax checks to avoid using [rulefmt.Parse](https://pkg.go.dev/github.com/prometheus/prometheus@v0.53.0/model/rulefmt#Parse) and effectively parsing rules twice. Some error messages will have different formatting. |
| 562 | |
| 563 | ## v0.60.0 |
| 564 | |
| 565 | ### Fixed |
| 566 | |
| 567 | - [alerts/annotations](checks/alerts/annotation.md) and [rule/label](checks/rule/label.md) will |
| 568 | now report when a label or annotation is required but set to an empty value. |
| 569 | - Fixed handling of `# pint ignore/line` comments on line including multiple `#` characters. |
| 570 | - When reporting problems all messages will now use `publicURI` from each `prometheus` definition. |
| 571 | |
| 572 | ## v0.59.0 |
| 573 | |
| 574 | ### Added |
| 575 | |
| 576 | - Added GitLab support when running `pint ci`. |
| 577 | |
| 578 | ### Changed |
| 579 | |
| 580 | - Reduced severity of problems reported by [promql/counter](checks/promql/counter.md) due |
| 581 | to high number of false positives. It will now report warnings instead of errors. |
| 582 | |
| 583 | ### Fixed |
| 584 | |
| 585 | - Fixed false positive reports from [rule/duplicate](checks/rule/duplicate.md) when a rule file |
| 586 | is being deleted and the rules are moved to a different file. |
| 587 | |
| 588 | ## v0.58.1 |
| 589 | |
| 590 | ### Fixed |
| 591 | |
| 592 | - Correctly handle default Prometheus retention value in [promql/range_query](checks/promql/range_query.md) |
| 593 | check - #958. |
| 594 | |
| 595 | ## v0.58.0 |
| 596 | |
| 597 | ### Fixed |
| 598 | |
| 599 | - Fixed false positives from [rule/duplicate](checks/rule/duplicate.md) check |
| 600 | when running `pint ci` on files that are both edited and renamed in the same PR. |
| 601 | - [rule/dependency](checks/rule/dependency.md) will no longer report removed symlinks. |
| 602 | |
| 603 | ## v0.57.3 |
| 604 | |
| 605 | ### Fixed |
| 606 | |
| 607 | - Fixed compatibility with older git releases. |
| 608 | - Fixed `maxComments` defaulting to zero when using GitHub reporter. |
| 609 | - Fixed `maxComments` comment creation on GitHub - #935. |
| 610 | |
| 611 | ## v0.57.2 |
| 612 | |
| 613 | ### Fixed |
| 614 | |
| 615 | - Fixed release workflow on GitHub actions. |
| 616 | |
| 617 | ## v0.57.0 |
| 618 | |
| 619 | ### Added |
| 620 | |
| 621 | - GitHub and BitBucket reporters now supports `maxComments` option to limit the number |
| 622 | of comments pint can create on a single pull request. |
| 623 | Default value of `maxComments` is `50`. |
| 624 | |
| 625 | ## v0.56.2 |
| 626 | |
| 627 | ### Fixed |
| 628 | |
| 629 | - [query/cost](checks/query/cost.md) will now only create reports if a query is more |
| 630 | expensive than any of the configured limits. |
| 631 | - Fixed duplicated reports when using BitBucket reporter. |
| 632 | |
| 633 | ## v0.56.1 |
| 634 | |
| 635 | ### Fixed |
| 636 | |
| 637 | - [promql/counter](checks/promql/counter.md) check will now consider a metric |
| 638 | to be a counter only if all metadata entries for it use `TYPE counter`. |
| 639 | Previously it would check for at least one metadata entry with `TYPE counter`. |
| 640 | |
| 641 | ## v0.56.0 |
| 642 | |
| 643 | ### Added |
| 644 | |
| 645 | - Added [promql/counter](checks/promql/counter.md) check - #655. |
| 646 | - Check using custom rules now accept an optional `comment` option for adding |
| 647 | a text comment to all reported problems. |
| 648 | Checks supporting `comment` option: |
| 649 | - [alerts/annotation](checks/alerts/annotation.md) |
| 650 | - [alerts/count](checks/alerts/count.md) |
| 651 | - [promql/aggregate](checks/promql/aggregate.md) |
| 652 | - [query/cost](checks/query/cost.md) |
| 653 | - [rule/for](checks/rule/for.md) |
| 654 | - [rule/label](checks/rule/label.md) |
| 655 | - [rule/link](checks/rule/link.md) |
| 656 | - [rule/reject](checks/rule/reject.md) |
| 657 | Example: |
| 658 | |
| 659 | ```js |
| 660 | for { |
| 661 | comment = "All alert rules must have `for: 5m` (or more) to avoid flaky alerts." |
| 662 | severity = "bug" |
| 663 | min = "5m" |
| 664 | } |
| 665 | ``` |
| 666 | |
| 667 | ## v0.55.0 |
| 668 | |
| 669 | ### Added |
| 670 | |
| 671 | - [labels/conflict](checks/labels/conflict.md) check will now warn if alerting |
| 672 | rule is setting labels that are already configured as external labels. |
| 673 | |
| 674 | ### Changed |
| 675 | |
| 676 | - `pint watch` command now has two sub-commands: `pint watch glob` and `pint watch rule_files`. |
| 677 | See [watch mode](index.md#watch-mode) docs for details. |
| 678 | - [promql/series](checks/promql/series.md) check will now ignore missing metrics if the |
| 679 | query uses a fallback with `or vector(1)`. This will reduce the number of reported |
| 680 | missing metrics for queries where the intention is to accept and ignore missing |
| 681 | metrics. |
| 682 | Example of a rule that will no longer report problems: |
| 683 | |
| 684 | ```yaml |
| 685 | - alert: Foo |
| 686 | expr: sum(my_metric or vector(0)) > 1 |
| 687 | ``` |
| 688 | |
| 689 | ### Fixed |
| 690 | |
| 691 | - Fixed false positive reports from [rule/duplicate](checks/rule/duplicate.md) when |
| 692 | using symlinks. |
| 693 | - Fixed support for multi-document YAML files when using relaxed parsed mode - #746. |
| 694 | |
| 695 | ## v0.54.0 |
| 696 | |
| 697 | ### Added |
| 698 | |
| 699 | - [rule/dependency](checks/rule/dependency.md) check will now warn if an alerting rule |
| 700 | that's being removed in a pull request is being used inside `ALERTS{alertname="..."}` |
| 701 | or `ALERTS_FOR_STATE{alertname="..."}` queries. |
| 702 | - pint will now perform extra validation of YAML files to ensure that all values |
| 703 | are mappings and strings. |
| 704 | This will error on rules where, for example, label value is unquoted number: |
| 705 | |
| 706 | Bad rule: |
| 707 | |
| 708 | ```yaml |
| 709 | - alert: DeadMansSwitch |
| 710 | expr: vector(1) |
| 711 | labels: |
| 712 | priority: 5 |
| 713 | ``` |
| 714 | |
| 715 | Good rule: |
| 716 | |
| 717 | ```yaml |
| 718 | - alert: DeadMansSwitch |
| 719 | expr: vector(1) |
| 720 | labels: |
| 721 | priority: "5" |
| 722 | ``` |
| 723 | |
| 724 | ### Changed |
| 725 | |
| 726 | - A large part of rule parsing code was refactored and more problems will now be deduplicated. |
| 727 | - Improved validation of labels and annotations. |
| 728 | |
| 729 | ## v0.53.0 |
| 730 | |
| 731 | ### Added |
| 732 | |
| 733 | - pint will now report any comment that looks like a [pint control comment](./ignoring.md) |
| 734 | but cannot be parsed correctly. |
| 735 | |
| 736 | ### Fixed |
| 737 | |
| 738 | - Fixed a crash when running `pint ci` and using `ignore/file` comments. |
| 739 | |
| 740 | ## v0.52.0 |
| 741 | |
| 742 | ### Added |
| 743 | |
| 744 | - Both [alerts/annotation](checks/alerts/annotation.md) and [rule/label](checks/rule/label.md) |
| 745 | now support more advance validation of label and annotation values with extra `token` option. |
| 746 | In addition to the `value` regexp matching you can also validate values against a static |
| 747 | list of allowed values using new `values` option. |
| 748 | See both checks documentation for detail. |
| 749 | |
| 750 | ### Changed |
| 751 | |
| 752 | - More reports will now be merged into a single comments when using BitBucket. |
| 753 | |
| 754 | ### Fixed |
| 755 | |
| 756 | - Fixed YAML anchor parsing. |
| 757 | - Fixed regexp matching for label names in [rule/label](checks/rule/label.md). |
| 758 | |
| 759 | ## v0.51.1 |
| 760 | |
| 761 | ### Fixed |
| 762 | |
| 763 | - Fixed a few bugs in control comment parsing code. |
| 764 | - BitBucket tasks were not marked as resolved correctly. |
| 765 | |
| 766 | ## v0.51.0 |
| 767 | |
| 768 | ### Added |
| 769 | |
| 770 | - Added [rule/dependency](checks/rule/dependency.md) check. |
| 771 | |
| 772 | ### Changed |
| 773 | |
| 774 | - When running `pint ci` pint will now first try to parse all files in current |
| 775 | working directory, before checking for files modified on current branch. |
| 776 | This is to have a full list of all rules, which is needed for checks like |
| 777 | newly added [rule/dependency](checks/rule/dependency.md). |
| 778 | This can slow `pint` runs if there's a lot of files in your repository. |
| 779 | If there are non-rule files these may fail to parse and result in check errors. |
| 780 | To avoid any errors or slowdowns from scanning unrelated files you might need |
| 781 | to add `ci` section to `.pint.hcl` with `include` and/or `exclude` options set. |
| 782 | See [examples/ci.hcl](examples/ci.hcl) for an example config. |
| 783 | - `Bug` and `Fatal` severity problems are now reported as tasks when using |
| 784 | BitBucket. |
| 785 | - [promql/regexp](checks/promql/regexp.md) will now check for more problems |
| 786 | with vector selectors. |
| 787 | |
| 788 | ### Fixed |
| 789 | |
| 790 | - `pint` will no longer run dynamic Prometheus discovery when `--offline` flag |
| 791 | is passed. |
| 792 | |
| 793 | ## v0.50.1 |
| 794 | |
| 795 | ### Fixed |
| 796 | |
| 797 | - Fixed alert preview link on `alerts/count` reports. |
| 798 | |
| 799 | ## v0.50.0 |
| 800 | |
| 801 | ### Changed |
| 802 | |
| 803 | - `pint ci` now uses a new logic for deciding which rules have changed when validating |
| 804 | pull requests. Changes that would previously be invisible to pint, like modifying |
| 805 | comments or moving the entire rules file, will now trigger checks for affected |
| 806 | rules. |
| 807 | - pint will now try to create fewer BitBucket comments by merging multiple |
| 808 | problem reports into a single comment. |
| 809 | - Control comment handling code was refactored, there are some additional rules |
| 810 | that comment must follow. See `Control comments` section in [pint docs](./index.md). |
| 811 | |
| 812 | ## v0.49.2 |
| 813 | |
| 814 | ### Fixed |
| 815 | |
| 816 | - Fixed false positive reports from `promql/regexp` - #782. |
| 817 | - `Information` level reports using BitBucket were using wrong comment icon. |
| 818 | |
| 819 | ## v0.49.1 |
| 820 | |
| 821 | ### Fixed |
| 822 | |
| 823 | - `alerts/count` check wasn't using `uptime` field from `prometheus` config blocks |
| 824 | for metric gap detection. |
| 825 | |
| 826 | ## v0.49.0 |
| 827 | |
| 828 | ### Added |
| 829 | |
| 830 | - Added [alerts/external_labels](checks/alerts/external_labels.md) check. |
| 831 | - Added support for reporting problems to TeamCity using [Service Messages](https://www.jetbrains.com/help/teamcity/service-messages.html). |
| 832 | To enable run it run `pint --teamcity lint` or `pint --teamcity ci`. |
| 833 | - Problems reported to BitBucket and GitHub will now include more details. |
| 834 | - Added `publicURI` field to `prometheus` configuration blocks. |
| 835 | |
| 836 | ### Changed |
| 837 | |
| 838 | - When [promql/series](checks/promql/series.md) finds that a time series used |
| 839 | by a rule is missing it will now also check other defined Prometheus servers |
| 840 | and add that information to the report. |
| 841 | This allows pint to flag rules that are most likely deployed to the wrong servers, |
| 842 | using missing scrape jobs. |
| 843 | - Reporting problems to BitBucket will now use comments instead of annotations. |
| 844 | This is only if there is an open pull request for tested branch, if there is no |
| 845 | open pull request problems will be reported using code insight annotations. |
| 846 | |
| 847 | ## v0.48.2 |
| 848 | |
| 849 | ### Fixed |
| 850 | |
| 851 | - Fixed `pint watch` to correctly work with `discovery`. |
| 852 | |
| 853 | ## v0.48.1 |
| 854 | |
| 855 | - Prometheus `template` under `discovery` block can now template |
| 856 | `include` and `exclude` fields. |
| 857 | |
| 858 | ## v0.48.0 |
| 859 | |
| 860 | ### Added |
| 861 | |
| 862 | - Prometheus servers can now be dynamically configured using one of |
| 863 | supported discovery mechanism: file paths or Prometheus metrics query. |
| 864 | |
| 865 | ## v0.47.0 |
| 866 | |
| 867 | ### Added |
| 868 | |
| 869 | - `alerts/template` check can now report problems with alerting rules |
| 870 | when trying to use templates on a query that doesn't produce any labels |
| 871 | at all. |
| 872 | For example when using [`vector(...)`](https://prometheus.io/docs/prometheus/latest/querying/functions/#vector) function: |
| 873 | |
| 874 | {% raw %} |
| 875 | |
| 876 | ```yaml |
| 877 | - alert: DeadMansSwitch |
| 878 | expr: vector(1) |
| 879 | annotations: |
| 880 | summary: Deadman's switch on {{ $labels.instance }} is firing |
| 881 | ``` |
| 882 | |
| 883 | {% endraw %} |
| 884 | |
| 885 | - `alerts/comparison` check can now warn if alerting rules use a query |
| 886 | with `foo > 0 OR vector(1)`, which would always fire. |
| 887 | - `alerts/template` check will now look check `on(...)` clause on binary |
| 888 | expressions. When `on(...)` is set only labels listed there will appear |
| 889 | on result metrics. |
| 890 | For example `app_type` here cannot appear on query results, even if it's |
| 891 | present on `foo` time series. |
| 892 | |
| 893 | ```yaml |
| 894 | - alert: ... |
| 895 | expr: foo / on (instance, app_name) bar |
| 896 | annotations: |
| 897 | summary: ... {{ $labels.app_type }} ... |
| 898 | ``` |
| 899 | |
| 900 | ## v0.46.0 |
| 901 | |
| 902 | ### Added |
| 903 | |
| 904 | - Added support for `keep_firing_for` in alerting rules - #713. |
| 905 | - Added `rule/keep_firing_for` check - #713. |
| 906 | - Added `alerts/count` check will now estimate alerts using |
| 907 | `keep_firing_for` field if set - #713. |
| 908 | - Configuration rule `match` block supports a new filter `keep_firing_for`. |
| 909 | |
| 910 | ## v0.45.0 |
| 911 | |
| 912 | ### Added |
| 913 | |
| 914 | - The `query/cost` check can now use Prometheus query stats to verify query |
| 915 | evaluation time and the number of samples used by a query. See |
| 916 | [query/cost](checks/query/cost.md) docs for details. |
| 917 | |
| 918 | ## v0.44.2 |
| 919 | |
| 920 | ### Fixed |
| 921 | |
| 922 | - Fixed a crash in `promql/series` check when Prometheus instance becomes |
| 923 | unavailable - #682. |
| 924 | - Fixed false positive reports in `alerts/template` check - #681. |
| 925 | |
| 926 | ## v0.44.1 |
| 927 | |
| 928 | ### Fixed |
| 929 | |
| 930 | - Rule names were not checked for correctly, allowing for rules with empty names |
| 931 | to pass checks. |
| 932 | - Fixed GitHub annotations being added to unmodified lines - #645. |
| 933 | |
| 934 | ## v0.44.0 |
| 935 | |
| 936 | ### Added |
| 937 | |
| 938 | - Added `exclude` option to `ci` config block - #609. |
| 939 | - Added `minCount` & `severity` to `alerts/count` check - #612. |
| 940 | This allows to only show estimated alerts count only if there would be high |
| 941 | enough (`>= minCount`) number of alerts. |
| 942 | Setting `severity` as well allows to block rules that would create too many alerts. |
| 943 | - GitHub reporter will now included folded list of all problems in the summary |
| 944 | comment - #608. |
| 945 | |
| 946 | ### Fixed |
| 947 | |
| 948 | - Fixed `alerts/annotation` check regexp matching - #613. |
| 949 | - When running `pint ci` using GitHub integration annotation comments are now |
| 950 | reported only on modified lines - #640. |
| 951 | |
| 952 | ## v0.43.1 |
| 953 | |
| 954 | ### Fixed |
| 955 | |
| 956 | - Fixed `--base-branch` flag handling when branch name contains `/`. |
| 957 | |
| 958 | ## v0.43.0 |
| 959 | |
| 960 | ### Added |
| 961 | |
| 962 | - Added `--fail-on` flag to `pint lint` command - #570. |
| 963 | - Added `tls` section to `prometheus` configuration block - #540. |
| 964 | |
| 965 | ### Changed |
| 966 | |
| 967 | - If a query run by pint fails because it was too expensive too run it will |
| 968 | now be reported as a warning instead of an error. |
| 969 | |
| 970 | ### Fixed |
| 971 | |
| 972 | - When validating queries using `{__name__=~"...", foo="bar"}` selectors pint could end up |
| 973 | running queries matching a single label, like `count({foo="bar"})`, which could return too many |
| 974 | results. This version ensures that queries always include name matcher to avoid that. |
| 975 | |
| 976 | ## v0.42.2 |
| 977 | |
| 978 | ### Fixed |
| 979 | |
| 980 | - `alerts/template` check didn't correctly handle `label_replace()` calls |
| 981 | in queries - #568. |
| 982 | |
| 983 | ## v0.42.1 |
| 984 | |
| 985 | ### Fixed |
| 986 | |
| 987 | - Fixed `--base-branch` flag handling. |
| 988 | Value of this flag wasn't being used correctly - #559. |
| 989 | |
| 990 | ## v0.42.0 |
| 991 | |
| 992 | ### Fixed |
| 993 | |
| 994 | - Fixed incorrect results in `promql/series` check for time series with only a single |
| 995 | data point. |
| 996 | |
| 997 | ## v0.41.1 |
| 998 | |
| 999 | ### Fixed |
| 1000 | |
| 1001 | - Fixed parsing of alert `for` field values with long durations (`for: 1d`). |
| 1002 | |
| 1003 | ## v0.41.0 |
| 1004 | |
| 1005 | ### Added |
| 1006 | |
| 1007 | - Added `--fail-on` flag to `pint ci` command - #525. |
| 1008 | - [promql/rate](checks/promql/rate.md) will now look for queries that call |
| 1009 | `rate()` on results of `sum(counter)` via recording rules. |
| 1010 | Example: |
| 1011 | |
| 1012 | ```yaml |
| 1013 | - record: my:sum |
| 1014 | expr: sum(http_requests_total) |
| 1015 | |
| 1016 | - alert: my alert |
| 1017 | expr: rate(my:sum[5m]) |
| 1018 | ``` |
| 1019 | |
| 1020 | - Added [rule/for](checks/rule/for.md) check. |
| 1021 | - Added `owners` configuration block for setting the list of allowed rule owner values. |
| 1022 | See [configuration](configuration.md) for details. |
| 1023 | |
| 1024 | ### Changed |
| 1025 | |
| 1026 | - `pint lint` output will now include severity level as a text label - #524. |
| 1027 | |
| 1028 | ## v0.40.1 |
| 1029 | |
| 1030 | ### Fixed |
| 1031 | |
| 1032 | - Fixed a bug in `pint ci` that would cause a failure if a directory was renamed. |
| 1033 | - Fixed false positive reports from `promql/series` check when a time series |
| 1034 | disappears from Prometheus. |
| 1035 | - Fixed Prometheus flags parsing in `promql/range_query` check. |
| 1036 | |
| 1037 | ## v0.40.0 |
| 1038 | |
| 1039 | ### Added |
| 1040 | |
| 1041 | - Allow snoozing checks for entire file using `# pint file/snooze ...` comments. |
| 1042 | - Added `lookbackRange` and `lookbackStep` configuration option to the |
| 1043 | [promql/series](checks/promql/series.md) check - #493. |
| 1044 | |
| 1045 | ### Changed |
| 1046 | |
| 1047 | - Reverted GitHub integration to use [Pull Request Review](https://docs.github.com/en/rest/pulls/reviews) |
| 1048 | API - #490. |
| 1049 | |
| 1050 | ## v0.39.0 |
| 1051 | |
| 1052 | ### Changed |
| 1053 | |
| 1054 | - GitHub integration now uses [Check Runs](https://docs.github.com/en/rest/checks/runs) API - #478. |
| 1055 | |
| 1056 | ## v0.38.1 |
| 1057 | |
| 1058 | ### Fixed |
| 1059 | |
| 1060 | - `# pint file/disable` comments didn't properly handle Prometheus tags, this is fixed now. |
| 1061 | |
| 1062 | ## v0.38.0 |
| 1063 | |
| 1064 | ### Added |
| 1065 | |
| 1066 | - `prometheus` configuration blocks now accepts `tags` field with a list of tags. |
| 1067 | Tags can be used to disable or snooze specific checks on all Prometheus instances |
| 1068 | with that tag. |
| 1069 | See [ignoring](ignoring.md) for details. |
| 1070 | |
| 1071 | ## v0.37.0 |
| 1072 | |
| 1073 | ### Added |
| 1074 | |
| 1075 | - Added `pint_rule_file_owner` metric. |
| 1076 | |
| 1077 | ## v0.36.0 |
| 1078 | |
| 1079 | ### Added |
| 1080 | |
| 1081 | - Added ability to expand environment variables in pint configuration file. |
| 1082 | See [configuration](configuration.md) for details. |
| 1083 | |
| 1084 | ## v0.35.0 |
| 1085 | |
| 1086 | ### Added |
| 1087 | |
| 1088 | - Use [uber-go/automaxprocs](https://github.com/uber-go/automaxprocs) to |
| 1089 | automatically set GOMAXPROCS to match Linux container CPU quota. |
| 1090 | - Added [labels/conflict](checks/labels/conflict.md) check. |
| 1091 | - If you want to disable individual checks just for some time then you can now |
| 1092 | snooze them instead of disabling forever. |
| 1093 | |
| 1094 | The difference between `# pint disable ...` and `# pint snooze ...` comments is that |
| 1095 | the snooze comment must include a timestamp. Selected check will be disabled _until_ |
| 1096 | that timestamp. |
| 1097 | Timestamp must either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) syntax |
| 1098 | or `YYYY-MM-DD` (if you don't care about time and want to snooze until given date). |
| 1099 | Examples: |
| 1100 | |
| 1101 | ```yaml |
| 1102 | # pint snooze 2023-01-12T10:00:00Z promql/series |
| 1103 | # pint snooze 2023-01-12 promql/rate |
| 1104 | - record: ... |
| 1105 | expr: ... |
| 1106 | ``` |
| 1107 | |
| 1108 | ### Changed |
| 1109 | |
| 1110 | - Removed `cache` option from `prometheus` config blocks. Query cache will now auto-size itself |
| 1111 | as needed. |
| 1112 | |
| 1113 | If you have a config entry with `cache` option, example: |
| 1114 | |
| 1115 | ```javascript |
| 1116 | prometheus "prod" { |
| 1117 | uri = "https://prometheus.example.com" |
| 1118 | cache = 20000 |
| 1119 | } |
| 1120 | ``` |
| 1121 | |
| 1122 | Then pint will fail to start. To fix this simply remove the `cache` option: |
| 1123 | |
| 1124 | ```javascript |
| 1125 | prometheus "prod" { |
| 1126 | uri = "https://prometheus.example.com" |
| 1127 | } |
| 1128 | ``` |
| 1129 | |
| 1130 | ## v0.34.0 |
| 1131 | |
| 1132 | ### Added |
| 1133 | |
| 1134 | - Added [rule/duplicate](checks/rule/duplicate.md) check. |
| 1135 | |
| 1136 | ## v0.33.1 |
| 1137 | |
| 1138 | ### Fixed |
| 1139 | |
| 1140 | - Fixed a regression causing poor query cache hit rate. |
| 1141 | |
| 1142 | ## v0.33.0 |
| 1143 | |
| 1144 | ### Added |
| 1145 | |
| 1146 | - Added `uptime` field in `prometheus` configuration block. |
| 1147 | This field can be used to set a custom metric used for Prometheus uptime checks |
| 1148 | and by default uses `up` metric. |
| 1149 | If you have a Prometheus with a large number of scrape targets there might |
| 1150 | be a huge number of `up` time series making those uptime checks slow to run. |
| 1151 | If your Prometheus is configured to scrape itself, then you most likely want to use |
| 1152 | one of metrics exported by Prometheus, like `prometheus_build_info`: |
| 1153 | |
| 1154 | ```javascript |
| 1155 | prometheus "prod" { |
| 1156 | uri = "https://prometheus.example.com" |
| 1157 | uptime = "prometheus_build_info" |
| 1158 | } |
| 1159 | ``` |
| 1160 | |
| 1161 | ### Changed |
| 1162 | |
| 1163 | - Refactored some queries used by [promql/series](checks/promql/series.md) check to |
| 1164 | avoid sending queries that might be very slow and/or return a huge amount of data. |
| 1165 | - Prometheus query cache now takes into account the size of cached response. |
| 1166 | This makes memory usage needed for query cache more predictable. |
| 1167 | As a result the `cache` option for `prometheus` config block now means |
| 1168 | `the number of time series cached` instead of `the number of responses cached` |
| 1169 | and the default for this option is now `50000`. |
| 1170 | |
| 1171 | ## v0.32.1 |
| 1172 | |
| 1173 | ### Fixed |
| 1174 | |
| 1175 | - [promql/vector_matching](checks/promql/vector_matching.md) was sending expensive |
| 1176 | queries resulting in high memory usage, this is now fixed. |
| 1177 | |
| 1178 | ## v0.32.0 |
| 1179 | |
| 1180 | ### Added |
| 1181 | |
| 1182 | - Added `pint_prometheus_cache_evictions_total` metric tracking the number of times |
| 1183 | cache results were evicted from query cache. |
| 1184 | - Allow disabling individual checks for the entire file using |
| 1185 | `# pint file/disable ...` comments. |
| 1186 | |
| 1187 | ### Changed |
| 1188 | |
| 1189 | - Refactored query cache to only store queries that are requested more than once. |
| 1190 | This will avoid storing big responses that are never requested from the cache. |
| 1191 | |
| 1192 | ### Fixed |
| 1193 | |
| 1194 | - Config validation will now check for duplicated `prometheus` block names. |
| 1195 | |
| 1196 | ## v0.31.1 |
| 1197 | |
| 1198 | ### Fixed |
| 1199 | |
| 1200 | - Fixed performance regression slowing down `pint watch` over time. |
| 1201 | |
| 1202 | ## v0.31.0 |
| 1203 | |
| 1204 | ### Added |
| 1205 | |
| 1206 | - `prometheus` configuration block now accepts optional `headers` field, for setting |
| 1207 | request headers that will be attached to any request made to given Prometheus server. |
| 1208 | Example: |
| 1209 | |
| 1210 | ```javascript |
| 1211 | prometheus "protected" { |
| 1212 | uri = "https://prod.example.com" |
| 1213 | headers = { |
| 1214 | "X-Auth": "secret", |
| 1215 | "X-User": "bob" |
| 1216 | } |
| 1217 | ``` |
| 1218 | |
| 1219 | ### Changed |
| 1220 | |
| 1221 | - Prometheus range query handling was rewritten to improve memory usage |
| 1222 | caused by queries returning huge number of results. |
| 1223 | As a result pint should use up to 5x less memory. |
| 1224 | |
| 1225 | ### Fixed |
| 1226 | |
| 1227 | - Fixed false positive reports in [promql/vector_matching](checks/promql/vector_matching.md) |
| 1228 | for rules using `on(...)`. Example: |
| 1229 | |
| 1230 | ```yaml |
| 1231 | sum(foo) without(instance) * on(app_name) group_left() bar |
| 1232 | ``` |
| 1233 | |
| 1234 | - Don't log passwords when Prometheus URI is using basic authentication. |
| 1235 | - Fixed false positive reports in [alerts/template](checks/alerts/template.md) |
| 1236 | suggesting to use `humanize` on queries that already use `round()`. |
| 1237 | - Fixed false positive reports in [alerts/comparison](checks/alerts/comparison.md) |
| 1238 | when `bool` modifier is used on a condition that is guarded by another condition. |
| 1239 | Example: |
| 1240 | |
| 1241 | ```yaml |
| 1242 | alert: Foo |
| 1243 | expr: (foo > 1) > bool 1 |
| 1244 | ``` |
| 1245 | |
| 1246 | - Fixed false positive reports in [alerts/template](checks/alerts/template.md) |
| 1247 | warning about labels removed in a query despite being re-added by a join. |
| 1248 | |
| 1249 | ## v0.30.2 |
| 1250 | |
| 1251 | ### Fixed |
| 1252 | |
| 1253 | - Fixed incorrect line number reporting on BitBucket annotations. |
| 1254 | |
| 1255 | ## v0.30.1 |
| 1256 | |
| 1257 | ### Fixed |
| 1258 | |
| 1259 | - Fixed handling of symlinks when running `pint lint` and `pint watch` commands. |
| 1260 | |
| 1261 | ## v0.30.0 |
| 1262 | |
| 1263 | ### Added |
| 1264 | |
| 1265 | - BitBucket only allows for annotations on modified lines, so when a high severity problem |
| 1266 | is reported on unmodified line pint will move that annotation to the first modified line, |
| 1267 | so it's still visible in BitBucket. |
| 1268 | Now pint will also add a note to that annotation to make it clear that the problem is really |
| 1269 | on a different line. |
| 1270 | - [alerts/template](checks/alerts/template.md) will now run extra checks to validate syntax |
| 1271 | of queries executed from within alerting rule templates. |
| 1272 | |
| 1273 | Example template using `sum(xxx` query that's missing closing `)`: |
| 1274 | |
| 1275 | {% raw %} |
| 1276 | |
| 1277 | ```yaml |
| 1278 | - alert: ... |
| 1279 | expr: ... |
| 1280 | annotations: |
| 1281 | summary: | |
| 1282 | {{ with query "sum(xxx" }} |
| 1283 | {{ . | first | value | humanize }} |
| 1284 | {{ end }} |
| 1285 | ``` |
| 1286 | |
| 1287 | {% endraw %} |
| 1288 | |
| 1289 | - If a file is ignored pint will now note that using `Information` level annotation. |
| 1290 | This will make it more obvious that a CI check passed because pint didn't run any |
| 1291 | checks due to file being excluded. |
| 1292 | |
| 1293 | ### Changed |
| 1294 | |
| 1295 | - Prometheus rule files can be symlinked between directories. |
| 1296 | If the symlink source and target files are in a different directory they can |
| 1297 | end up querying different Prometheus server when running ping checks. |
| 1298 | This means that when modifying symlink target file checks must be executed against |
| 1299 | both symlink source and target. |
| 1300 | Until now pint was ignoring symlinks but starting with this release it will try to |
| 1301 | follow them. This means that if you modify a file that has symlinks pointing to them |
| 1302 | pint will try run checks against those symlinks too. |
| 1303 | |
| 1304 | **NOTE**: pint can only detect and check symlinks if they are located in the current |
| 1305 | working directory (as seen by running pint process) or its sub-directories. |
| 1306 | |
| 1307 | ### Fixed |
| 1308 | |
| 1309 | - Fixed a regression in [promql/vector_matching](checks/promql/vector_matching.md) that |
| 1310 | would cause a panic when parsing function calls with optional arguments. |
| 1311 | |
| 1312 | ## v0.29.4 |
| 1313 | |
| 1314 | ### Fixed |
| 1315 | |
| 1316 | - [promql/vector_matching](checks/promql/vector_matching.md) was incorrectly handling |
| 1317 | queries containing function calls with multiple arguments. |
| 1318 | |
| 1319 | ## v0.29.3 |
| 1320 | |
| 1321 | ### Fixed |
| 1322 | |
| 1323 | - Revert 'Use smaller buffers when decoding Prometheus API responses' change. |
| 1324 | |
| 1325 | ## v0.29.2 |
| 1326 | |
| 1327 | ### Fixed |
| 1328 | |
| 1329 | - Use smaller buffers when decoding Prometheus API responses. |
| 1330 | |
| 1331 | ## v0.29.1 |
| 1332 | |
| 1333 | ### Fixed |
| 1334 | |
| 1335 | - Fixed wrong request formatting for Prometheus metric metadata queries. |
| 1336 | |
| 1337 | ## v0.29.0 |
| 1338 | |
| 1339 | ### Changed |
| 1340 | |
| 1341 | - Switched from using [prometheus/client_golang](https://github.com/prometheus/client_golang) |
| 1342 | API client to streaming JSON library [prymitive/current](https://github.com/prymitive/current) |
| 1343 | |
| 1344 | ### Fixed |
| 1345 | |
| 1346 | - Avoid reporting same issue multiple times in `promql/rate` and `promql/regexp` checks. |
| 1347 | |
| 1348 | ## v0.28.7 |
| 1349 | |
| 1350 | ### Changed |
| 1351 | |
| 1352 | - Updated Prometheus modules to [v2.38.0](https://github.com/prometheus/prometheus/releases/tag/v2.38.0). |
| 1353 | This adds support for `toTime` template function. |
| 1354 | |
| 1355 | ## v0.28.6 |
| 1356 | |
| 1357 | ### Fixed |
| 1358 | |
| 1359 | - Fixed symlink handling when running `pint lint`. |
| 1360 | |
| 1361 | ## v0.28.5 |
| 1362 | |
| 1363 | ### Fixed |
| 1364 | |
| 1365 | - Remove noisy debug logs. |
| 1366 | |
| 1367 | ## v0.28.4 |
| 1368 | |
| 1369 | ### Added |
| 1370 | |
| 1371 | - Added `pint_prometheus_cache_miss_total` metric. |
| 1372 | |
| 1373 | ### Changed |
| 1374 | |
| 1375 | - Reduce log level for `File parsed` messages. |
| 1376 | |
| 1377 | ### Fixed |
| 1378 | |
| 1379 | - Purge expired cache entries faster to reduce memory usage. |
| 1380 | |
| 1381 | ## v0.28.3 |
| 1382 | |
| 1383 | ### Fixed |
| 1384 | |
| 1385 | - Fix `absent()` handling in [alerts/comparison](checks/alerts/comparison.md) #330. |
| 1386 | |
| 1387 | ## v0.28.2 |
| 1388 | |
| 1389 | ### Added |
| 1390 | |
| 1391 | - Added `--min-severity` flag to the `pint lint` command. Default value is set to `warning`. |
| 1392 | |
| 1393 | ### Fixed |
| 1394 | |
| 1395 | - Fix a regression in [promql/vector_matching](checks/promql/vector_matching.md) introduced |
| 1396 | in previous release. |
| 1397 | - Fix [promql/series](checks/promql/series.md) disable comments not working when there |
| 1398 | are multiple comments on a rule. |
| 1399 | - [promql/series](checks/promql/series.md) no longer emits an information message |
| 1400 | `metric is generated by alerts ...`. |
| 1401 | |
| 1402 | ## v0.28.1 |
| 1403 | |
| 1404 | ### Fixed |
| 1405 | |
| 1406 | - Don't use `topk` in [promql/vector_matching](checks/promql/vector_matching.md) check to |
| 1407 | avoid false positives. |
| 1408 | |
| 1409 | ## v0.28.0 |
| 1410 | |
| 1411 | ### Added |
| 1412 | |
| 1413 | - [promql/rate](checks/promql/rate.md) check will now also validate `deriv` function usage. |
| 1414 | - [alerts/annotation](checks/alerts/annotation.md) check will now recommend using one of |
| 1415 | humanize functions if alert query is returning results based on `rate()` and the value |
| 1416 | is used in annotations. |
| 1417 | |
| 1418 | ### Changed |
| 1419 | |
| 1420 | - [promql/series](checks/promql/series.md) check now supports more flexible |
| 1421 | `# pint disable promql/series(...)` comments. |
| 1422 | Adding a comment `# pint disable promql/series({cluster="dev"})` will disable this check |
| 1423 | for any metric selector with `cluster="dev"` matcher. |
| 1424 | - [query/cost](checks/query/cost.md) check will now calculate how much Prometheus memory |
| 1425 | will be needed for storing results of given query. |
| 1426 | `bytesPerSample` option that was previously used to calculate this was removed. |
| 1427 | - `prometheus {}` config block now allows to pass a list of paths to explicitly ignore |
| 1428 | by setting `exclude` option. Existing `paths` option was renamed to `include` for |
| 1429 | consistency. Example migration: |
| 1430 | |
| 1431 | ```javascript |
| 1432 | prometheus "foo" { |
| 1433 | [...] |
| 1434 | paths = [ "rules/.*" ] |
| 1435 | } |
| 1436 | ``` |
| 1437 | |
| 1438 | becomes |
| 1439 | |
| 1440 | ```javascript |
| 1441 | prometheus "foo" { |
| 1442 | [...] |
| 1443 | include = [ "rules/.*" ] |
| 1444 | } |
| 1445 | ``` |
| 1446 | |
| 1447 | ### Fixed |
| 1448 | |
| 1449 | - `pint_last_run_checks` and `pint_last_run_checks_done` were not updated properly. |
| 1450 | |
| 1451 | ## v0.27.0 |
| 1452 | |
| 1453 | ### Added |
| 1454 | |
| 1455 | - Deduplicate reports where possible to avoid showing same issue twice. |
| 1456 | - [rule/link](checks/rule/link.md) check for validating URIs found in alerting rule annotations. |
| 1457 | |
| 1458 | ### Changed |
| 1459 | |
| 1460 | - Add more details to BitBucket CI reports. |
| 1461 | - More compact console output when running `pint lint`. |
| 1462 | |
| 1463 | ## v0.26.0 |
| 1464 | |
| 1465 | ### Added |
| 1466 | |
| 1467 | - [promql/range_query](checks/promql/range_query.md) check. |
| 1468 | |
| 1469 | ### Fixed |
| 1470 | |
| 1471 | - Strict parsing mode shouldn't fail on template errors, those will be later |
| 1472 | reported by `alerts/template` check. |
| 1473 | |
| 1474 | ## v0.25.0 |
| 1475 | |
| 1476 | ### Changed |
| 1477 | |
| 1478 | - All timeout options are now optional. This includes following config blocks: |
| 1479 | - `prometheus { timeout = ... }` |
| 1480 | - `repository { bitbucket { timeout = ... } }` |
| 1481 | - `repository { github { timeout = ... } }` |
| 1482 | - `pint` will now try to discover all repository settings from environment variables |
| 1483 | when run as part of GitHub Actions workflow and so it doesn't need any |
| 1484 | `repository { github { ... } }` configuration block for that anymore. |
| 1485 | Setting `GITHUB_AUTH_TOKEN` is the only requirement for GitHub Actions now. |
| 1486 | |
| 1487 | ## v0.24.1 |
| 1488 | |
| 1489 | ### Fixed |
| 1490 | |
| 1491 | - Fixed line reporting on some strict parser errors. |
| 1492 | |
| 1493 | ### Added |
| 1494 | |
| 1495 | - Added `--base-branch` flag to `pint ci` command. |
| 1496 | |
| 1497 | ## v0.24.0 |
| 1498 | |
| 1499 | ### Added |
| 1500 | |
| 1501 | - Added rate limit for Prometheus API requests with a default value of 100 |
| 1502 | requests per second. To customise it set `rateLimit` field inside selected |
| 1503 | `prometheus` server definition. |
| 1504 | - Added `pint_last_run_checks` and `pint_last_run_checks_done` metrics to track |
| 1505 | progress when running `pint watch`. |
| 1506 | |
| 1507 | ## v0.23.0 |
| 1508 | |
| 1509 | ### Fixed |
| 1510 | |
| 1511 | - Improved range query cache efficiency. |
| 1512 | |
| 1513 | ### Added |
| 1514 | |
| 1515 | - Added extra global configuration for `promql/series` check. |
| 1516 | See check [documentation](checks/promql/series.md) for details. |
| 1517 | - `prometheus` server definition in `pint` config file can now accept optional |
| 1518 | `cache` field (defaults to 10000) to allow fine tuning of built-in Prometheus |
| 1519 | API query caching. |
| 1520 | - Added `pint_prometheus_cache_size` metric that exposes the number of entries |
| 1521 | currently in the query cache. |
| 1522 | |
| 1523 | ## v0.22.2 |
| 1524 | |
| 1525 | ### Fixed |
| 1526 | |
| 1527 | - Improved error reporting when strict mode is enabled. |
| 1528 | |
| 1529 | ## v0.22.1 |
| 1530 | |
| 1531 | ### Fixed |
| 1532 | |
| 1533 | - Fixed high memory usage when running range queries against Prometheus servers. |
| 1534 | |
| 1535 | ## v0.22.0 |
| 1536 | |
| 1537 | ### Changed |
| 1538 | |
| 1539 | - The way `pint` sends API requests to Prometheus was changed to improve performance. |
| 1540 | |
| 1541 | First change is that each `prometheus` server definition in `pint` config file can |
| 1542 | now accept optional `concurrency` field (defaults to 16) that sets a limit on how |
| 1543 | many concurrent requests can that server receive. There is a new metric that |
| 1544 | tracks how many queries are currently being run for each Prometheus server - |
| 1545 | `pint_prometheus_queries_running`. |
| 1546 | |
| 1547 | Second change is that range queries will now be split into smaller queries, so |
| 1548 | if `pint` needs to run a range query on one week of metrics, then it will break |
| 1549 | this down into multiple queries each for a two hour slot, and then merge all |
| 1550 | the results. Previously it would try to run a single query for a whole week |
| 1551 | and if that failed it would reduce time range until a query would succeed. |
| 1552 | |
| 1553 | ### Fixed |
| 1554 | |
| 1555 | - Strict parsing mode didn't fully validate rule group files, this is now fixed |
| 1556 | and pint runs the same set of checks as Prometheus. |
| 1557 | - Fixed `promql/series` handling of rules with `{__name__=~"foo|bar"}` queries. |
| 1558 | - If Prometheus was stopped or restarted `promql/series` would occasionally |
| 1559 | report metrics as "sometimes present". This check will now try to find time |
| 1560 | ranges with no metrics in Prometheus and ignore these when checking if |
| 1561 | metrics are present. |
| 1562 | |
| 1563 | ## v0.21.1 |
| 1564 | |
| 1565 | ### Fixed |
| 1566 | |
| 1567 | - `pint_prometheus_queries_total` and `pint_prometheus_cache_hits_total` metric wasn't |
| 1568 | always correctly updated. |
| 1569 | - Ignore `unknown` metric types in `promql/rate`. |
| 1570 | |
| 1571 | ## v0.21.0 |
| 1572 | |
| 1573 | ### Added |
| 1574 | |
| 1575 | - `promql/rate` check will now report if `rate()` or `irate()` function is being |
| 1576 | passed a non-counter metric. |
| 1577 | |
| 1578 | ## v0.20.0 |
| 1579 | |
| 1580 | ### Fixed |
| 1581 | |
| 1582 | - pint will now correctly handle YAML anchors. |
| 1583 | |
| 1584 | ## v0.19.0 |
| 1585 | |
| 1586 | ### Added |
| 1587 | |
| 1588 | - Parsing files in relaxed mode will now try to find rules inside multi-line strings #252. |
| 1589 | This allows direct linting of k8s manifests like the one below: |
| 1590 | |
| 1591 | ```yaml |
| 1592 | --- |
| 1593 | kind: ConfigMap |
| 1594 | apiVersion: v1 |
| 1595 | metadata: |
| 1596 | name: example-app-alerts |
| 1597 | labels: |
| 1598 | app: example-app |
| 1599 | data: |
| 1600 | alerts: | |
| 1601 | groups: |
| 1602 | - name: example-app-alerts |
| 1603 | rules: |
| 1604 | - alert: Example_Is_Down |
| 1605 | expr: kube_deployment_status_replicas_available{namespace="example-app"} < 1 |
| 1606 | for: 5m |
| 1607 | labels: |
| 1608 | priority: "2" |
| 1609 | environment: production |
| 1610 | annotations: |
| 1611 | summary: "No replicas for Example have been running for 5 minutes" |
| 1612 | ``` |
| 1613 | |
| 1614 | ## v0.18.1 |
| 1615 | |
| 1616 | ### Fixed |
| 1617 | |
| 1618 | - Fixed incorrect line reported when pint fails to unmarshal YAML file. |
| 1619 | |
| 1620 | ## v0.18.0 |
| 1621 | |
| 1622 | ### Added |
| 1623 | |
| 1624 | - Allow fine tuning `promql/series` check with extra control comments |
| 1625 | `# pint rule/set promql/series min-age ...` and |
| 1626 | `# pint rule/set promql/series ignore/label-value ...` |
| 1627 | See [promql/series](checks/promql/series.md) for details. |
| 1628 | - `promql/regexp` will report redundant use of regex anchors. |
| 1629 | |
| 1630 | ### Changed |
| 1631 | |
| 1632 | - `promql/series` will now report missing metrics only if they were last seen |
| 1633 | over 2 hours ago by default. This can be customised per rule with comments. |
| 1634 | |
| 1635 | ## v0.17.7 |
| 1636 | |
| 1637 | ### Fixed |
| 1638 | |
| 1639 | - Fix problem line reporting for `rule/owner` check. |
| 1640 | - Add missing `rule/owner` documentation page. |
| 1641 | |
| 1642 | ## v0.17.6 |
| 1643 | |
| 1644 | ### Fixed |
| 1645 | |
| 1646 | - Fixed false positive reports from `promql/series` check when running |
| 1647 | `pint watch`. |
| 1648 | |
| 1649 | ## v0.17.5 |
| 1650 | |
| 1651 | ### Added |
| 1652 | |
| 1653 | - Added `pint_last_run_duration_seconds` metric. |
| 1654 | - Added `--require-owner` flag support to `pint ci` command. |
| 1655 | |
| 1656 | ### Fixed |
| 1657 | |
| 1658 | - Better handling of YAML unmarshal errors. |
| 1659 | |
| 1660 | ## v0.17.4 |
| 1661 | |
| 1662 | ### Fixed |
| 1663 | |
| 1664 | - Fixed false positive reports from `alerts/template` check when `absent()` is |
| 1665 | used inside a binary expression. |
| 1666 | |
| 1667 | ## v0.17.3 |
| 1668 | |
| 1669 | ### Fixed |
| 1670 | |
| 1671 | - File parse errors didn't report correct line numbers when running `pint ci`. |
| 1672 | |
| 1673 | ## v0.17.2 |
| 1674 | |
| 1675 | ### Fixed |
| 1676 | |
| 1677 | - File parse errors were not reported correctly when running `pint ci`. |
| 1678 | |
| 1679 | ## v0.17.1 |
| 1680 | |
| 1681 | ### Fixed |
| 1682 | |
| 1683 | - Handle `504 Gateway Timeout` HTTP responses from Prometheus same as query |
| 1684 | timeouts and retry with a shorter range query. |
| 1685 | |
| 1686 | ## v0.17.0 |
| 1687 | |
| 1688 | ### Added |
| 1689 | |
| 1690 | - When running `pint ci` all checks will be skipped if any commit contains |
| 1691 | `[skip ci]` or `[no ci]` string in the commit message. |
| 1692 | |
| 1693 | ### Changed |
| 1694 | |
| 1695 | - By default pint will now parse all files in strict mode, where all rule files |
| 1696 | must have the exact syntax Prometheus expects: |
| 1697 | |
| 1698 | ```yaml |
| 1699 | groups: |
| 1700 | - name: example |
| 1701 | rules: |
| 1702 | - record: ... |
| 1703 | expr: ... |
| 1704 | ``` |
| 1705 | |
| 1706 | Previous releases were only looking for individual rules so `groups` object |
| 1707 | wasn't required. Now pint will fail to read any file that doesn't follow |
| 1708 | Prometheus syntax exactly. |
| 1709 | To enable old behaviour add `parser { relaxed = ["(.+)", ...]}` option in |
| 1710 | the config file. See [Configuration](configuration.md) for details. |
| 1711 | To enable old (relaxed) behaviour for all files add: |
| 1712 | |
| 1713 | ```yaml |
| 1714 | parser { |
| 1715 | relaxed = ["(.*)"] |
| 1716 | } |
| 1717 | ``` |
| 1718 | |
| 1719 | ### Fixed |
| 1720 | |
| 1721 | - Improved `promql/vector_matching` checks to detect more issues. |
| 1722 | - Fixed reporting of problems detected on unmodified lines when running `pint ci`. |
| 1723 | |
| 1724 | ## v0.16.1 |
| 1725 | |
| 1726 | ### Fixed |
| 1727 | |
| 1728 | - Fixed false positive reports from `alerts/template` check when `absent()` function |
| 1729 | is receiving labels from a binary expression. |
| 1730 | |
| 1731 | ## v0.16.0 |
| 1732 | |
| 1733 | ### Added |
| 1734 | |
| 1735 | - When running `pint watch` exported metric can include `owner` label for each rule. |
| 1736 | This is useful to route alerts based on `pint_problem` metrics to the right team. |
| 1737 | To set a rule owner add a `# pint file/owner $owner` comment in a file, to set |
| 1738 | an owner for all rules in that file. You can also set an owner per rule, by adding |
| 1739 | `# pint rule/owner $owner` comment around given rule. |
| 1740 | To enforce ownership comments in all files pass `--require-owner` flag to `pint lint`. |
| 1741 | |
| 1742 | ## v0.15.7 |
| 1743 | |
| 1744 | ### Fixed |
| 1745 | |
| 1746 | - `promql/series` check no longer runs duplicated checks on source metrics when |
| 1747 | a query depends on a recording rule added in the same PR. |
| 1748 | |
| 1749 | ## v0.15.6 |
| 1750 | |
| 1751 | ### Fixed |
| 1752 | |
| 1753 | - `promql/series` check was reporting that a metric stopped being exported when check |
| 1754 | queries would require a few retries. |
| 1755 | |
| 1756 | ## v0.15.5 |
| 1757 | |
| 1758 | ### Fixed |
| 1759 | |
| 1760 | - `promql/series` check was reporting both `Warning` and `Bug` problems for the |
| 1761 | same metric when it was using newly added recording rule. |
| 1762 | |
| 1763 | ## v0.15.4 |
| 1764 | |
| 1765 | ### Fixed |
| 1766 | |
| 1767 | - Fixed false positive reports from `promql/fragile` when `foo OR bar` is used inside |
| 1768 | aggregation. |
| 1769 | |
| 1770 | ## v0.15.3 |
| 1771 | |
| 1772 | ### Fixed |
| 1773 | |
| 1774 | - Use more efficient queries for `promql/series` check. |
| 1775 | - Fixed YAML parsing panics detected by Go 1.18 fuzzing. |
| 1776 | |
| 1777 | ## v0.15.2 |
| 1778 | |
| 1779 | ### Fixed |
| 1780 | |
| 1781 | - Improved query cache hit rate and added `pint_prometheus_cache_hits_total` metric |
| 1782 | to track the number of cache hits. |
| 1783 | |
| 1784 | ## v0.15.1 |
| 1785 | |
| 1786 | ### Added |
| 1787 | |
| 1788 | - When a range query returns `query processing would load too many samples into memory` |
| 1789 | error and we retry it with smaller time range cache this information and start with |
| 1790 | that smaller time range for future calls to speed up running `pint watch`. |
| 1791 | |
| 1792 | ## v0.15.0 |
| 1793 | |
| 1794 | ### Changed |
| 1795 | |
| 1796 | - Always print the number of detected problems when running `pint lint`. |
| 1797 | - `promql/series` check was refactored and will now detect a range of |
| 1798 | problems. See [promql/series](checks/promql/series.md) for details. |
| 1799 | - `promql/regexp` severity is now `Bug` instead of a `Warning`. |
| 1800 | - `promql/rate` check will no longer produce warnings, it will only |
| 1801 | report issues that cause queries to never return anything. |
| 1802 | |
| 1803 | ## v0.14.0 |
| 1804 | |
| 1805 | ### Added |
| 1806 | |
| 1807 | - Allow matching alerting rules by `for` field - #148. Example: |
| 1808 | |
| 1809 | ```js |
| 1810 | rule { |
| 1811 | match { |
| 1812 | for = ">= 10m" |
| 1813 | } |
| 1814 | } |
| 1815 | ``` |
| 1816 | |
| 1817 | - Regexp matchers used in check rules can now reference rule fields. |
| 1818 | See [Configuration](configuration.md) for details. |
| 1819 | |
| 1820 | ### Changed |
| 1821 | |
| 1822 | - Added `filename` label to `pint_problem` metric - #170. |
| 1823 | - Include Prometheus server URI in reported problems. |
| 1824 | |
| 1825 | ### Fixed |
| 1826 | |
| 1827 | - Fixed `pint ci` handling when a file was added to git and then removed in the |
| 1828 | next commit. |
| 1829 | |
| 1830 | ## v0.13.2 |
| 1831 | |
| 1832 | ### Fixed |
| 1833 | |
| 1834 | - `yaml/parse` was using incorrect line numbers for errors caused by duplicated |
| 1835 | YAML keys. |
| 1836 | |
| 1837 | ## v0.13.1 |
| 1838 | |
| 1839 | ### Fixed |
| 1840 | |
| 1841 | - Don't use fail-over Prometheus servers in case of errors caused by the query |
| 1842 | itself, like `many-to-many matching not allowed`. |
| 1843 | |
| 1844 | ## v0.13.0 |
| 1845 | |
| 1846 | ### Added |
| 1847 | |
| 1848 | - `yaml/parse` error will be raised if a rule file contains duplicated keys, example: |
| 1849 | |
| 1850 | ```yaml |
| 1851 | - record: foo |
| 1852 | expr: sum(my_metric) |
| 1853 | expr: sum(my_metric) without(instance) |
| 1854 | ``` |
| 1855 | |
| 1856 | ### Changed |
| 1857 | |
| 1858 | - `prometheus` config block now allows to specify fail-over URIs using `failover` field. |
| 1859 | If fail-over URIs are set and main URI fails to respond pint will attempt to use them |
| 1860 | in the order specified until one of them works. |
| 1861 | - `prometheus` config block now allows to define how upstream errors are handled using |
| 1862 | `required` field. If `required` is set to `true` any check that depends on remote |
| 1863 | Prometheus server will be reported as `bug` if it's unable to talk to it. |
| 1864 | If `required` is set to `false` pint will only emit `warning` level results. |
| 1865 | Default value for `required` is `false`. Set it to `true` if you want to hard fail |
| 1866 | in case of remote Prometheus issues. Note that setting it to `true` might block |
| 1867 | PRs when running `pint ci` until pint is able to talk to Prometheus again. |
| 1868 | - Renamed `pint/parse` to `yaml/parse` and added missing documentation for it. |
| 1869 | |
| 1870 | ## v0.12.0 |
| 1871 | |
| 1872 | ### Added |
| 1873 | |
| 1874 | - Added `pint_last_run_time_seconds` and `pint_rules_parsed_total` metrics when running `pint watch`. |
| 1875 | |
| 1876 | ### Changed |
| 1877 | |
| 1878 | - `promql/comparison` only applies to alerts, so it was renamed to |
| 1879 | `alerts/comparison`. |
| 1880 | - Online documentation hosted at [cloudflare.github.io/pint](https://cloudflare.github.io/pint/) |
| 1881 | was reworked. |
| 1882 | - `alerts/count` check will now retry range queries with shorter time window |
| 1883 | on `found duplicate series for the match group ...` errors from Prometheus. |
| 1884 | |
| 1885 | ## v0.11.1 |
| 1886 | |
| 1887 | ### Fixed |
| 1888 | |
| 1889 | - `pint_prometheus_queries_total` and `pint_prometheus_query_errors_total` metrics |
| 1890 | were not incremented correctly. |
| 1891 | |
| 1892 | ## v0.11.0 |
| 1893 | |
| 1894 | ### Added |
| 1895 | |
| 1896 | - Added `promql/regexp` check that will warn about unnecessary regexp matchers. |
| 1897 | - Added `pint_prometheus_queries_total` and `pint_prometheus_query_errors_total` |
| 1898 | metric when running `pint watch`. |
| 1899 | |
| 1900 | ## v0.10.1 |
| 1901 | |
| 1902 | ### Fixed |
| 1903 | |
| 1904 | - Fixed a number of bug with `promql/vector_matching` check. |
| 1905 | |
| 1906 | ## v0.10.0 |
| 1907 | |
| 1908 | ### Changed |
| 1909 | |
| 1910 | - `query/series` check was renamed to `promql/series`. |
| 1911 | |
| 1912 | ### Fixed |
| 1913 | |
| 1914 | - Improved the logic of `promql/vector_matching` check. |
| 1915 | |
| 1916 | ## v0.9.0 |
| 1917 | |
| 1918 | ### Changed |
| 1919 | |
| 1920 | - Removed `lines` label from `pint_problem` metric exported when running `pint watch`. |
| 1921 | - Multiple `match` and `ignore` blocks can now be specified per each `rule`. |
| 1922 | |
| 1923 | ## v0.8.2 |
| 1924 | |
| 1925 | ### Added |
| 1926 | |
| 1927 | - Export `pint_version` metric when running `pint watch`. |
| 1928 | - Added `--min-severity` flag to `pint watch` command. |
| 1929 | |
| 1930 | ## v0.8.1 |
| 1931 | |
| 1932 | ### Added |
| 1933 | |
| 1934 | - Added `--max-problems` flag to `pint watch` command. |
| 1935 | |
| 1936 | ### Changed |
| 1937 | |
| 1938 | - Updated Prometheus modules to [v2.33.0](https://github.com/prometheus/prometheus/releases/tag/v2.33.0). |
| 1939 | This adds support for `stripPort` template function. |
| 1940 | |
| 1941 | ## v0.8.0 |
| 1942 | |
| 1943 | ### Added |
| 1944 | |
| 1945 | - Added new `promql/fragile` check. |
| 1946 | - BitBucket reports will now include a link to documentation. |
| 1947 | |
| 1948 | ## v0.7.3 |
| 1949 | |
| 1950 | ### Added |
| 1951 | |
| 1952 | - `--workers` flag to control the number of worker threads for running checks. |
| 1953 | |
| 1954 | ## v0.7.2 |
| 1955 | |
| 1956 | ### Changed |
| 1957 | |
| 1958 | - More aggressive range reduction for `query processing would load too many samples into memory` |
| 1959 | errors when sending range queries to Prometheus servers. |
| 1960 | |
| 1961 | ## v0.7.1 |
| 1962 | |
| 1963 | ### Added |
| 1964 | |
| 1965 | - Added `command` filter to `match` / `ignore` blocks. This allows to include |
| 1966 | skip some checks when (for example) running `pint watch` but include them |
| 1967 | in `pint lint` run. |
| 1968 | |
| 1969 | ## v0.7.0 |
| 1970 | |
| 1971 | ### Added |
| 1972 | |
| 1973 | - Cache each Prometheus server responses to minimise the number of API calls. |
| 1974 | - `pint watch` will start a daemon that will continuously check all matching rules |
| 1975 | and expose metrics describing all discovered problems. |
| 1976 | |
| 1977 | ### Changed |
| 1978 | |
| 1979 | - `alerts/annotation` and `rule/label` now include `required` flag value in |
| 1980 | `# pint disable ...` comments. |
| 1981 | Rename `# pint disable alerts/annotation($name)` to |
| 1982 | `# pint disable alerts/annotation($name:$required)` and |
| 1983 | `# pint disable rule/label($name)` to `# pint disable rule/label($name:$required)`. |
| 1984 | - `--offline` and `--disabled` flags are now global, use `pint --offline lint` instead |
| 1985 | of `pint lint --offline`. |
| 1986 | |
| 1987 | ### Fixed |
| 1988 | |
| 1989 | - `promql/rate`, `query/series` and `promql/vector_matching` checks were not enabled |
| 1990 | for all defined `prometheus {}` blocks unless there was at least one `rule {}` block. |
| 1991 | - `annotation` based `match` blocks didn't work correctly. |
| 1992 | |
| 1993 | ## v0.6.6 |
| 1994 | |
| 1995 | ### Fixed |
| 1996 | |
| 1997 | - File renames were not handled correctly when running `git ci` on branches with |
| 1998 | multiple commits. |
| 1999 | |
| 2000 | ## v0.6.5 |
| 2001 | |
| 2002 | ### Added |
| 2003 | |
| 2004 | - Allow disabling `query/series` check for individual series using |
| 2005 | `# pint disable query/series(my_metric_name)` comments. |
| 2006 | |
| 2007 | ## v0.6.4 |
| 2008 | |
| 2009 | ### Fixed |
| 2010 | |
| 2011 | - Fixed docker builds. |
| 2012 | |
| 2013 | ## v0.6.3 |
| 2014 | |
| 2015 | ### Fixed |
| 2016 | |
| 2017 | - `aggregate` check didn't report stripping required labels on queries |
| 2018 | using aggregation with no grouping labels (`sum(foo)`). |
| 2019 | - `aggregate` check didn't test for name and label matches on alert rules. |
| 2020 | |
| 2021 | ## v0.6.2 |
| 2022 | |
| 2023 | ### Changed |
| 2024 | |
| 2025 | - `template` check will now include alert query line numbers when reporting issues. |
| 2026 | |
| 2027 | ## v0.6.1 |
| 2028 | |
| 2029 | ### Fixed |
| 2030 | |
| 2031 | - Labels returned by `absent()` are only from equal match types (`absent(foo="bar")`, |
| 2032 | not `absent(foo=~"bar.+")` but `alerts/template` didn't test for match type when |
| 2033 | checking for labels sourced from `absent()` queries. |
| 2034 | |
| 2035 | ## v0.6.0 |
| 2036 | |
| 2037 | ### Changed |
| 2038 | |
| 2039 | - `aggregate` check was refactored and uses to run a single test for both |
| 2040 | `by` and `without` conditions. As a result this check might now find issues |
| 2041 | previously undetected. |
| 2042 | Check suppression comments will need to be migrated: |
| 2043 | - `# pint disable promql/by` becomes `# pint disable promql/aggregate` |
| 2044 | - `# pint disable promql/without` becomes `# pint disable promql/aggregate` |
| 2045 | - `# pint ignore promql/by` becomes `# pint ignore promql/aggregate` |
| 2046 | - `# pint ignore promql/without` becomes `# pint ignore promql/aggregate` |
| 2047 | |
| 2048 | ## v0.5.3 |
| 2049 | |
| 2050 | ### Fixed |
| 2051 | |
| 2052 | - Fixed false positive reports in `aggregate` check. |
| 2053 | |
| 2054 | ## v0.5.2 |
| 2055 | |
| 2056 | ### Added |
| 2057 | |
| 2058 | - `--no-color` flag for disabling output colouring. |
| 2059 | |
| 2060 | ### Fixed |
| 2061 | |
| 2062 | - Fixed duplicated warnings when multiple `rule {...}` blocks where configured. |
| 2063 | |
| 2064 | ## v0.5.1 |
| 2065 | |
| 2066 | ### Fixed |
| 2067 | |
| 2068 | - Specifying multiple `# pint disable ...` comments on a single rule would only apply |
| 2069 | last comment. This now works correctly and all comments will be applied. |
| 2070 | |
| 2071 | ## v0.5.0 |
| 2072 | |
| 2073 | ### Added |
| 2074 | |
| 2075 | - Added `alerts/for` check that will look for invalid `for` values in alerting rules. |
| 2076 | This check is enabled by default. |
| 2077 | |
| 2078 | ### Changed |
| 2079 | |
| 2080 | - `comparison` check is now enabled by default and require no configuration. |
| 2081 | Remove `comparison{ ... }` blocks from pint config file when upgrading. |
| 2082 | - `template` check is now enabled by default and require no configuration. |
| 2083 | Remove `template{ ... }` blocks from pint config file when upgrading. |
| 2084 | - `rate` check is now enabled by default for all configured Prometheus servers. |
| 2085 | Remove `rate{ ... }` blocks from pint config file when upgrading. |
| 2086 | - `series` check is now enabled by default for all configured Prometheus servers. |
| 2087 | Remove `series{ ... }` blocks from pint config file when upgrading. |
| 2088 | - `vector_matching` check is now enabled by default for all configured Prometheus servers. |
| 2089 | Remove `vector_matching{ ... }` blocks from pint config file when upgrading. |
| 2090 | |
| 2091 | ## v0.4.4 |
| 2092 | |
| 2093 | ### Added |
| 2094 | |
| 2095 | - Support `parseDuration` function in alert templates added in Prometheus 2.32.0 |
| 2096 | |
| 2097 | ## v0.4.3 |
| 2098 | |
| 2099 | ### Fixed |
| 2100 | |
| 2101 | - Fixed `series` check handling of queries with `{__name__="foo"}` selectors. |
| 2102 | |
| 2103 | ## v0.4.2 |
| 2104 | |
| 2105 | ### Fixed |
| 2106 | |
| 2107 | - Fixed `template` check handling of `absent` calls on aggregated metrics, like |
| 2108 | `absent(sum(nonexistent{job="myjob"}))`. |
| 2109 | |
| 2110 | ## v0.4.1 |
| 2111 | |
| 2112 | ### Added |
| 2113 | |
| 2114 | - `template` check will now warn if any template is referencing a label that is not passed to |
| 2115 | `absent()`. |
| 2116 | Example: |
| 2117 | |
| 2118 | {% raw %} |
| 2119 | |
| 2120 | ```yaml |
| 2121 | - alert: Foo |
| 2122 | expr: absent(foo{env="prod"}) |
| 2123 | annotations: |
| 2124 | summary: "foo metric is missing for job {{ $labels.job }}" |
| 2125 | ``` |
| 2126 | |
| 2127 | {% endraw %} |
| 2128 | |
| 2129 | Would generate a warning since `absent()` can only return labels that are explicitly |
| 2130 | passed to it and the above call only passes `env` label. |
| 2131 | This can be fixed by updating the query to `absent(foo{env="prod", job="bar"})`. |
| 2132 | |
| 2133 | ## v0.4.0 |
| 2134 | |
| 2135 | ### Added |
| 2136 | |
| 2137 | - `comparison` check will now warn when alert query uses |
| 2138 | [bool](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators) |
| 2139 | modifier after condition, which can cause alert to always fire. |
| 2140 | Example: |
| 2141 | |
| 2142 | ```yaml |
| 2143 | - alert: Foo |
| 2144 | expr: rate(error_count[5m]) > bool 5 |
| 2145 | ``` |
| 2146 | |
| 2147 | Having `bool` as part of `> 5` condition means that the query will return value `1` when condition |
| 2148 | is met, and `0` when it's not. Rather than returning value of `rate(error_count[5m])` only when |
| 2149 | that value is `> 5`. Since all results of an alerting rule `expr` are considered alerts such alert |
| 2150 | rule could always fire, regardless of the value returned by `rate(error_count[5m])`. |
| 2151 | |
| 2152 | ### Fixed |
| 2153 | |
| 2154 | - `comparison` check will now ignore `absent(foo)` alert queries without any condition. |
| 2155 | |
| 2156 | ## v0.3.1 |
| 2157 | |
| 2158 | ### Added |
| 2159 | |
| 2160 | - `--offline` flag for `pint ci` command. |
| 2161 | |
| 2162 | ### Fixed |
| 2163 | |
| 2164 | - Fixed `template` check panic when alert query had a syntax error. |
| 2165 | |
| 2166 | ## v0.3.0 |
| 2167 | |
| 2168 | ### Added |
| 2169 | |
| 2170 | - `rule` block can now specify `ignore` conditions that have the same syntax as `match` |
| 2171 | but will disable `rule` for matching alerting and recording rules #48. |
| 2172 | - `match` and `ignore` blocks can now filter alerting and recording rules by name. |
| 2173 | `record` will be used as name for recording rules and `alert` for alerting rules. |
| 2174 | |
| 2175 | ## v0.2.0 |
| 2176 | |
| 2177 | ### Added |
| 2178 | |
| 2179 | - `--offline` flag for `pint lint` command. When passed only checks that don't send |
| 2180 | any live queries to Prometheus server will be run. |
| 2181 | - `template` check will now warn if template if referencing a label that is being |
| 2182 | stripped by aggregation. |
| 2183 | Example: |
| 2184 | |
| 2185 | {% raw %} |
| 2186 | |
| 2187 | ```yaml |
| 2188 | - alert: Foo |
| 2189 | expr: count(up) without(instance) == 0 |
| 2190 | annotations: |
| 2191 | summary: "foo is down on {{ $labels.instance }}" |
| 2192 | ``` |
| 2193 | |
| 2194 | {% endraw %} |
| 2195 | |
| 2196 | Would generate a warning since `instance` label is being stripped by `without(instance)`. |
| 2197 | |
| 2198 | ## v0.1.5 |
| 2199 | |
| 2200 | ### Fixed |
| 2201 | |
| 2202 | - Fixed file descriptor leak due to missing file `Close()` #69. |
| 2203 | |
| 2204 | ## v0.1.4 |
| 2205 | |
| 2206 | ### Changed |
| 2207 | |
| 2208 | - Retry queries that error with `query processing would load too many samples into memory` |
| 2209 | using a smaller time range. |
| 2210 | |
| 2211 | ## v0.1.3 |
| 2212 | |
| 2213 | ### Added |
| 2214 | |
| 2215 | - `vector_matching` check for finding queries with incorrect `on()` or `ignoring()` |
| 2216 | keywords. |
| 2217 | |
| 2218 | ### Fixed |
| 2219 | |
| 2220 | - `comparison` check would trigger false positive for rules using `unless` keyword. |
| 2221 | |
| 2222 | ## v0.1.2 |
| 2223 | |
| 2224 | ### Fixed |
| 2225 | |
| 2226 | - `# pint skip/line` place between `# pint skip/begin` and `# pint skip/end` lines would |
| 2227 | reset ignore rules causing lines that should be ignored to be parsed. |
| 2228 | |
| 2229 | ## v0.1.1 |
| 2230 | |
| 2231 | ### Changed |
| 2232 | |
| 2233 | - `value` check was replaced by `template`, which covers the same functionality and more. |
| 2234 | See [docs](/docs/CONFIGURATION.md#template) for details. |