-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Aliasing A Metric #14
Comments
Hello @zak-b2c2 Can you describe your use case please? |
Hi Simon, Use case is very simple. I have two metrics with same name trades.*.BTCUSD. But I pass in additional JSON parameters to each, let's say it's a filter, to differentiate sells from buys:
Now it's hard to know which is which on the graph (actually it's the legend), so it will be good to give them an alias. Like trades-BTCUSD-bid and trades-BTCUSD-ask For other datasources, you are able to preset some arbitrary alias, as shown in the first picture above. I hope that explains it well. |
Personally I solve this on the server side. And IMO it's the proper solution. Because for one metric, you can actually return The returned series name can be modified by setting |
Fair enough. I guess we have different usage of your datasource. I return one timeserie per metric. I will have a look at changing target. Thanks |
I usually do so too but sometimes I return two or more targets for one metric. IMO it's more comfortable to manage data and target namings on the server. The same way as you manage metrics etc. But I'm not saying that there cannot be an usecase for changing target names on the grafana side. |
The Prometheus datasource solved this by adding a "Legend format". |
@andig How would it work in our case? What is |
Actually, one way I've solved this is by putting a new field in the JSON Data box. Just put "alias":"my-alias" and then you resolve it on the DB side |
I just finished modifying the original simple-json-datasource with this functionality. I will probably be doing some refactoring, but if someone is interesting in my first pass, I guess I could post the code in my repo. There are some advantages to doing client side over server side, such as the abilitiy to use variables in your aliases etc. |
@wallflower I would be interested in this :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I do not personally have a use case for this but I think there are a couple of options:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I will appreciate if somebody could explain how to set alias for metrics in Grafana v7.5.2 and plugin v0.2.4. Can it be set via additional JSON data like |
Hi, currently the backend must alias it for you. Nothing is implemented on datasource side. |
Hello again,
Another request. Would it be possible to have alias as well for the metrics? I have barely touched JS or TS in my whole life so don't feel comfortable making changes tbh ...
Thanks,
Zak
The text was updated successfully, but these errors were encountered: