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

Question: Is there a way to refer totalQuery via template variable in errorQuery #509

Open
Antiarchitect opened this issue Jun 15, 2023 · 0 comments

Comments

@Antiarchitect
Copy link

Antiarchitect commented Jun 15, 2023

There are some cases in which errorQuery is calculated by substracting from total (bad = total - good) e.g.:

  errorQuery: >-
    (
      sum(rate(istio_request_duration_milliseconds_count{reporter="destination", destination_workload_namespace="dest", source_workload_namespace="src", request_protocol="http"}[{{.window}}]))
      -
      sum(rate(istio_request_duration_milliseconds_bucket{reporter="destination", destination_workload_namespace="dest", source_workload_namespace="src", request_protocol="http", le="10000"}[{{.window}}]))
    )
    OR on() vector(0)
  totalQuery: sum(rate(istio_request_duration_milliseconds_count{reporter="destination", destination_workload_namespace="dest", source_workload_namespace="src", request_protocol="http"}[{{.window}}])) OR on() vector(1)

It would be nice to be able to rewrite it this way:

  errorQuery: >-
    (
      {{.totalQuery}}
      -
      sum(rate(istio_request_duration_milliseconds_bucket{reporter="destination", destination_workload_namespace="dest", source_workload_namespace="src", request_protocol="http", le="10000"}[{{.window}}]))
    )
    OR on() vector(0)
  totalQuery: sum(rate(istio_request_duration_milliseconds_count{reporter="destination", destination_workload_namespace="dest", source_workload_namespace="src", request_protocol="http"}[{{.window}}])) OR on() vector(1)
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

No branches or pull requests

1 participant