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

Is there a way to define default for a metric by default if not present #584

Open
varunvijayagopal opened this issue May 19, 2023 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/support Categorizes issue or PR as a support question. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@varunvijayagopal
Copy link

varunvijayagopal commented May 19, 2023

We use istio_requests_total for scaling . However this metric comes into picture only when we try to hit endpoint of service .
/stats/proemetheus endpoint doesn't give this metric by default .
Since we use this hpa , it comes as UNKNOWN till that service is accessed .
I tried to add vector(0) so that if not present it gives a counter of 0 and this works fine on prometheus but still prometheus adapter complains with 404

Below is the query which we ar esuing

seriesQuery: istio_requests_total{destination_service_name!="",reporter="destination", destination_workload_namespace!=""}
resources:
overrides:
destination_service_name: { resource: "service" }
destination_workload_namespace: { resource: "namespace" }
name:
matches: "^(.*)_total"
as: "${1}_per_second"
metricsQuery: 'sum(rate(<<.Series>>{reporter="destination", <<.LabelMatchers>>}[1m]) or vector(0)) by (<<.GroupBy>>)'

@varunvijayagopal varunvijayagopal added the kind/bug Categorizes issue or PR as related to a bug. label May 19, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 19, 2023
@dgrisonnet
Copy link
Member

/kind support
/triage accepted
/assign

@k8s-ci-robot k8s-ci-robot added kind/support Categorizes issue or PR as a support question. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 29, 2023
@huguesgr
Copy link

huguesgr commented Dec 4, 2023

I'm interested in this, have you found a workaround?

@dgrisonnet dgrisonnet removed their assignment Dec 6, 2023
@dgrisonnet
Copy link
Member

I don't think this was ever fixed

@huguesgr
Copy link

huguesgr commented Dec 6, 2023

I found something that works in my use-case:

metricsQuery: <<.Series>>{<<.LabelMatchers>>} or clamp_max(absent(<<.Series>>{<<.LabelMatchers>>}),0)

@k8s-triage-robot
Copy link

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

  • Confirm that this issue is still relevant with /triage accepted (org members only)
  • Close this issue with /close

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. and removed triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/support Categorizes issue or PR as a support question. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

5 participants