pyrra-dev / pyrra

Making SLOs with Prometheus manageable, accessible, and easy to use for everyone!
https://demo.pyrra.dev
Apache License 2.0
1.17k stars 103 forks source link

New line inserted in the generated files #970

Open jmichalek132 opened 8 months ago

jmichalek132 commented 8 months ago

We we define an SLO

apiVersion: pyrra.dev/v1alpha1
kind: ServiceLevelObjective
metadata:
  name: grafana-requests-availability
  labels:
    pyrra.dev/owner: op
  annotations:
    pyrra.dev/dashboard_url: https://ffffffffffffffffffffffffffffffffff/d/ccssRIenz/slo-detail-pyrra?var-slo={{ $labels.slo }}
    pyrra.dev/message: "{{ $labels.slo }} has either high burn rate or missing SLO metric"
spec:
  target: '99.9'
  window: 28d
  indicator:
    ratio:
      errors:
        metric: grafana_http_request_duration_seconds_count{deployment_environment=~"prod", service_name="grafana", status_code=~"5.*"}
      total:
        metric: grafana_http_request_duration_seconds_count{deployment_environment="prod", service_name="grafana"}

and for e.g. add long enough annotation new line is inserted in the generated yaml file:

  - alert: SLOMetricAbsent
    annotations:
      dashboard_url: https://ffffffffffffffffffffffffffffffffff/d/ccssRIenz/slo-detail-pyrra?var-slo={{
        $labels.slo }}

Seems to be caused by https://github.com/go-yaml/yaml/issues/348#issuecomment-375422573. It doesn't seem to break anything but it does suprise people. WIll later look into what needs to be done to avoid this happening, seems the fix should be just upgrading the dependcy for yaml.

metalmatze commented 7 months ago

Makes sense. Good it doesn't break anything. This dependency is indirect and should update through these direct dependencies:

go mod why gopkg.in/yaml.v3

# gopkg.in/yaml.v3
github.com/pyrra-dev/pyrra
k8s.io/apimachinery/pkg/runtime
k8s.io/apimachinery/pkg/runtime.test
github.com/stretchr/testify/assert
gopkg.in/yaml.v3