plugin-tools icon indicating copy to clipboard operation
plugin-tools copied to clipboard

Docs: Add another documentation page on Macros and Variables

Open sarahzinger opened this issue 1 year ago • 2 comments

Which areas does this feature request relate to

  • [ ] Create Plugin
  • [ ] Sign Plugin
  • [ ] Plugin E2E
  • [ ] Plugin Meta Extractor
  • [X] Documentation

Problem

I am writing a datasource plugin and would like to add support for template variables and macros and found myself a bit confused.

Some questions that came up that would have been nice to be able to read in one place:

  • difference between applyTemplateVariables and interpolateVariablesInQueries and which one(s) to implement as a dev
  • understanding what macros come for "free". This page suggests it's just $__to and $__from, but my understanding is there are others that may come from elsewhere such as $__interval. This page has a list of "global variables", but some seem to require implementation by a datasource while others seem to come from grafana core, but it's unclear which is which.
  • what are the limitations for macros and variables? (ex they don't work in alerting/explore but there are ways to get the variable/macro to be interpolated to the alert/explore page I believe).

Solution

I think we could create a doc page in the plugin developer guide that goes through this which would help a lot!

Alternatives

Another alternative could be to put all of this code in one place and then rather than a full documentation page we could link to that one code file, but I don't think this changes so frequently that this is necessary (but maybe I'm wrong)

Additional context

No response

Are you interested in contributing the solution?

  • [ ] Yes
  • [ ] No

sarahzinger avatar Jun 14 '24 14:06 sarahzinger

fyi @josmperez

tolzhabayev avatar Jun 25 '24 10:06 tolzhabayev

Assigning myself so I can track this issue and coordinate the triage/development process.

josmperez avatar Jun 25 '24 17:06 josmperez