google / slo-generator

SLO Generator computes SLIs, SLOs, Error Budgets and Burn Rates from supported backends, then exports an SLO report to supported targets.
Apache License 2.0
489 stars 78 forks source link

🐛 [BUG] - Datadog backend -> good_bad_ratio method #478

Closed maximepln closed 5 months ago

maximepln commented 5 months ago

SLO Generator Version

image: slo-generator:2.6.0

Python Version

3+

What happened?

While trying to implement a Latency SLO on a log based metric with the good_bad_ratio method.

We encounter a bug without any workaround, the following line defined in the datadog-backend make it impossible to use distinct method to count events and therefore impossible to create the SLO itself.

To illustrate my point, such definition are impossible:

    method: good_bad_ratio
    service_level_indicator:
    query_good:  >-
      count(v: v<=1):http.nginx_ingress.logs_based_latency{service:myservice
      AND method:post
      AND env:production
      AND ((path:pathOR path:v1/path) AND NOT path:*path*)
      AND (status_code:2* OR status_code:3*)} 
    query_valid: >-
      count:http.nginx_ingress.logs_based_latency{service:myservice
      AND method:post
      AND env:production
      AND ((path:path OR path:v1/path) AND NOT path:*path*)
      AND (status_code:2* OR status_code:3*)}

What did you expect?

Not having the operator and operator_suffix overload when they are already set in the query

Screenshots

No response

Relevant log output

No response

Code of Conduct

ocervell commented 5 months ago

Did you try to remove the / at the end of the first query and set operator: null in your config ?

maximepln commented 5 months ago

Hello there,

The slash was a typo, sorry about that.

I tried with the operator: null and it worked ! It wasn't clear in the documentation that, this kind of option was available.

Thanks,