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

Add support for alias expressions in data targets #285

Closed
wants to merge 1 commit into from
Closed

Add support for alias expressions in data targets #285

wants to merge 1 commit into from

Conversation

birdflyer-lszo
Copy link
Contributor

Grafana allows setting an alias expression in a data target so that it gets identified nicely in the resulting graph. Target did not yet allow setting such an alias.

Add a simple alias field to the Target class so that the selected data can be aliased with an arbitrary expression.

@JamesGibo
Copy link
Collaborator

I wondered if it would be better to combine alias and legendFormat as they serve the same purpose, just for different data sources?
Or just include some docstrings for them?
See this for info on the difference for different data sources (https://community.grafana.com/t/how-to-override-metric-name/4388)

@birdflyer-lszo
Copy link
Contributor Author

You are right. If they are the same, there is little need for a separate property. I will kill this PR (I am using a different Target now anyway).

Will likely open one or the other PR in the future as I stumble across things i find missing :) The library is very helpful by the way!

@JaSei
Copy link
Contributor

JaSei commented Feb 6, 2024

Please do this. I use SqlTarget for influx (to be able to hide) and legendFormat doesn't work as alias

or it will be enough add

alias = self.legendFormat

This was referenced Feb 6, 2024
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 this pull request may close these issues.

None yet

3 participants