-
Notifications
You must be signed in to change notification settings - Fork 552
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
Custom metric selector invalid label value #364
Comments
Hi @pytimer, A possible workaround would be to use external metrics and put your label selector directly inside of the
Note that moving to external metrics is required for this workaround as the labelSelectors given in the seriesQuery are currently filtered for custom metrics. |
Thanks @dgrisonnet . But if i setting In my case, the application output many metrics with |
From the look of it, I don't see any other option for your use case. The best would be to be able to modify the HPA to scale based on the That being said, it might be worth following up on this issue in the Kubernetes repository as I wouldn't expect external metrics' label selector to be tied to Kubernetes standard. IMO, it should be used to select metrics labels, not k8s labels. Thus, it shouldn't abide to Kubernetes' label standard. @s-urbaniak do you by any chance have other suggestions? |
If the HPA support metrics labels, it maybe involve in multiple repository, such as custom-metrics-apiserver, metrics, and also need to consider how to be compatible with existing interface. |
Another method that comes into my mind is relabeling during ingestion: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config You could write a regex that replaces However, a word of warning regarding using uris as label values. It very often can be a cause of cardinality explosion, especially if the amount of know URIs has a high upper bound or even worse if your metrics exposes all uri values, even unknown ones. Maybe rather use |
Thanks @s-urbaniak . I know use the uri on the potential effects on prometheus, i replaces But i think prometheus-adapter is best to support any format label value instead of k8s standard label. It maybe a bit wrong to propose this feature here. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
Let's keep track of this issue in #323. |
Hi,
I use custom metrics hpa, my application expose
http_server_requests_seconds_count
metric, and this metric like below:I want my application according the uri of metric to scale up/down. I can use
selector
to filter, but labeluri
value have/
character, i use this value as filter, hpa have the warning:invalid label value: "/company/security/v1/account/login": at key: "uri": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
.How to do with selector, or use another way?
My hpa:
The text was updated successfully, but these errors were encountered: