pint.error lint rules
! stdout .
cmp stderr stderr.txt

-- stderr.txt --
level=info msg="Loading configuration file" [36mpath=[0m.pint.hcl
level=info msg="File parsed" [36mpath=[0mrules/0001.yml [36mrules=[0m2
rules/0001.yml:11-13: link annotation is required (alerts/annotation)
    annotations:
      summary: "Instance {{ $labels.instance }} down"
      description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."

rules/0001.yml:17: instance label should be removed when aggregating "^colo(?:_.+)?:.+$" rules, remove instance from by() (promql/by)
    expr: sum by (instance) (http_inprogress_requests) > 0

rules/0001.yml:17: job label is required and should be preserved when aggregating "^.+$" rules, use by(job, ...) (promql/by)
    expr: sum by (instance) (http_inprogress_requests) > 0

rules/0001.yml:19-21: link annotation is required (alerts/annotation)
    annotations:
      summary: "High request latency on {{ $labels.instance }}"
      description: "{{ $labels.instance }} has a median request latency above 1s (current value: {{ $value }}s)"

level=info msg="Problems found" [36mBug=[0m2 [36mWarning=[0m2
level=fatal msg="Fatal error" [31merror=[0m[31m"problems found"[0m
-- rules/0001.yml --
groups:
- name: example
  rules:

  # Alert for any instance that is unreachable for >5 minutes.
  - alert: InstanceDown
    expr: up == 0
    for: 5m
    labels:
      severity: page
    annotations:
      summary: "Instance {{ $labels.instance }} down"
      description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."

  # Alert for any instance that has a median request latency >1s.
  - alert: APIHighRequestLatency
    expr: sum by (instance) (http_inprogress_requests) > 0
    for: 10m
    annotations:
      summary: "High request latency on {{ $labels.instance }}"
      description: "{{ $labels.instance }} has a median request latency above 1s (current value: {{ $value }}s)"

-- .pint.hcl --
rule {
    aggregate ".+" {
        keep = [ "job" ]
    }
}
rule {
    aggregate "colo(?:_.+)?:.+" {
        strip = [ "instance" ]
    }
    annotation "link" {
        required = true
        severity = "bug"
    }
}
