Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

promql expr validation issues #510

Closed
LinTechSo opened this issue Jun 16, 2023 · 2 comments
Closed

promql expr validation issues #510

LinTechSo opened this issue Jun 16, 2023 · 2 comments

Comments

@LinTechSo
Copy link

Hi.
promql expr validator in code caused issues because of lack of compatibility with some new promql inspired query engines like MetricsQL.
I think it would be helpful if we add some feature to sloth to allow people to disable promql validation if they want

For example:

i want to create a SLO from this SLI

version: "prometheus/v1"
service: "myservice"
slos:
## Latency
  - name: "my_metricsql-query"
    objective: 99.5
    description: ""
    sli:
      events:
        error_query: sum(count_over_time((my-metrics{} > 15)) OR on() vector(0) )
        total_query: sum(count_over_time((my-metric{})) OR on() vector(0))
    alerting:
      page_alert:
        disable: true
      ticket_alert:
        disable: true 

but i got error

INFO[0000] SLI plugins loaded                            plugins=0 svc=storage.FileSLIPlugin version=v0.11.0 window=30d
INFO[0000] SLO period windows loaded                     svc=alert.WindowsRepo version=v0.11.0 window=30d windows=2
INFO[0000] Generating from Prometheus spec               version=v0.11.0 window=30d
error: "generate" command failed: could not generate Prometheus format rules: could not generate prometheus rules: invalid SLO group: Key: 'SLOGroup.SLOs[0].SLI.Events.ErrorQuery' Error:Field validation for 'ErrorQuery' failed on the 'prom_expr' tag
Key: 'SLOGroup.SLOs[0].SLI.Events.TotalQuery' Error:Field validation for 'TotalQuery' failed on the 'prom_expr' tag

My query is actually correct and give me response from VictoriaMetrics in grafana with VictoriaMetrics prometheus data source

My suggestion is adding a capability of disabling promexpr validation with some flag
for example:

sloth generate -i ../my-victoriametrics-queries/test.yml -o /tmp/test.yaml --disable-promExpr-validation
@LinTechSo
Copy link
Author

I created a pull request for fix this issue
#511

i would appreciate if you check it

@LinTechSo
Copy link
Author

LinTechSo commented Jul 21, 2023

According to below PRs this issues has fixed
#512
and
r3code#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant