-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
(prometheus) get label name/value from series API #12251
(prometheus) get label name/value from series API #12251
Conversation
2d9622c
to
4bc735c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very useful addition!
Small implementation issue: We're trying to be less reliant on angular services, and hence want to prevent their leakage into plugin submodules. Could you add a function to the datasource instead that returns {start, end}
?
37741e1
to
1f3c39f
Compare
Okay, I change the code :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready:
- Please use
const { start, end } = this.getTimeRange();
withindatasource.ts
as well now whenstart
andend
are requested. Then this can be merged. - Please add types to all functions you added/modified.
return this.datasource.performInstantQuery({ expr: query }, new Date().getTime() / 1000).then(response => { | ||
this.labelQueryCache[expr] = response.data.data.result; | ||
return response.data.data.result; | ||
let range = this.datasource.getTimeRange(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be const { start, end } = this.datasource.getTimeRange();
Also, url
below should be const
.
Should I add types like |
The types are good as is now. Thank you. Could please rebase? Then we can merge. |
5202c16
to
bf88402
Compare
rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your contribution!
instant query doesn't return all label name/value of dashboard time range.
So, change to use series API.
https://prometheus.io/docs/prometheus/latest/querying/api/#finding-series-by-label-matchers