Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Adds a label names API #191

Merged
merged 2 commits into from
Sep 5, 2022
Merged

Adds a label names API #191

merged 2 commits into from
Sep 5, 2022

Conversation

cyriltovena
Copy link
Collaborator

This adds a label names API to fire and the datasource too.

@@ -31,6 +31,8 @@ export function QueryEditor(props: Props) {
useMount(async () => {
const profileTypes = await props.datasource.getProfileTypes();
setProfileTypes(profileTypes);
// todo remove me.
console.log(await props.datasource.getLabelNames());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joey-grafana This is how to use it, we should probably do this on demand when trying to select name.

Copy link
Collaborator

@simonswine simonswine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but take a look at my comment 🙂

Comment on lines 363 to 365
result := lo.Reject(values, func(name string, _ int) bool {
return strings.HasPrefix(name, "__")
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too sure about this, e.g. prometheus returns _name_ on the equivalent endpoint.

$ curl -s https://prometheus.demo.do.prometheus.io/api/v1/labels | jq .                                                                                                                                                                                                                                                                                                             
{
  "status": "success",
  "data": [
    "__name__",
    "action",
    "address",
[...]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok may be we can leave it ?

Copy link
Collaborator Author

@cyriltovena cyriltovena Sep 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave them they should be filtered out by the UI though @joey-grafana anything that start with __ should not be shown on the ui.

@cyriltovena cyriltovena merged commit 557486e into main Sep 5, 2022
@cyriltovena cyriltovena deleted the labelnames branch September 5, 2022 07:39
simonswine pushed a commit to simonswine/pyroscope that referenced this pull request Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants