cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/changelog.md
1145lines · modecode
| 1 | # Changelog |
| 2 | |
| 3 | ## v0.35.0 |
| 4 | |
| 5 | ### Added |
| 6 | |
| 7 | - Use [uber-go/automaxprocs](https://github.com/uber-go/automaxprocs) to |
| 8 | automatically set GOMAXPROCS to match Linux container CPU quota. |
| 9 | - Added [labels/conflict](checks/labels/conflict.md) check. |
| 10 | - If you want to disable invididual checks just for some time then you can now |
| 11 | snooze them instead of disabling forever. |
| 12 | |
| 13 | The difference between `# pint disable ...` and `# pint snooze ...` comments is that |
| 14 | the snooze comment must include a timestamp. Selected check will be disabled *until* |
| 15 | that timestamp. |
| 16 | Timestamp must either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) syntax |
| 17 | or `YYYY-MM-DD` (if you don't care about time and want to snooze until given date). |
| 18 | Examples: |
| 19 | |
| 20 | ```yaml |
| 21 | # pint snooze 2023-01-12T10:00:00Z promql/series |
| 22 | # pint snooze 2023-01-12 promql/rate |
| 23 | - record: ... |
| 24 | expr: ... |
| 25 | ``` |
| 26 | |
| 27 | ### Changed |
| 28 | |
| 29 | - Removed `cache` option from `prometheus` config blocks. Query cache will now auto-size itself |
| 30 | as needed. |
| 31 | |
| 32 | If you have a config entry with `cache` option, example: |
| 33 | |
| 34 | ```javascript |
| 35 | prometheus "prod" { |
| 36 | uri = "https://prometheus.example.com" |
| 37 | cache = 20000 |
| 38 | } |
| 39 | ``` |
| 40 | |
| 41 | Then pint will fail to start. To fix this simply remove the `cache` option: |
| 42 | |
| 43 | ```javascript |
| 44 | prometheus "prod" { |
| 45 | uri = "https://prometheus.example.com" |
| 46 | } |
| 47 | ``` |
| 48 | |
| 49 | ## v0.34.0 |
| 50 | |
| 51 | ### Added |
| 52 | |
| 53 | - Added [rule/duplicate](checks/rule/duplicate.md) check. |
| 54 | |
| 55 | ## v0.33.1 |
| 56 | |
| 57 | ### Fixed |
| 58 | |
| 59 | - Fixed a regression causing poor query cache hit rate. |
| 60 | |
| 61 | ## v0.33.0 |
| 62 | |
| 63 | ### Added |
| 64 | |
| 65 | - Added `uptime` field in `prometheus` configuration block. |
| 66 | This field can be used to set a custom metric used for Prometheus uptime checks |
| 67 | and by default uses `up` metric. |
| 68 | If you have a Prometheus with a large number of scrape targets there might |
| 69 | be a huge number of `up` time series making those uptime checks slow to run. |
| 70 | If your Prometheus is configured to scrape itself, then you most likely want to use |
| 71 | one of metrics exported by Prometheus, like `prometheus_build_info`: |
| 72 | |
| 73 | ```javascript |
| 74 | prometheus "prod" { |
| 75 | uri = "https://prometheus.example.com" |
| 76 | uptime = "prometheus_build_info" |
| 77 | } |
| 78 | ``` |
| 79 | |
| 80 | ### Changed |
| 81 | |
| 82 | - Refactored some quries used by [promql/series](checks/promql/series.md) check to |
| 83 | avoid sending quries that might be very slow and/or return a huge amount of data. |
| 84 | - Prometheus query cache now takes into account the size of cached response. |
| 85 | This makes memory usage needed for query cache more predictable. |
| 86 | As a result the `cache` option for `prometheus` config block now means |
| 87 | `the number of time series cached` instead of `the number of responses cached` |
| 88 | and the default for this option is now `50000`. |
| 89 | |
| 90 | ## v0.32.1 |
| 91 | |
| 92 | ### Fixed |
| 93 | |
| 94 | - [promql/vector_matching](checks/promql/vector_matching.md) was sending expensive |
| 95 | queries resulting in high memory usage, this is now fixed. |
| 96 | |
| 97 | ## v0.32.0 |
| 98 | |
| 99 | ### Added |
| 100 | |
| 101 | - Added `pint_prometheus_cache_evictions_total` metric tracking the number of times |
| 102 | cache results were evicted from query cache. |
| 103 | - Allow disabling individual checks for the entire file using |
| 104 | `# pint file/disable ...` comments. |
| 105 | |
| 106 | ### Changed |
| 107 | |
| 108 | - Refactored query cache to only store queries that are requested more than once. |
| 109 | This will avoid storing big responses that are never requested from the cache. |
| 110 | |
| 111 | ### Fixed |
| 112 | |
| 113 | - Config validation will now check for duplicated `prometheus` block names. |
| 114 | |
| 115 | ## v0.31.1 |
| 116 | |
| 117 | ### Fixed |
| 118 | |
| 119 | - Fixed performance regression slowing down `pint watch` over time. |
| 120 | |
| 121 | ## v0.31.0 |
| 122 | |
| 123 | ### Added |
| 124 | |
| 125 | - `prometheus` configuration block now accepts optional `headers` field, for setting |
| 126 | request headers that will be attached to any request made to given Prometheus server. |
| 127 | Example: |
| 128 | |
| 129 | ```javascript |
| 130 | prometheus "protected" { |
| 131 | uri = "https://prod.example.com" |
| 132 | headers = { |
| 133 | "X-Auth": "secret", |
| 134 | "X-User": "bob" |
| 135 | } |
| 136 | ``` |
| 137 | |
| 138 | ### Changed |
| 139 | |
| 140 | - Prometheus range query handling was rewritten to improve memory usage |
| 141 | caused by queries returing huge number of results. |
| 142 | As a result pint should use up to 5x less memory. |
| 143 | |
| 144 | ### Fixed |
| 145 | |
| 146 | - Fixed false positive reports in [promql/vector_matching](checks/promql/vector_matching.md) |
| 147 | for rules using `on(...)`. Example: |
| 148 | |
| 149 | ``` |
| 150 | sum(foo) without(instance) * on(app_name) group_left() bar |
| 151 | ``` |
| 152 | - Don't log passwords when Prometheus URI is using basic authentication. |
| 153 | - Fixed false positive reports in [alerts/template](checks/alerts/template.md) |
| 154 | suggeting to use `humanize` on queries that already use `round()`. |
| 155 | - Fixed false positive reports in [alerts/comparison](checks/alerts/comparison.md) |
| 156 | when `bool` modifier is used on a condtion that is guarded by another conditon. |
| 157 | Example: |
| 158 | |
| 159 | ```yaml |
| 160 | alert: Foo |
| 161 | expr: (foo > 1) > bool 1 |
| 162 | ``` |
| 163 | - Fixed false positive reports in [alerts/template](checks/alerts/template.md) |
| 164 | warning about labels removed in a query despite being re-added by a join. |
| 165 | |
| 166 | ## v0.30.2 |
| 167 | |
| 168 | ### Fixed |
| 169 | |
| 170 | - Fixed incorrect line number reporting on BitBucket annotations. |
| 171 | |
| 172 | ## v0.30.1 |
| 173 | |
| 174 | ### Fixed |
| 175 | |
| 176 | - Fixed handling of symlinks when running `pint lint` and `pint watch` commands. |
| 177 | |
| 178 | ## v0.30.0 |
| 179 | |
| 180 | ### Added |
| 181 | |
| 182 | - BitBucket only allows for annotations on modified lines, so when a high severity problem |
| 183 | is reported on unmodified line pint will move that annotation to the first modified line, |
| 184 | so it's still visible in BitBucket. |
| 185 | Now pint will also add a note to that annotation to make it clear that the problem is really |
| 186 | on a different line. |
| 187 | - [alerts/template](checks/alerts/template.md) will now run extra checks to validate syntax |
| 188 | of queries executed from within alerting rule templates. |
| 189 | |
| 190 | Example template using `sum(xxx` query that's missing closing `)`: |
| 191 | |
| 192 | {% raw %} |
| 193 | ```yaml |
| 194 | - alert: ... |
| 195 | expr: ... |
| 196 | annotations: |
| 197 | summary: | |
| 198 | {{ with query "sum(xxx" }} |
| 199 | {{ . | first | value | humanize }} |
| 200 | {{ end }} |
| 201 | ``` |
| 202 | {% endraw %} |
| 203 | |
| 204 | - If a file is ignored pint will now note that using `Information` level annotation. |
| 205 | This will make it more obvious that a CI check passed because pint didn't run any |
| 206 | checks due to file being excluded. |
| 207 | |
| 208 | ### Changed |
| 209 | |
| 210 | - Prometheus rule files can be symlinked between directories. |
| 211 | If the symlink source and target files are in a different directory they can |
| 212 | end up querying different Prometheus server when running ping checks. |
| 213 | This means that when modifying symlink target file checks must be executed against |
| 214 | both symlink source and target. |
| 215 | Until now pint was ignoring symlinks but starting with this release it will try to |
| 216 | follow them. This means that if you modify a file that has symlinks pointint to them |
| 217 | pint will try run checks against those symlinks too. |
| 218 | |
| 219 | **NOTE**: pint can only detect and check symlinks if they are located in the current |
| 220 | working directory (as seen by running pint process) or its subdirectories. |
| 221 | |
| 222 | ### Fixed |
| 223 | |
| 224 | - Fixed a regression in [promql/vector_matching](checks/promql/vector_matching.md) that |
| 225 | would cause a panic when parsing function calls with optional arguments. |
| 226 | |
| 227 | ## v0.29.4 |
| 228 | |
| 229 | ### Fixed |
| 230 | |
| 231 | - [promql/vector_matching](checks/promql/vector_matching.md) was incorrectly handling |
| 232 | queries containing function calls with multiple arguments. |
| 233 | |
| 234 | ## v0.29.3 |
| 235 | |
| 236 | ### Fixed |
| 237 | |
| 238 | - Revert 'Use smaller buffers when decoding Prometheus API responses' change. |
| 239 | |
| 240 | ## v0.29.2 |
| 241 | |
| 242 | ### Fixed |
| 243 | |
| 244 | - Use smaller buffers when decoding Prometheus API responses. |
| 245 | |
| 246 | ## v0.29.1 |
| 247 | |
| 248 | ### Fixed |
| 249 | |
| 250 | - Fixed wrong request formatting for Prometheus metric metadata queries. |
| 251 | |
| 252 | ## v0.29.0 |
| 253 | |
| 254 | ### Changed |
| 255 | |
| 256 | - Switched from using [prometheus/client_golang](https://github.com/prometheus/client_golang) |
| 257 | API client to streaming JSON library [prymitive/current](https://github.com/prymitive/current) |
| 258 | |
| 259 | ### Fixed |
| 260 | |
| 261 | - Avoid reporting same issue multiple times in `promql/rate` and `promql/regexp` checks. |
| 262 | |
| 263 | ## v0.28.7 |
| 264 | |
| 265 | ### Changed |
| 266 | |
| 267 | - Updated Prometheus modules to [v2.38.0](https://github.com/prometheus/prometheus/releases/tag/v2.38.0). |
| 268 | This adds support for `toTime` template function. |
| 269 | |
| 270 | ## v0.28.6 |
| 271 | |
| 272 | ### Fixed |
| 273 | |
| 274 | - Fixed symlink handling when running `pint lint`. |
| 275 | |
| 276 | ## v0.28.5 |
| 277 | |
| 278 | ### Fixed |
| 279 | |
| 280 | - Remove noisy debug logs. |
| 281 | |
| 282 | ## v0.28.4 |
| 283 | |
| 284 | ### Added |
| 285 | |
| 286 | - Added `pint_prometheus_cache_miss_total` metric. |
| 287 | |
| 288 | ### Changed |
| 289 | |
| 290 | - Reduce log level for `File parsed` messages. |
| 291 | |
| 292 | ### Fixed |
| 293 | |
| 294 | - Purge expired cache entries faster to reduce memory usage. |
| 295 | |
| 296 | ## v0.28.3 |
| 297 | |
| 298 | ### Fixed |
| 299 | |
| 300 | - Fix `absent()` handling in [alerts/comparison](checks/alerts/comparison.md) #330. |
| 301 | |
| 302 | ## v0.28.2 |
| 303 | |
| 304 | ### Added |
| 305 | |
| 306 | - Added `--min-severity` flag to the `pint lint` command. Default value is set to `warning`. |
| 307 | |
| 308 | ### Fixed |
| 309 | |
| 310 | - Fix a regression in [promql/vector_matching](checks/promql/vector_matching.md) introduced |
| 311 | in previous release. |
| 312 | - Fix [promql/series](checks/promql/series.md) disable comments not working when there |
| 313 | are multiple comments on a rule. |
| 314 | - [promql/series](checks/promql/series.md) no longer emits an information message |
| 315 | `metric is generated by alerts ...`. |
| 316 | |
| 317 | ## v0.28.1 |
| 318 | |
| 319 | ### Fixed |
| 320 | |
| 321 | - Don't use `topk` in [promql/vector_matching](checks/promql/vector_matching.md) check to |
| 322 | avoid false positives. |
| 323 | |
| 324 | ## v0.28.0 |
| 325 | |
| 326 | ### Added |
| 327 | |
| 328 | - [promql/rate](checks/promql/rate.md) check will now also validate `deriv` function usage. |
| 329 | - [alerts/annotation](checks/alerts/annotation.md) check will now recommend using one of |
| 330 | humanize functions if alert query is returning results based on `rate()` and the value |
| 331 | is used in annotations. |
| 332 | |
| 333 | ### Changed |
| 334 | |
| 335 | - [promql/series](checks/promql/series.md) check now supports more flexible |
| 336 | `# pint disable promql/series(...)` comments. |
| 337 | Adding a comment `# pint disable promql/series({cluster="dev"})` will disable this check |
| 338 | for any metric selector with `cluster="dev"` matcher. |
| 339 | - [query/cost](checks/query/cost.md) check will now calculate how much Prometheus memory |
| 340 | will be needed for storing results of given query. |
| 341 | `bytesPerSample` option that was previously used to calculate this was removed. |
| 342 | - `prometheus {}` config block now allows to pass a list of paths to explicitly ignore |
| 343 | by setting `exclude` option. Existing `paths` option was renamed to `include` for |
| 344 | consistency. Example migration: |
| 345 | |
| 346 | ```javascript |
| 347 | prometheus "foo" { |
| 348 | [...] |
| 349 | paths = [ "rules/.*" ] |
| 350 | } |
| 351 | ``` |
| 352 | |
| 353 | becomes |
| 354 | |
| 355 | ```javascript |
| 356 | prometheus "foo" { |
| 357 | [...] |
| 358 | include = [ "rules/.*" ] |
| 359 | } |
| 360 | ``` |
| 361 | |
| 362 | |
| 363 | ### Fixed |
| 364 | |
| 365 | - `pint_last_run_checks` and `pint_last_run_checks_done` were not updated properly. |
| 366 | |
| 367 | ## v0.27.0 |
| 368 | |
| 369 | ### Added |
| 370 | |
| 371 | - Deduplicate reports where possible to avoid showing same issue twice. |
| 372 | - [rule/link](checks/rule/link.md) check for validating URIs found in alerting rule annotations. |
| 373 | |
| 374 | ### Changed |
| 375 | |
| 376 | - Add more details to BitBucket CI reports. |
| 377 | - More compact console output when running `pint lint`. |
| 378 | |
| 379 | ## v0.26.0 |
| 380 | |
| 381 | ### Added |
| 382 | |
| 383 | - [promql/range_query](checks/promql/range_query.md) check. |
| 384 | |
| 385 | ### Fixed |
| 386 | |
| 387 | - Strict parsing mode shouldn't fail on template errors, those will be later |
| 388 | reported by `alerts/template` check. |
| 389 | |
| 390 | ## v0.25.0 |
| 391 | |
| 392 | ### Changed |
| 393 | |
| 394 | - All timeout options are now optional. This includes following config blocks: |
| 395 | * `prometheus { timeout = ... }` |
| 396 | * `repository { bitbucket { timeout = ... } }` |
| 397 | * `repository { github { timeout = ... } }` |
| 398 | - `pint` will now try to discover all repository settings from environment variables |
| 399 | when run as part of GitHub Actions workflow and so it doesn't need any |
| 400 | `repository { github { ... } }` configuration block for that anymore. |
| 401 | Setting `GITHUB_AUTH_TOKEN` is the only requirement for GitHub Actions now. |
| 402 | |
| 403 | ## v0.24.1 |
| 404 | |
| 405 | ### Fixed |
| 406 | |
| 407 | - Fixed line reporting on some strict parser errors. |
| 408 | |
| 409 | ### Added |
| 410 | |
| 411 | - Added `--base-branch` flag to `pint ci` command. |
| 412 | |
| 413 | ## v0.24.0 |
| 414 | |
| 415 | ### Added |
| 416 | |
| 417 | - Added rate limit for Prometheus API requests with a default value of 100 |
| 418 | requests per second. To customize it set `rateLimit` field inside selected |
| 419 | `prometheus` server definition. |
| 420 | - Added `pint_last_run_checks` and `pint_last_run_checks_done` metrics to track |
| 421 | progress when running `pint watch`. |
| 422 | |
| 423 | ## v0.23.0 |
| 424 | |
| 425 | ### Fixed |
| 426 | |
| 427 | - Improved range query cache efficiency. |
| 428 | |
| 429 | ### Added |
| 430 | |
| 431 | - Added extra global configuration for `promql/series` check. |
| 432 | See check [documentation](checks/promql/series.md) for details. |
| 433 | - `prometheus` server definition in `pint` config file can now accept optional |
| 434 | `cache` field (defaults to 10000) to allow fine tuning of built-in Prometheus |
| 435 | API query caching. |
| 436 | - Added `pint_prometheus_cache_size` metric that exposes the number of entries |
| 437 | currently in the query cache. |
| 438 | |
| 439 | ## v0.22.2 |
| 440 | |
| 441 | ### Fixed |
| 442 | |
| 443 | - Improved error reporting when strict mode is enabled. |
| 444 | |
| 445 | ## v0.22.1 |
| 446 | |
| 447 | ### Fixed |
| 448 | |
| 449 | - Fixed high memory usage when running range queries against Prometheus servers. |
| 450 | |
| 451 | ## v0.22.0 |
| 452 | |
| 453 | ### Changed |
| 454 | |
| 455 | - The way `pint` sends API requests to Prometheus was changed to improve performance. |
| 456 | |
| 457 | First change is that each `prometheus` server definition in `pint` config file can |
| 458 | now accept optional `concurrency` field (defaults to 16) that sets a limit on how |
| 459 | many concurrent requests can that server receive. There is a new metric that |
| 460 | tracks how many queries are currently being run for each Prometheus server - |
| 461 | `pint_prometheus_queries_running`. |
| 462 | |
| 463 | Second change is that range queries will now be split into smaller queries, so |
| 464 | if `pint` needs to run a range query on one week of metrics, then it will break |
| 465 | this down into multiple queries each for a two hour slot, and then merge all |
| 466 | the results. Previously it would try to run a single query for a whole week |
| 467 | and if that failed it would reduce time range until a query would succeed. |
| 468 | |
| 469 | ### Fixed |
| 470 | |
| 471 | - Strict parsing mode didn't fully validate rule group files, this is now fixed |
| 472 | and pint runs the same set of checks as Prometheus. |
| 473 | - Fixed `promql/series` handling of rules with `{__name__=~"foo|bar"}` queries. |
| 474 | - If Prometheus was stopped or restarted `promql/series` would occasionally |
| 475 | report metrics as "sometimes present". This check will now try to find time |
| 476 | ranges with no metrics in Prometheus and ignore these when checking if |
| 477 | metrics are present. |
| 478 | |
| 479 | ## v0.21.1 |
| 480 | |
| 481 | ### Fixed |
| 482 | |
| 483 | - `pint_prometheus_queries_total` and `pint_prometheus_cache_hits_total` metric wasn't |
| 484 | always correctly updated. |
| 485 | - Ignore `unknown` metric types in `promql/rate`. |
| 486 | |
| 487 | ## v0.21.0 |
| 488 | |
| 489 | ### Added |
| 490 | |
| 491 | - `promql/rate` check will now report if `rate()` or `irate()` function is being |
| 492 | passed a non-counter metric. |
| 493 | |
| 494 | ## v0.20.0 |
| 495 | |
| 496 | ### Fixed |
| 497 | |
| 498 | - pint will now correctly handle YAML anchors. |
| 499 | |
| 500 | ## v0.19.0 |
| 501 | |
| 502 | ### Added |
| 503 | |
| 504 | - Parsing files in relaxed mode will now try to find rules inside multi-line strings #252. |
| 505 | This allows direct linting of k8s manifests like the one below: |
| 506 | |
| 507 | ```yaml |
| 508 | --- |
| 509 | kind: ConfigMap |
| 510 | apiVersion: v1 |
| 511 | metadata: |
| 512 | name: example-app-alerts |
| 513 | labels: |
| 514 | app: example-app |
| 515 | data: |
| 516 | alerts: | |
| 517 | groups: |
| 518 | - name: example-app-alerts |
| 519 | rules: |
| 520 | - alert: Example_Is_Down |
| 521 | expr: kube_deployment_status_replicas_available{namespace="example-app"} < 1 |
| 522 | for: 5m |
| 523 | labels: |
| 524 | priority: "2" |
| 525 | environment: production |
| 526 | annotations: |
| 527 | summary: "No replicas for Example have been running for 5 minutes" |
| 528 | ``` |
| 529 | |
| 530 | ## v0.18.1 |
| 531 | |
| 532 | ### Fixed |
| 533 | |
| 534 | - Fixed incorrect line reported when pint fails to unmarshall YAML file. |
| 535 | |
| 536 | ## v0.18.0 |
| 537 | |
| 538 | ### Added |
| 539 | |
| 540 | - Allow fine tuning `promql/series` check with extra control comments |
| 541 | `# pint rule/set promql/series min-age ...` and |
| 542 | `# pint rule/set promql/series ignore/label-value ...` |
| 543 | See [promql/series](checks/promql/series.md) for details. |
| 544 | - `promql/regexp` will report redundant use of regex anchors. |
| 545 | |
| 546 | ### Changed |
| 547 | |
| 548 | - `promql/series` will now report missing metrics only if they were last seen |
| 549 | over 2 hours ago by default. This can be customized per rule with comments. |
| 550 | |
| 551 | ## v0.17.7 |
| 552 | |
| 553 | ### Fixed |
| 554 | |
| 555 | - Fix problem line reporting for `rule/owner` check. |
| 556 | - Add missing `rule/owner` documentation page. |
| 557 | |
| 558 | ## v0.17.6 |
| 559 | |
| 560 | ### Fixed |
| 561 | |
| 562 | - Fixed false positive reports from `promql/series` check when running |
| 563 | `pint watch`. |
| 564 | |
| 565 | ## v0.17.5 |
| 566 | |
| 567 | ### Added |
| 568 | |
| 569 | - Added `pint_last_run_duration_seconds` metric. |
| 570 | - Added `--require-owner` flag support to `pint ci` command. |
| 571 | |
| 572 | ### Fixed |
| 573 | |
| 574 | - Better handling of YAML unmarshal errors. |
| 575 | |
| 576 | ## v0.17.4 |
| 577 | |
| 578 | ### Fixed |
| 579 | |
| 580 | - Fixed false positive reports from `alerts/template` check when `absent()` is |
| 581 | used inside a binary expression. |
| 582 | |
| 583 | ## v0.17.3 |
| 584 | |
| 585 | ### Fixed |
| 586 | |
| 587 | - File parse errors didn't report correct line numbers when running `pint ci`. |
| 588 | |
| 589 | ## v0.17.2 |
| 590 | |
| 591 | ### Fixed |
| 592 | |
| 593 | - File parse errors were not reported correctly when running `pint ci`. |
| 594 | |
| 595 | ## v0.17.1 |
| 596 | |
| 597 | ### Fixed |
| 598 | |
| 599 | - Handle `504 Gateway Timeout` HTTP responses from Prometheus same as query |
| 600 | timeouts and retry with a shorter range query. |
| 601 | |
| 602 | ## v0.17.0 |
| 603 | |
| 604 | ### Added |
| 605 | |
| 606 | - When running `pint ci` all checks will be skipped if any commit contains |
| 607 | `[skip ci]` or `[no ci]` string in the commit message. |
| 608 | |
| 609 | ### Changed |
| 610 | |
| 611 | - By default pint will now parse all files in strict mode, where all rule files |
| 612 | must have the exact syntax Prometheus expects: |
| 613 | |
| 614 | ```yaml |
| 615 | groups: |
| 616 | - name: example |
| 617 | rules: |
| 618 | - record: ... |
| 619 | expr: ... |
| 620 | ``` |
| 621 | |
| 622 | Previous releases were only looking for individual rules so `groups` object |
| 623 | wasn't required. Now pint will fail to read any file that doesn't follow |
| 624 | Prometheus syntax exactly. |
| 625 | To enable old behavior add `parser { relaxed = ["(.+)", ...]}` option in |
| 626 | the config file. See [Configuration](configuration.md) for details. |
| 627 | To enable old (relaxed) behavior for all files add: |
| 628 | |
| 629 | ```yaml |
| 630 | parser { |
| 631 | relaxed = ["(.*)"] |
| 632 | } |
| 633 | ``` |
| 634 | |
| 635 | ### Fixed |
| 636 | |
| 637 | - Improved `promql/vector_matching` checks to detect more issues. |
| 638 | - Fixed reporting of problems detected on unmodified lines when running `pint ci`. |
| 639 | |
| 640 | ## v0.16.1 |
| 641 | |
| 642 | ### Fixed |
| 643 | |
| 644 | - Fixed false positive reports from `alerts/template` check when `absent()` function |
| 645 | is receiving labels from a binary expression. |
| 646 | |
| 647 | ## v0.16.0 |
| 648 | |
| 649 | ### Added |
| 650 | |
| 651 | - When running `pint watch` exported metric can include `owner` label for each rule. |
| 652 | This is useful to route alerts based on `pint_problem` metrics to the right team. |
| 653 | To set a rule owner add a `# pint file/owner $owner` comment in a file, to set |
| 654 | an owner for all rules in that file. You can also set an owner per rule, by adding |
| 655 | `# pint rule/owner $owner` comment around given rule. |
| 656 | To enforce ownership comments in all files pass `--require-owner` flag to `pint lint`. |
| 657 | |
| 658 | ## v0.15.7 |
| 659 | |
| 660 | ### Fixed |
| 661 | |
| 662 | - `promql/series` check no longer runs duplicated checks on source metrics when |
| 663 | a query depends on a recording rule added in the same PR. |
| 664 | |
| 665 | ## v0.15.6 |
| 666 | |
| 667 | ### Fixed |
| 668 | |
| 669 | - `promql/series` check was reporting that a metric stopped being exported when check |
| 670 | queries would require a few retries. |
| 671 | |
| 672 | ## v0.15.5 |
| 673 | |
| 674 | ### Fixed |
| 675 | |
| 676 | - `promql/series` check was reporting both `Warning` and `Bug` problems for the |
| 677 | same metric when it was using newly added recording rule. |
| 678 | |
| 679 | ## v0.15.4 |
| 680 | |
| 681 | ### Fixed |
| 682 | |
| 683 | - Fixed false positive reports from `promql/fragile` when `foo OR bar` is used inside |
| 684 | aggregation. |
| 685 | |
| 686 | ## v0.15.3 |
| 687 | |
| 688 | ### Fixed |
| 689 | |
| 690 | - Use more efficient queries for `promql/series` check. |
| 691 | - Fixed YAML parsing panics detected by Go 1.18 fuzzing. |
| 692 | |
| 693 | ## v0.15.2 |
| 694 | |
| 695 | ### Fixed |
| 696 | |
| 697 | - Improved query cache hit rate and added `pint_prometheus_cache_hits_total` metric |
| 698 | to track the number of cache hits. |
| 699 | |
| 700 | ## v0.15.1 |
| 701 | |
| 702 | ### Added |
| 703 | |
| 704 | - When a range query returns `query processing would load too many samples into memory` |
| 705 | error and we retry it with smaller time range cache this information and start with |
| 706 | that smaller time range for future calls to speed up running `pint watch`. |
| 707 | |
| 708 | ## v0.15.0 |
| 709 | |
| 710 | ### Changed |
| 711 | |
| 712 | - Always print the number of detected problems when running `pint lint`. |
| 713 | - `promql/series` check was refactored and will now detect a range of |
| 714 | problems. See [promql/series](checks/promql/series.md) for details. |
| 715 | - `promql/regexp` severity is now `Bug` instead of a `Warning`. |
| 716 | - `promql/rate` check will no longer produce warnings, it will only |
| 717 | report issues that cause queries to never return anything. |
| 718 | |
| 719 | ## v0.14.0 |
| 720 | |
| 721 | ### Added |
| 722 | |
| 723 | - Allow matching alerting rules by `for` field - #148. Example: |
| 724 | |
| 725 | ```js |
| 726 | rule { |
| 727 | match { |
| 728 | for = ">= 10m" |
| 729 | } |
| 730 | } |
| 731 | ``` |
| 732 | - Regexp matchers used in check rules can now reference rule fields. |
| 733 | See [Configuration](configuration.md) for details. |
| 734 | |
| 735 | ### Changed |
| 736 | |
| 737 | - Added `filename` label to `pint_problem` metric - #170. |
| 738 | - Include Prometheus server URI in reported problems. |
| 739 | |
| 740 | ### Fixed |
| 741 | |
| 742 | - Fixed `pint ci` handling when a file was added to git and then removed in the |
| 743 | next commit. |
| 744 | |
| 745 | ## v0.13.2 |
| 746 | |
| 747 | ### Fixed |
| 748 | |
| 749 | - `yaml/parse` was using incorrect line numbers for errors caused by duplicated |
| 750 | YAML keys. |
| 751 | |
| 752 | ## v0.13.1 |
| 753 | |
| 754 | ### Fixed |
| 755 | |
| 756 | - Don't use failover Prometheus servers in case of errors caused by the query |
| 757 | itself, like `many-to-many matching not allowed`. |
| 758 | |
| 759 | ## v0.13.0 |
| 760 | |
| 761 | ### Added |
| 762 | |
| 763 | - `yaml/parse` error will be raised if a rule file contains duplicated keys, example: |
| 764 | |
| 765 | ```yaml |
| 766 | - record: foo |
| 767 | expr: sum(my_metric) |
| 768 | expr: sum(my_metric) without(instance) |
| 769 | ``` |
| 770 | |
| 771 | ### Changed |
| 772 | |
| 773 | - `prometheus` config block now allows to specify failover URIs using `failover` field. |
| 774 | If failover URIs are set and main URI fails to respond pint will attempt to use them |
| 775 | in the order specified until one of them works. |
| 776 | - `prometheus` config block now allows to define how upstream errors are handled using |
| 777 | `required` field. If `required` is set to `true` any check that depends on remote |
| 778 | Prometheus server will be reported as `bug` if it's unable to talk to it. |
| 779 | If `required` is set to `false` pint will only emit `warning` level results. |
| 780 | Default value for `required` is `false`. Set it to `true` if you want to hard fail |
| 781 | in case of remote Prometheus issues. Note that setting it to `true` might block |
| 782 | PRs when running `pint ci` until pint is able to talk to Prometheus again. |
| 783 | - Renamed `pint/parse` to `yaml/parse` and added missing documentation for it. |
| 784 | |
| 785 | ## v0.12.0 |
| 786 | |
| 787 | ### Added |
| 788 | |
| 789 | - Added `pint_last_run_time_seconds` and `pint_rules_parsed_total` metrics when running `pint watch`. |
| 790 | |
| 791 | ### Changed |
| 792 | |
| 793 | - `promql/comparison` only applies to alerts, so it was renamed to |
| 794 | `alerts/comparison`. |
| 795 | - Online documentation hosted at [cloudflare.github.io/pint](https://cloudflare.github.io/pint/) |
| 796 | was reworked. |
| 797 | - `alerts/count` check will now retry range queries with shorter time window |
| 798 | on `found duplicate series for the match group ...` errors from Prometheus. |
| 799 | |
| 800 | ## v0.11.1 |
| 801 | |
| 802 | ### Fixed |
| 803 | |
| 804 | - `pint_prometheus_queries_total` and `pint_prometheus_query_errors_total` metrics |
| 805 | were not incremented correctly. |
| 806 | |
| 807 | ## v0.11.0 |
| 808 | |
| 809 | ### Added |
| 810 | |
| 811 | - Added `promql/regexp` check that will warn about unnecessary regexp matchers. |
| 812 | - Added `pint_prometheus_queries_total` and `pint_prometheus_query_errors_total` |
| 813 | metric when running `pint watch`. |
| 814 | |
| 815 | ## v0.10.1 |
| 816 | |
| 817 | ### Fixed |
| 818 | |
| 819 | - Fixed a number of bug with `promql/vector_matching` check. |
| 820 | |
| 821 | ## v0.10.0 |
| 822 | |
| 823 | ### Changed |
| 824 | |
| 825 | - `query/series` check was renamed to `promql/series`. |
| 826 | |
| 827 | ### Fixed |
| 828 | |
| 829 | - Improved the logic of `promql/vector_matching` check. |
| 830 | |
| 831 | ## v0.9.0 |
| 832 | |
| 833 | ### Changed |
| 834 | |
| 835 | - Removed `lines` label from `pint_problem` metric exported when running `pint watch`. |
| 836 | - Multiple `match` and `ignore` blocks can now be specified per each `rule`. |
| 837 | |
| 838 | ## v0.8.2 |
| 839 | |
| 840 | ### Added |
| 841 | |
| 842 | - Export `pint_version` metric when running `pint watch`. |
| 843 | - Added `--min-severity` flag to `pint watch` command. |
| 844 | |
| 845 | ## v0.8.1 |
| 846 | |
| 847 | ### Added |
| 848 | |
| 849 | - Added `--max-problems` flag to `pint watch` command. |
| 850 | |
| 851 | ### Changed |
| 852 | |
| 853 | - Updated Prometheus modules to [v2.33.0](https://github.com/prometheus/prometheus/releases/tag/v2.33.0). |
| 854 | This adds support for `stripPort` template function. |
| 855 | |
| 856 | ## v0.8.0 |
| 857 | |
| 858 | ### Added |
| 859 | |
| 860 | - Added new `promql/fragile` check. |
| 861 | - BitBucket reports will now include a link to documentation. |
| 862 | |
| 863 | ## v0.7.3 |
| 864 | |
| 865 | ### Added |
| 866 | |
| 867 | - `--workers` flag to control the number of worker threads for running checks. |
| 868 | |
| 869 | ## v0.7.2 |
| 870 | |
| 871 | ### Changed |
| 872 | |
| 873 | - More aggressive range reduction for `query processing would load too many samples into memory` |
| 874 | errors when sending range queries to Prometheus servers. |
| 875 | |
| 876 | ## v0.7.1 |
| 877 | |
| 878 | ### Added |
| 879 | |
| 880 | - Added `command` filter to `match` / `ignore` blocks. This allows to include |
| 881 | skip some checks when (for example) running `pint watch` but include them |
| 882 | in `pint lint` run. |
| 883 | |
| 884 | ## v0.7.0 |
| 885 | |
| 886 | ### Added |
| 887 | |
| 888 | - Cache each Prometheus server responses to minimize the number of API calls. |
| 889 | - `pint watch` will start a daemon that will continuously check all matching rules |
| 890 | and expose metrics describing all discovered problems. |
| 891 | |
| 892 | ### Changed |
| 893 | |
| 894 | - `alerts/annotation` and `rule/label` now include `required` flag value in |
| 895 | `# pint disable ...` comments. |
| 896 | Rename `# pint disable alerts/annotation($name)` to |
| 897 | `# pint disable alerts/annotation($name:$required)` and |
| 898 | `# pint disable rule/label($name)` to `# pint disable rule/label($name:$required)`. |
| 899 | - `--offline` and `--disabled` flags are now global, use `pint --offline lint` instead |
| 900 | of `pint lint --offline`. |
| 901 | |
| 902 | ### Fixed |
| 903 | |
| 904 | - `promql/rate`, `query/series` and `promql/vector_matching` checks were not enabled |
| 905 | for all defined `prometheus {}` blocks unless there was at least one `rule {}` block. |
| 906 | - `annotation` based `match` blocks didn't work correctly. |
| 907 | |
| 908 | ## v0.6.6 |
| 909 | |
| 910 | ### Fixed |
| 911 | |
| 912 | - File renames were not handled correctly when running `git ci` on branches with |
| 913 | multiple commits. |
| 914 | |
| 915 | ## v0.6.5 |
| 916 | |
| 917 | ### Added |
| 918 | |
| 919 | - Allow disabling `query/series` check for individual series using |
| 920 | `# pint disable query/series(my_metric_name)` comments. |
| 921 | |
| 922 | ## v0.6.4 |
| 923 | |
| 924 | ### Fixed |
| 925 | |
| 926 | - Fixed docker builds. |
| 927 | |
| 928 | ## v0.6.3 |
| 929 | |
| 930 | ### Fixed |
| 931 | |
| 932 | - `aggregate` check didn't report stripping required labels on queries |
| 933 | using aggregation with no grouping labels (`sum(foo)`). |
| 934 | - `aggregate` check didn't test for name and label matches on alert rules. |
| 935 | |
| 936 | ## v0.6.2 |
| 937 | |
| 938 | ### Changed |
| 939 | |
| 940 | - `template` check will now include alert query line numbers when reporting issues. |
| 941 | |
| 942 | ## v0.6.1 |
| 943 | |
| 944 | ### Fixed |
| 945 | |
| 946 | - Labels returned by `absent()` are only from equal match types (`absent(foo="bar")`, |
| 947 | not `absent(foo=~"bar.+")` but `alerts/template` didn't test for match type when |
| 948 | checking for labels sourced from `absent()` queries. |
| 949 | |
| 950 | ## v0.6.0 |
| 951 | |
| 952 | ### Changed |
| 953 | |
| 954 | - `aggregate` check was refactored and uses to run a single test for both |
| 955 | `by` and `without` conditions. As a result this check might now find issues |
| 956 | previously undetected. |
| 957 | Check suppression comments will need to be migrated: |
| 958 | * `# pint disable promql/by` becomes `# pint disable promql/aggregate` |
| 959 | * `# pint disable promql/without` becomes `# pint disable promql/aggregate` |
| 960 | * `# pint ignore promql/by` becomes `# pint ignore promql/aggregate` |
| 961 | * `# pint ignore promql/without` becomes `# pint ignore promql/aggregate` |
| 962 | |
| 963 | ## v0.5.3 |
| 964 | |
| 965 | ### Fixed |
| 966 | |
| 967 | - Fixed false positive reports in `aggregate` check. |
| 968 | |
| 969 | ## v0.5.2 |
| 970 | |
| 971 | ### Added |
| 972 | |
| 973 | - `--no-color` flag for disabling output colouring. |
| 974 | |
| 975 | ### Fixed |
| 976 | |
| 977 | - Fixed duplicated warnings when multiple `rule {...}` blocks where configured. |
| 978 | |
| 979 | ## v0.5.1 |
| 980 | |
| 981 | ### Fixed |
| 982 | |
| 983 | - Specifying multiple `# pint disable ...` comments on a single rule would only apply |
| 984 | last comment. This now works correctly and all comments will be applied. |
| 985 | |
| 986 | ## v0.5.0 |
| 987 | |
| 988 | ### Added |
| 989 | |
| 990 | - Added `alerts/for` check that will look for invalid `for` values in alerting rules. |
| 991 | This check is enabled by default. |
| 992 | |
| 993 | ### Changed |
| 994 | |
| 995 | - `comparison` check is now enabled by default and require no configuration. |
| 996 | Remove `comparison{ ... }` blocks from pint config file when upgrading. |
| 997 | - `template` check is now enabled by default and require no configuration. |
| 998 | Remove `template{ ... }` blocks from pint config file when upgrading. |
| 999 | - `rate` check is now enabled by default for all configured Prometheus servers. |
| 1000 | Remove `rate{ ... }` blocks from pint config file when upgrading. |
| 1001 | - `series` check is now enabled by default for all configured Prometheus servers. |
| 1002 | Remove `series{ ... }` blocks from pint config file when upgrading. |
| 1003 | - `vector_matching` check is now enabled by default for all configured Prometheus servers. |
| 1004 | Remove `vector_matching{ ... }` blocks from pint config file when upgrading. |
| 1005 | |
| 1006 | ## v0.4.4 |
| 1007 | |
| 1008 | ### Added |
| 1009 | |
| 1010 | - Support `parseDuration` function in alert templates added in Prometheus 2.32.0 |
| 1011 | |
| 1012 | ## v0.4.3 |
| 1013 | |
| 1014 | ### Fixed |
| 1015 | |
| 1016 | - Fixed `series` check handling of queries with `{__name__="foo"}` selectors. |
| 1017 | |
| 1018 | ## v0.4.2 |
| 1019 | |
| 1020 | ### Fixed |
| 1021 | |
| 1022 | - Fixed `template` check handling of `absent` calls on aggregated metrics, like |
| 1023 | `absent(sum(nonexistent{job="myjob"}))`. |
| 1024 | |
| 1025 | ## v0.4.1 |
| 1026 | |
| 1027 | ### Added |
| 1028 | |
| 1029 | - `template` check will now warn if any template is referencing a label that is not passed to |
| 1030 | `absent()`. |
| 1031 | Example: |
| 1032 | |
| 1033 | {% raw %} |
| 1034 | ```yaml |
| 1035 | - alert: Foo |
| 1036 | expr: absent(foo{env="prod"}) |
| 1037 | annotations: |
| 1038 | summary: 'foo metric is missing for job {{ $labels.job }}' |
| 1039 | ``` |
| 1040 | {% endraw %} |
| 1041 | |
| 1042 | Would generate a warning since `absent()` can only return labels that are explicitly |
| 1043 | passed to it and the above call only passes `env` label. |
| 1044 | This can be fixed by updating the query to `absent(foo{env="prod", job="bar"})`. |
| 1045 | |
| 1046 | ## v0.4.0 |
| 1047 | |
| 1048 | ### Added |
| 1049 | |
| 1050 | - `comparison` check will now warn when alert query uses |
| 1051 | [bool](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators) |
| 1052 | modifier after condition, which can cause alert to always fire. |
| 1053 | Example: |
| 1054 | |
| 1055 | ```yaml |
| 1056 | - alert: Foo |
| 1057 | expr: rate(error_count[5m]) > bool 5 |
| 1058 | ``` |
| 1059 | |
| 1060 | Having `bool` as part of `> 5` condition means that the query will return value `1` when condition |
| 1061 | is met, and `0` when it's not. Rather than returning value of `rate(error_count[5m])` only when |
| 1062 | that value is `> 5`. Since all results of an alerting rule `expr` are considered alerts such alert |
| 1063 | rule could always fire, regardless of the value returned by `rate(error_count[5m])`. |
| 1064 | |
| 1065 | ### Fixed |
| 1066 | |
| 1067 | - `comparison` check will now ignore `absent(foo)` alert queries without any condition. |
| 1068 | |
| 1069 | ## v0.3.1 |
| 1070 | |
| 1071 | ### Added |
| 1072 | |
| 1073 | - `--offline` flag for `pint ci` command. |
| 1074 | |
| 1075 | ### Fixed |
| 1076 | |
| 1077 | - Fixed `template` check panic when alert query had a syntax error. |
| 1078 | |
| 1079 | ## v0.3.0 |
| 1080 | |
| 1081 | ### Added |
| 1082 | |
| 1083 | - `rule` block can now specify `ignore` conditions that have the same syntax as `match` |
| 1084 | but will disable `rule` for matching alerting and recording rules #48. |
| 1085 | - `match` and `ignore` blocks can now filter alerting and recording rules by name. |
| 1086 | `record` will be used as name for recording rules and `alert` for alerting rules. |
| 1087 | |
| 1088 | ## v0.2.0 |
| 1089 | |
| 1090 | ### Added |
| 1091 | |
| 1092 | - `--offline` flag for `pint lint` command. When passed only checks that don't send |
| 1093 | any live queries to Prometheus server will be run. |
| 1094 | - `template` check will now warn if template if referencing a label that is being |
| 1095 | stripped by aggregation. |
| 1096 | Example: |
| 1097 | |
| 1098 | {% raw %} |
| 1099 | ```yaml |
| 1100 | - alert: Foo |
| 1101 | expr: count(up) without(instance) == 0 |
| 1102 | annotations: |
| 1103 | summary: 'foo is down on {{ $labels.instance }}' |
| 1104 | ``` |
| 1105 | {% endraw %} |
| 1106 | |
| 1107 | Would generate a warning since `instance` label is being stripped by `without(instance)`. |
| 1108 | |
| 1109 | ## v0.1.5 |
| 1110 | |
| 1111 | ### Fixed |
| 1112 | |
| 1113 | - Fixed file descriptor leak due to missing file `Close()` #69. |
| 1114 | |
| 1115 | ## v0.1.4 |
| 1116 | |
| 1117 | ### Changed |
| 1118 | |
| 1119 | - Retry queries that error with `query processing would load too many samples into memory` |
| 1120 | using a smaller time range. |
| 1121 | |
| 1122 | ## v0.1.3 |
| 1123 | |
| 1124 | ### Added |
| 1125 | |
| 1126 | - `vector_matching` check for finding queries with incorrect `on()` or `ignoring()` |
| 1127 | keywords. |
| 1128 | |
| 1129 | ### Fixed |
| 1130 | |
| 1131 | - `comparison` check would trigger false positive for rules using `unless` keyword. |
| 1132 | |
| 1133 | ## v0.1.2 |
| 1134 | |
| 1135 | ### Fixed |
| 1136 | |
| 1137 | - `# pint skip/line` place between `# pint skip/begin` and `# pint skip/end` lines would |
| 1138 | reset ignore rules causing lines that should be ignored to be parsed. |
| 1139 | |
| 1140 | ## v0.1.1 |
| 1141 | |
| 1142 | ### Changed |
| 1143 | |
| 1144 | - `value` check was replaced by `template`, which covers the same functionality and more. |
| 1145 | See [docs](/docs/CONFIGURATION.md#template) for details. |
| 1146 | |