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

request help: any methods to remove leading and trailing zeros for histrogram buckets #118

Closed
Yiyiyimu opened this issue Jan 31, 2021 · 2 comments · Fixed by #119
Closed

Comments

@Yiyiyimu
Copy link
Contributor

Hi @knyar thanks for this repo. It's so great!

One problem is, when I have a lot of buckets, say

local DEFAULT_BUCKETS = { 1, 2, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60, 70,
    80, 90, 100, 200, 300, 400, 500, 1000,
    2000, 5000, 10000, 30000, 60000
}

I'll get the grafana panel like this and it's quite annoying.
image

I get the reason for add those zeros, but since grafana does not support formatting legends(buckets), is there any method to remove those zeros?

@dolik-rce
Copy link
Contributor

Hi @Yiyiyimu,

If you're using Grafana 7+, you might be able to reformat the labels using transformations. Alternatively (should work in older versions of grafana as well), you can wrap your query in label_replace, which can contain regex to select only part of label without leading and trailing zeros.

But I think that is only a temporary workaround. The library probably should format the labels properly when exposing the metrics, just as it does for "+Inf". What do you think @knyar?

@Yiyiyimu
Copy link
Contributor Author

Yiyiyimu commented Feb 1, 2021

Thank for the suggestions @dolik-rce! I try to implement that in #119, welcome have some review~

It seems transformation in Grafana does not work for this situation. The organize fields option could only work with a single frame, but not a heatmap. And since it is not actually "label" but called "legends" in grafana, so I could not add label_replace function` for this situation. But still thanks for the suggestions!

@knyar knyar closed this as completed in #119 Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants