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

Customize legend #58

Closed
jotak opened this issue Feb 22, 2017 · 9 comments
Closed

Customize legend #58

jotak opened this issue Feb 22, 2017 · 9 comments

Comments

@jotak
Copy link
Collaborator

jotak commented Feb 22, 2017

Provide a way to display custom legend instead of the metric name, which sometimes is not user-friendly at all.

Allow the use of variables / tags in legend template?

@hardbone12
Copy link

Maybe just use "pod_name", "pod_namespace/pod_name" or other tag value will be better

@jotak
Copy link
Collaborator Author

jotak commented Aug 28, 2017

Yes, that would be nice, the only thing that is bugging me is that the current REST API doesn't return tags with metric data, which means that for each query I would have to perform a second http request to get the tag values of the returned metrics.

Or change the REST API.

@hardbone12
Copy link

Agree, Without change the REST API may need to implement mapping tags API response data to raw/query
API data.

@ptescher
Copy link

What about some sort of regex?

For instance, with OpenShift router metrics and hawkular-openshift-agent I get the following metric:

pod/c6e2a9ab-8d1c-11e7-b7be-06415eb17bbf/custom/haproxy_server_bytes_in_total{namespace=my-namespace,pod=web-45-6f464,route=web,server=10.1.10.138:8080,service=web}

I have the pod name there in the name, but it gets cut off in the legend because it is too long. Regex could be static and still give me the pod name.

@LarsMilland
Copy link

Would any solution on this issue reach a conclusion in the near future. We would also like to have such a feature with either regex or through use of other tags from the metrics to populate the legend descriptive values. We are using the Hawkular Datasource plugin with metrics collected from OpenShift so have also long and non-usable metric names.

@jotak
Copy link
Collaborator Author

jotak commented Dec 11, 2017

For instance, with OpenShift router metrics and hawkular-openshift-agent I get the following metric:

pod/c6e2a9ab-8d1c-11e7-b7be-06415eb17bbf/custom/haproxy_server_bytes_in_total{namespace=my-namespace,pod=web-45-6f464,route=web,server=10.1.10.138:8080,service=web}

Wow, it must have changed since the last time I used it. It looks like a prometheus metric name, now. There's definitely some regexp that could be done here. I will have a look when I have some time for it, but in the meantime don't forget that PRs are welcome :-)

@jotak
Copy link
Collaborator Author

jotak commented Dec 11, 2017

Ok just figured out it's HOSA naming. I'm not so much familiar with it, but any solution would have to be generic enough, not just focused on HOSA.

So, I can imagine a "legend" text field where one would type for instance:
HAProxy Server Bytes {{namespace=([^,}]+)}} / {{pod=([^,}]+)}}

which would result in:
HAProxy Server Bytes my-namespace / web-45-6f464
based on the original name
pod/c6e2a9ab-8d1c-11e7-b7be-06415eb17bbf/custom/haproxy_server_bytes_in_total{namespace=my-namespace,pod=web-45-6f464,route=web,server=10.1.10.138:8080,service=web}

What do you think?

jotak added a commit to jotak/hawkular-grafana-datasource that referenced this issue Dec 11, 2017
Customize legend using user-defined regex applied on metric name
Ex: from base name "pod/c6e2a9ab-8d1c-11e7-b7be-06415eb17bbf/custom/haproxy_server_bytes_in_total{namespace=my-namespace,pod=web-45-6f464,route=web,server=10.1.10.138:8080,service=web}"

Legend: "HAProxy Server Bytes {{namespace=([^,}]+)}} / {{pod=([^,}]+)}}"

Would result in: "HAProxy Server Bytes my-namespace / web-45-6f464"
jotak added a commit that referenced this issue Dec 12, 2017
@jotak
Copy link
Collaborator Author

jotak commented Dec 12, 2017

If anyone wants to use before it's released, there's a docker image available with the PR: hawkular/hawkular-grafana-datasource:dev-build (docker hub)

@jotak
Copy link
Collaborator Author

jotak commented Feb 9, 2018

released in 1.1.2

@jotak jotak closed this as completed Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants