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

DT Metric Query is not executed properly when multiple parameters are provided in spec.query #1890

Closed
bacherfl opened this issue Aug 16, 2023 · 0 comments · Fixed by #1893
Closed
Assignees
Labels
bug Something isn't working metrics-operator

Comments

@bacherfl
Copy link
Member

When applying a KeptnMetric with a query that includes multiple parameters, such as the metricSelector and the from attribute, i.e.:

builtin:containers.cpu.throttledMilliCores:avg&from=now-2m

The dynatrace-provider will do an URL encoding of the complete query, rather than on the individual parameters (see

)

This means that the resulting query will look something like:

https://vcj06490.dev.dynatracelabs.com/api/v2/metrics/query?metricSelector=builtin%3Acontainers.cpu.throttledMilliCores%3%29%3Aavg%26from%3Dnow-2m

And the following error will be produced:

{"Response from provider was:": "{\"error\":{\"code\":400,\"message\":\"Metric selector parse error: line 1:324 token recognition error at: '&'\"}}", "error": "provider api response: Metric selector parse error: line 1:324 token recognition error at: '&'"}

This is because of the url encoding of the complete query, the from parameter was interpreted to be part of the metricSelectorparameter.
The correct URL should look as follows:

https://vcj06490.dev.dynatracelabs.com/api/v2/metrics/query?metricSelector=builtin%3Acontainers.cpu.throttledMilliCores%3%29%3Aavg&from=now-2m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working metrics-operator
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant