@grafana/create-plugin 7.14.0 → 7.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/codemods/additions/prompts/docs-content.md +24 -12
  3. package/dist/codemods/additions/scripts/docs.js +229 -11
  4. package/package.json +1 -1
  5. package/src/codemods/additions/prompts/docs-content.md +24 -12
  6. package/src/codemods/additions/scripts/docs-content.test.ts +11 -2
  7. package/src/codemods/additions/scripts/docs.test.ts +793 -64
  8. package/src/codemods/additions/scripts/docs.ts +354 -10
  9. package/templates/docs/app/docs/AGENTS.md +127 -0
  10. package/templates/docs/app/docs/CLAUDE.md +1 -0
  11. package/templates/docs/app/docs/README.md +20 -0
  12. package/templates/docs/app/docs/configure.md +65 -0
  13. package/templates/docs/app/docs/dashboards.md +29 -0
  14. package/templates/docs/app/docs/index.md +70 -0
  15. package/templates/docs/app/docs/permissions.md +45 -0
  16. package/templates/docs/app/docs/troubleshooting.md +65 -0
  17. package/templates/docs/app/feature-page.md +26 -0
  18. package/templates/docs/app/features-index.md +12 -0
  19. package/templates/docs/datasource/docs/AGENTS.md +123 -0
  20. package/templates/docs/datasource/docs/CLAUDE.md +1 -0
  21. package/templates/docs/datasource/docs/README.md +20 -0
  22. package/templates/docs/datasource/docs/alerting.md +56 -0
  23. package/templates/docs/datasource/docs/annotations.md +68 -0
  24. package/templates/docs/datasource/docs/configure.md +114 -0
  25. package/templates/docs/datasource/docs/dashboards.md +28 -0
  26. package/templates/docs/datasource/docs/index.md +40 -0
  27. package/templates/docs/datasource/docs/query-editor.md +72 -0
  28. package/templates/docs/datasource/docs/template-variables.md +69 -0
  29. package/templates/docs/datasource/docs/troubleshooting.md +73 -0
  30. package/templates/docs/panel/docs/AGENTS.md +6 -0
@@ -0,0 +1,65 @@
1
+ ---
2
+ title: Configure
3
+ description: "Change the {{{yamlEscape pluginName}}} settings in Grafana or provision them as code."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - app
7
+ - configuration
8
+ - provisioning
9
+ sidebar_position: 2
10
+ ---
11
+
12
+ This document explains how to configure {{{pluginName}}} after you enable it.
13
+
14
+ ## Before you begin
15
+
16
+ Before you configure the app, ensure you have:
17
+
18
+ - **Grafana permissions:** The `Organization administrator` role. Only organization administrators can configure apps.
19
+ - **The app enabled:** Follow [Enable the app](./index.md#enable-the-app).
20
+
21
+ ## Open the configuration page
22
+
23
+ To open the {{{pluginName}}} configuration page:
24
+
25
+ 1. Click **Administration** > **Plugins and data** > **Plugins** in the left-side menu.
26
+ 1. Enter `{{{pluginName}}}` in the search bar.
27
+ 1. Select **{{{pluginName}}}**.
28
+
29
+ <!-- section-brief
30
+ Fill this in: After the list above, add one sentence that names the tab to click, using the `title` of the page passed to `addConfigPage` in `src/module.ts(x)`, such as "Then click the **Configuration** tab." Keep it a sentence rather than another step of the list. If the app adds more than one config page, name each tab and what it holds.
31
+ -->
32
+
33
+ ## Configure settings
34
+
35
+ <!-- section-brief
36
+ Fill this in: An H3 for each section of the config page, named and ordered as the page shows them, such as Connection, Authentication or Features. Under each H3, a table with this shape:
37
+
38
+ | Setting | Description | Required |
39
+ | ------- | ----------- | -------- |
40
+
41
+ Use the field labels from the config page, in bold. If the config page has no settings of its own, such as when it only turns the app on or off, say so in one sentence and document what its buttons do instead of a table. Find the settings in the components passed to `addConfigPage` and the settings type, including `jsonData` and `secureJsonData`. In a description, say when a field only appears for some choice and when it affects another setting. Use a `> [!NOTE]` callout for a setting that's only available in Grafana Cloud or Grafana Enterprise.
42
+
43
+ End with the button that saves the settings and what the reader sees when it works.
44
+ -->
45
+
46
+ ## Provision the app
47
+
48
+ You can provision {{{pluginName}}} as code with a Grafana provisioning file. For more information, refer to [Provision Grafana](https://grafana.com/docs/grafana/latest/administration/provisioning/#plugins).
49
+
50
+ <!-- section-brief
51
+ Fill this in: A YAML example with this shape, using the real `jsonData` and `secureJsonData` keys from the settings type and placeholders for every value the reader must supply, such as `<API_URL>`:
52
+
53
+ ```yaml
54
+ apiVersion: 1
55
+
56
+ apps:
57
+ - type: {{pluginId}}
58
+ org_id: 1
59
+ disabled: false
60
+ jsonData: {}
61
+ secureJsonData: {}
62
+ ```
63
+
64
+ Follow it with a table of the keys it uses and what each one sets, and list each placeholder with what to replace it with. If `provisioning/plugins/` has a file for the app, base the example on it.
65
+ -->
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: Dashboards
3
+ description: "Import and use the dashboards that ship with {{{yamlEscape pluginName}}}."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - app
7
+ - dashboards
8
+ sidebar_position: 6
9
+ ---
10
+
11
+ {{{pluginName}}} ships with ready-made dashboards that you can import and use as they are, or as a starting point for your own. For general information about dashboards, refer to [Dashboards](https://grafana.com/docs/grafana/latest/dashboards/).
12
+
13
+ ## Import a dashboard
14
+
15
+ To import a dashboard that ships with {{{pluginName}}}:
16
+
17
+ 1. Click **Administration** > **Plugins and data** > **Plugins** in the left-side menu.
18
+ 1. Enter `{{{pluginName}}}` in the search bar.
19
+ 1. Select **{{{pluginName}}}**.
20
+ 1. Click the **Dashboards** tab.
21
+ 1. Click **Import** next to the dashboard.
22
+
23
+ Imported dashboards don't update when you upgrade the plugin. When a plugin upgrade ships a newer version of a dashboard, click **Update** next to it. This overwrites any changes you made to it.
24
+
25
+ ## Included dashboards
26
+
27
+ <!-- section-brief
28
+ Fill this in: One H3 per dashboard in the `includes` list of `src/plugin.json` whose `type` is `dashboard`, using its `name`. For each one, describe what it shows and what data or settings it needs to work, based on the panels and queries in its JSON file. When the app ships many dashboards, group related ones under a shared H3 and list them, rather than repeating the same description.
29
+ -->
@@ -0,0 +1,70 @@
1
+ ---
2
+ title: Introduction
3
+ description: "Set up {{{yamlEscape pluginName}}} and find what to read next in the docs."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - app
7
+ - setup
8
+ sidebar_position: 1
9
+ ---
10
+
11
+ <!-- section-brief
12
+ Fill this in: Write a short orientation for someone who already has {{{pluginName}}} installed and landed here from the Documentation tab. One or two sentences on what this section covers and how it's organized. Do not restate what the app does or its feature list - that's the README's job on the Overview tab, and this reader has already seen it there. Do not list every page in this folder either - the sidebar already does that; use prose to say what to read first and why.
13
+ -->
14
+
15
+ ## Before you begin
16
+
17
+ Before you set up the app, ensure you have:
18
+
19
+ - **Grafana permissions:** The `Organization administrator` role. Only organization administrators can enable and configure apps.
20
+
21
+ <!-- section-brief
22
+ Fill this in: Keep the list above. Add a bullet in the same **Label:** form for each other thing the reader needs: the Grafana version from `dependencies.grafanaDependency` in `src/plugin.json`, each plugin in `dependencies.plugins` linked to its catalog page at `https://grafana.com/grafana/plugins/<id>/`, and anything `src/plugin.json` doesn't declare, such as an external service, a telemetry pipeline or a license. Never cover installing the plugin itself, because the Installation tab on the plugin page owns it.
23
+ -->
24
+
25
+ ## Enable the app
26
+
27
+ To enable {{{pluginName}}}:
28
+
29
+ 1. Click **Administration** > **Plugins and data** > **Plugins** in the left-side menu.
30
+ 1. Enter `{{{pluginName}}}` in the search bar.
31
+ 1. Select **{{{pluginName}}}**.
32
+ 1. Click **Enable**.
33
+
34
+ <!-- section-brief
35
+ Fill this in: If `src/plugin.json` sets `"autoEnabled": true`, the app is enabled when it's installed, so remove this section. Otherwise keep the steps above and remove only this brief.
36
+ -->
37
+ {{#if hasConfigPage}}
38
+
39
+ After you enable the app, refer to [Configure](./configure.md) for its settings.
40
+ {{/if}}
41
+
42
+ ## Connect your data
43
+
44
+ <!-- section-brief
45
+ Fill this in: The steps to get the data the app shows into Grafana, such as adding a data source, setting up an agent, setting environment variables or configuring a telemetry exporter. Take them from the README's setup sections and from what the app queries in source. Give each step the commands or settings to copy, and say how the reader can tell the data has arrived. Change the heading if necessary to name the task, such as "Add a data source". Never include steps to install the plugin itself, because the Installation tab on the plugin page owns them.
46
+
47
+ If the app works without any setup of its own, remove this section entirely.
48
+ -->
49
+
50
+ ## Common tasks
51
+
52
+ <!-- section-brief
53
+ Fill this in: List the jobs someone lands here to do, phrased as tasks rather than page titles, each linked to the page that answers it. For a typical app this might look like:
54
+
55
+ {{#if hasConfigPage}}
56
+ - [Change the app settings](./configure.md)
57
+ {{/if}}
58
+ {{#if defaultFeaturePage}}
59
+ - [Find your way around {{{defaultFeaturePage.name}}}](./{{defaultFeaturePage.file}}.md)
60
+ {{/if}}
61
+ {{#if hasDashboards}}
62
+ - [Import the dashboards that ship with the app](./dashboards.md)
63
+ {{/if}}
64
+ {{#if hasPermissions}}
65
+ - [Give users access to the app](./permissions.md)
66
+ {{/if}}
67
+ - [Fix setup and data errors](./troubleshooting.md)
68
+
69
+ Adapt this to {{{pluginName}}}'s actual entry points - add, remove or reword tasks so each one matches a real job a user comes here to do. This is a curated set of jobs, not a mechanical list of every file in this folder.
70
+ -->
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: Permissions
3
+ description: "The roles {{{yamlEscape pluginName}}} adds and the access it needs."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - app
7
+ - permissions
8
+ - RBAC
9
+ sidebar_position: 7
10
+ ---
11
+
12
+ This document explains who can use each part of {{{pluginName}}} and what the app can access. For general information, refer to [Role-based access control for app plugins](https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/access-control/rbac-for-app-plugins/).
13
+
14
+ ## Roles
15
+
16
+ <!-- section-brief
17
+ Fill this in: A table with one row per entry in `roles` in `src/plugin.json`:
18
+
19
+ | Role | Description | Granted by default to |
20
+ | ---- | ----------- | --------------------- |
21
+
22
+ Use the role's display name, or its name if it has none, and take the defaults from `grants`. After the table, say what each role lets a user do in the app, in terms of its pages and actions rather than the raw permission names.
23
+
24
+ If `src/plugin.json` has no `roles`, remove this section and Assign a role below.
25
+ -->
26
+
27
+ ## Page access
28
+
29
+ <!-- section-brief
30
+ Fill this in: A table of the app pages that need more than the `Viewer` role, with the role or permission each one needs, from the `role` and `action` of each `includes` entry in `src/plugin.json`. Link each page to its docs page.
31
+
32
+ If no `includes` entry sets `role` or `action`, remove this section.
33
+ -->
34
+
35
+ ## What the app can access
36
+
37
+ <!-- section-brief
38
+ Fill this in: A table of the permissions in `iam.permissions` in `src/plugin.json`, with the action, the scope and why the app needs it, based on what the backend does with that access. Administrators read this before they install the app, so be precise.
39
+
40
+ If `src/plugin.json` has no `iam`, remove this section.
41
+ -->
42
+
43
+ ## Assign a role
44
+
45
+ To assign a role to a user, team or service account, refer to [Assign RBAC roles](https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/access-control/assign-rbac-roles/).
@@ -0,0 +1,65 @@
1
+ ---
2
+ title: Troubleshooting
3
+ description: "Troubleshoot common {{{yamlEscape pluginName}}} setup, data and access errors."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - app
7
+ - troubleshooting
8
+ sidebar_position: 8
9
+ ---
10
+
11
+ This page explains how to fix common issues when you set up or use {{{pluginName}}}. For setup instructions, refer to the [Introduction](./index.md).
12
+
13
+ <!-- section-brief
14
+ Fill this in: Never guess failures. Each symptom must come from an error or empty-state message in source, a known issue in the README or other docs or a reported issue. When source holds only a few real failures, a short page is right, so don't pad it.
15
+
16
+ Replace this brief with one H2 per category that has real failures, in this order:
17
+
18
+ - `## Setup errors`: the app won't enable, or its settings don't save or don't connect.
19
+ - `## Missing data`: pages that load but show no data, linking to the setup steps in the [Introduction](./index.md).
20
+ {{#if hasPermissions}}
21
+ - `## Permission errors`: users who can't see a page or an action, linking to [Permissions](./permissions.md).
22
+ {{/if}}
23
+ - `## Performance issues`: slow pages, timeouts or rate limits, and the settings that help.
24
+
25
+ Add an H2 for another part of the app with real failures, named after that part.
26
+
27
+ Open each H2 with one sentence on when its errors occur. Add an H3 per symptom, named after the error message in quotes, such as `### "Failed to load services"`, then **Symptoms:** and a **Possible causes and solutions:** table, or a numbered **Solutions:** list for a single cause.
28
+ -->
29
+
30
+ ## Get more detail about an error
31
+
32
+ For errors in the app, open the developer tools in your browser and check the console.
33
+ {{#if hasBackend}}
34
+
35
+ In self-managed Grafana, you can also find more detail in the Grafana server logs:
36
+
37
+ 1. Set the log level to `debug` in the Grafana configuration file:
38
+
39
+ ```ini
40
+ [log]
41
+ level = debug
42
+ ```
43
+
44
+ 1. Restart Grafana and reproduce the error.
45
+ 1. Look for log lines with `logger=plugin.{{{pluginId}}}`.
46
+ 1. Set the log level back to `info` when you're done, to keep the logs small.
47
+ {{/if}}
48
+
49
+ ## Get additional help
50
+
51
+ If this page doesn't solve your problem:
52
+
53
+ - Search the [Grafana community forums](https://community.grafana.com/).
54
+ - If your Grafana Cloud or Grafana Enterprise plan includes support, contact Grafana Support.
55
+
56
+ <!-- section-brief
57
+ Fill this in: Add links to the plugin's issue tracker and the docs of any service the app depends on to the list above.
58
+ -->
59
+
60
+ When you report an issue, include:
61
+
62
+ - The Grafana and plugin versions.
63
+ - The error message, with sensitive information removed.
64
+ - The steps to reproduce the issue.
65
+ - The app page where it happens and the relevant app settings, with credentials removed.
@@ -0,0 +1,26 @@
1
+ ---
2
+ title: "{{{yamlEscape page.name}}}"
3
+ description: "Use the {{{yamlEscape page.name}}} page in {{{yamlEscape pluginName}}}."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - "{{{yamlEscape page.name}}}"
7
+ sidebar_position: {{page.position}}
8
+ ---
9
+
10
+ <!-- section-brief
11
+ Fill this in: One or two sentences on what the {{{page.name}}} page is for and when someone opens it. The app shows it at `{{{page.path}}}`. Pair it with a screenshot of the page if `info.screenshots` in `src/plugin.json` has one.
12
+ -->
13
+ {{#if page.role}}
14
+
15
+ ## Before you begin
16
+
17
+ - **Grafana permissions:** At least the `{{page.role}}` role.
18
+
19
+ <!-- section-brief
20
+ Fill this in: Keep the bullet above. Add a bullet in the same **Label:** form only for something the reader needs before they can use this page and wouldn't guess, such as a feature flag that must be on or data that must exist. Never repeat setup from the Introduction or from another page, and don't link back to them. If this section would only point at another page, it adds nothing, so remove it, including its heading and the bullet above.
21
+ -->
22
+ {{/if}}
23
+
24
+ <!-- section-brief
25
+ Fill this in: Replace this brief with one H2 per task someone does on the {{{page.name}}} page, named after the task, such as "Filter by service" or "Compare two time ranges". Under each, give the steps with the UI labels in bold, and say what each part of the page shows when it helps the task. Find the tasks in the component that renders `{{{page.path}}}`, including its tabs and drilldowns, which `src/plugin.json` doesn't list. Describe UI that only appears behind a feature flag or a condition as "when X is enabled".
26
+ -->
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Features
3
+ description: "What each part of {{{yamlEscape pluginName}}} is for."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - app
7
+ sidebar_position: {{position}}
8
+ ---
9
+
10
+ <!-- section-brief
11
+ Fill this in: One line per page in this folder, in the order the app's navigation shows them, each linked to its page and saying what the reader does there. This is a router, so keep the detail on the pages themselves.
12
+ -->
@@ -0,0 +1,123 @@
1
+ # Plugin docs
2
+
3
+ This folder is the documentation for **{{{pluginName}}}**, published at
4
+ `grafana.com/grafana/plugins/{{pluginId}}/docs/`.
5
+
6
+ ## Guides
7
+
8
+ Read these before you write or change any page. This docs format is new and your training
9
+ data does not cover it, so do not rely on what you know about other docs tools.
10
+
11
+ Run `{{packageManagerName}} run docs:validate` and open the guide on its last line, `Docs guides:`. It's
12
+ the guides' `index.md`, which says which guide to read for what, and the other guides sit next to it.
13
+ The guides match the version of the validator this plugin uses. The line is a local path, usually
14
+ `node_modules/@grafana/plugin-docs-cli/docs/index.md`, or a URL when the package isn't on disk, such as
15
+ with Yarn Plug'n'Play.
16
+
17
+ The guides name scripts such as `docs:validate`. This plugin uses **{{packageManagerName}}**, so run them
18
+ with `{{packageManagerName}} run`, as in the commands below.
19
+
20
+ ## Pages and their source
21
+
22
+ `annotations.md`, `alerting.md` and `dashboards.md` exist only when the plugin has that feature, as
23
+ described under [Optional pages](#optional-pages).
24
+
25
+ Files may have moved since the plugin was scaffolded, so trace them from `src/module.ts`.
26
+ `new DataSourcePlugin<DataSource, Query, Options>(DataSource)` names the data source class, the query type
27
+ and the options type, and `setConfigEditor` and `setQueryEditor` name the editor components.
28
+
29
+ | Page | Source of truth |
30
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
31
+ | `index.md` | Nothing - it is a curated router. Update it when pages are added or removed. |
32
+ | `configure.md` | The `setConfigEditor` component and the options type. With a backend, also how it reads these settings and its `CheckHealth` handler |
33
+ | `query-editor.md` | The `setQueryEditor` component, the query type and the code that runs queries in the data source class or backend |
34
+ | `template-variables.md` | Variable support in the data source class: `variables` or `metricFindQuery`, `applyTemplateVariables`, and `getTagKeys` and `getTagValues` |
35
+ | `annotations.md` | `annotations` support in the data source class |
36
+ | `alerting.md` | The backend's query handling, and what the data source class does to queries first, since alert rules skip it |
37
+ | `dashboards.md` | `includes` entries of type `dashboard` in `src/plugin.json` and their JSON files |
38
+ | `troubleshooting.md` | Error messages in source, known issues in the README or other docs and reported issues. Never guess failures |
39
+
40
+ ## Optional pages
41
+
42
+ Add one of these pages when the plugin has the matching feature. Use the filename given here, give the page
43
+ a `sidebar_position` that puts it where it belongs and link it from `index.md`.
44
+
45
+ | Trigger | Page | Scope |
46
+ | -------------------------------------------------- | ---------------- | ---------------------------------------------------------------- |
47
+ | `"annotations": true` in `src/plugin.json` | `annotations.md` | Annotation queries, the fields they return and examples. |
48
+ | `"alerting": true` in `src/plugin.json` | `alerting.md` | Which queries work in alert rules, creating a rule and examples. |
49
+ | An `includes` entry of type `dashboard` | `dashboards.md` | What each bundled dashboard shows and how to import it. |
50
+ | Macros that outgrow a section of `query-editor.md` | `macros.md` | Every macro with its syntax, what it expands to and an example. |
51
+ | RBAC role declarations in `src/plugin.json` | `permissions.md` | What each role grants, default assignments. |
52
+
53
+ ## What not to write
54
+
55
+ Never write installation instructions, such as installing the plugin with `grafana-cli`, from a zip file or
56
+ in Docker. The Installation tab on the plugin page covers them, and these docs start from a plugin that is
57
+ already installed. When the README has an installation section, leave it out of the pages.
58
+
59
+ ## Section briefs
60
+
61
+ Each section of a scaffolded page has a brief telling you what belongs there. A brief is an HTML comment
62
+ that starts with `section-brief`. Search the docs folder for `section-brief` to find what is left to write:
63
+
64
+ ```markdown
65
+ ## Macros
66
+
67
+ <!-- section-brief
68
+ Fill this in: A table of every macro the plugin expands in queries.
69
+
70
+ If the plugin has no macros, remove this section entirely.
71
+ -->
72
+ ```
73
+
74
+ Some sections also have fixed text, with a brief that builds on it:
75
+
76
+ ```markdown
77
+ ## Create an alert rule
78
+
79
+ To create an alert rule from a {{{pluginName}}} query:
80
+
81
+ 1. Navigate to **Alerting** > **Alert rules**.
82
+ 1. Click **New alert rule**.
83
+
84
+ <!-- section-brief
85
+ Fill this in: Continue the list above with the steps for the query and the alert condition.
86
+ -->
87
+ ```
88
+
89
+ Text outside a brief is written for every data source and is part of the scaffold. Keep it, and change it
90
+ only where it's wrong for this plugin, such as a menu path or a step that differs.
91
+
92
+ Everything inside a brief is the instruction. A brief covers the section it sits under, unless it says
93
+ otherwise: it may tell you to extend the fixed text above it, to replace it with several sections or to
94
+ remove the page. When a brief says to remove a section, remove its heading and fixed text too.
95
+
96
+ To fill a section:
97
+
98
+ 1. Read the brief.
99
+ 2. Read the source the page documents, from the table above, then write the section.
100
+ 3. Delete the whole comment, from `<!-- section-brief` to `-->`.
101
+
102
+ Briefs are not shown in the preview or the catalog, so a section you haven't written looks like a bare
103
+ heading. `docs:validate` lists every section that still has only its brief.
104
+
105
+ ## Validate
106
+
107
+ ```bash
108
+ {{packageManagerName}} run docs:validate
109
+ ```
110
+
111
+ Run `docs:validate` after every page you write or change and fix what it reports. A docs task is done when
112
+ it reports no warnings and no suggestions about section briefs. In particular, an `empty-section` or
113
+ `unfilled-section-brief` suggestion means a section is still unwritten or a brief is still in place. Neither
114
+ fails validation, so a passing exit code alone does not mean the docs are done.
115
+
116
+ ## Preview
117
+
118
+ ```bash
119
+ {{packageManagerName}} run docs:serve # local preview at http://localhost:3001, reloads on save
120
+ ```
121
+
122
+ `docs:serve` keeps running until you stop it. Start it in the background if you need to look at the
123
+ rendered pages, and stop it when you are done.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -0,0 +1,20 @@
1
+ # {{{pluginName}}} documentation
2
+
3
+ This folder is the documentation for **{{{pluginName}}}**. It's published on the Documentation tab of
4
+ `grafana.com/grafana/plugins/{{pluginId}}/` with each plugin release. This README isn't published.
5
+
6
+ To learn how plugin docs work and how to write them, read the
7
+ [Add documentation to your plugin](https://grafana.com/developers/plugin-tools/how-to-guides/plugin-docs) guide.
8
+
9
+ ## Next steps
10
+
11
+ 1. Fill in or review the pages. Each section has a note that says what belongs there.
12
+ 2. Add screenshots, videos and figures where they help readers. Save them inside this folder, for example in `img/`, and link to them with a relative path. `docs:validate` checks their formats and sizes.
13
+ 3. Run `{{packageManagerName}} run docs:serve` to preview the docs. It also lists every section left to fill.
14
+
15
+ ## Commands
16
+
17
+ ```bash
18
+ {{packageManagerName}} run docs:serve # local preview at http://localhost:3001
19
+ {{packageManagerName}} run docs:validate # check your docs, including sections left to fill
20
+ ```
@@ -0,0 +1,56 @@
1
+ ---
2
+ title: Alerting
3
+ description: "Create Grafana alert rules from {{{yamlEscape pluginName}}} queries."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - data source
7
+ - alerting
8
+ sidebar_position: 6
9
+ ---
10
+
11
+ You can create alert rules that run {{{pluginName}}} queries on a schedule and fire when the result meets a condition, such as a value above a threshold. For general information about alerting, refer to [Grafana Alerting](https://grafana.com/docs/grafana/latest/alerting/).
12
+
13
+ ## Before you begin
14
+
15
+ - [Configure the {{{pluginName}}} data source](./configure.md).
16
+
17
+ <!-- section-brief
18
+ Fill this in: Add bullets for what the reader needs in {{{pluginName}}} for alert queries to return data, such as read access, linking to `./configure.md`. If there is nothing to add, delete only this brief.
19
+ -->
20
+
21
+ ## Query requirements
22
+
23
+ <!-- section-brief
24
+ Fill this in: Explain that a query must return numeric data: a time series reduced with **Reduce**, or a single numeric row. Say how to get a number otherwise, such as an aggregate or a **Count** over rows, and that each series becomes its own alert instance.
25
+
26
+ If there are several query types, add a table of which work in alert rules. Alert rules run on the backend, so frontend-only query types don't. Mention the time filter macro, such as `$__timeFilter`.
27
+ -->
28
+
29
+ ## Create an alert rule
30
+
31
+ To create an alert rule from a {{{pluginName}}} query:
32
+
33
+ 1. Navigate to **Alerting** > **Alert rules**.
34
+ 1. Click **New alert rule**.
35
+ 1. Enter a **Name** for the rule.
36
+ 1. Select the **{{{pluginName}}}** data source.
37
+
38
+ <!-- section-brief
39
+ Fill this in: Continue the list with the query step, field labels in bold, then **Reduce** and **Threshold** expressions, evaluation behavior, labels and notifications, and saving. Link to `./query-editor.md` for the fields and to [Create a Grafana-managed alert rule](https://grafana.com/docs/grafana/latest/alerting/configure-alert-rules/create-grafana-managed-rule/) for the rest.
40
+ -->
41
+
42
+ ## Limitations
43
+
44
+ <!-- section-brief
45
+ Fill this in: Add an H3 for each thing that works on a dashboard but not in an alert rule, and what to do instead. Alert rules skip the frontend data source class, so check `applyTemplateVariables`, `query()` overrides and ad hoc filters. Also check for auth that needs a signed-in user, such as forwarded OAuth, settings such as a row limit and API rate limits.
46
+
47
+ If nothing applies, remove this section entirely.
48
+ -->
49
+
50
+ ## Alert query examples
51
+
52
+ <!-- section-brief
53
+ Fill this in: Add an H3 for each realistic alert, such as on error counts or latency. Say what it watches for, show the query as a code block or as builder steps with field labels in bold, and end with the **Reduce** function and **Threshold** to use.
54
+
55
+ Where it fits, add a no-data alert and one that combines two queries with a **Math** expression.
56
+ -->
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Annotations
3
+ description: "Mark events on your graphs with annotation queries from {{{yamlEscape pluginName}}}."
4
+ keywords:
5
+ - "{{{yamlEscape pluginName}}}"
6
+ - data source
7
+ - annotations
8
+ sidebar_position: 5
9
+ ---
10
+
11
+ Annotations overlay event markers on time series panels, so you can correlate events from {{{pluginName}}}, such as deployments or incidents, with the metrics on your dashboards. For general information about annotations, refer to [Annotate visualizations](https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/).
12
+
13
+ ## Before you begin
14
+
15
+ - [Configure the {{{pluginName}}} data source](./configure.md).
16
+
17
+ <!-- section-brief
18
+ Fill this in: Add bullets for what the reader needs in {{{pluginName}}} before annotation queries return anything, such as read access to the data, or events stored with a timestamp. Link to the matching section of `./configure.md` for access. If there is nothing beyond the configured data source, delete only this brief.
19
+ -->
20
+
21
+ ## Create an annotation query
22
+
23
+ To add an annotation query to a dashboard:
24
+
25
+ 1. Navigate to **Dashboard settings** > **Annotations**.
26
+ 1. Click **Add annotation query**.
27
+ 1. Enter a **Name** for the annotation.
28
+ 1. Select the **{{{pluginName}}}** data source.
29
+
30
+ <!-- section-brief
31
+ Fill this in: Continue the list above with the steps in the annotation editor, using its field labels in bold, and end with saving the dashboard.
32
+
33
+ First find out which annotation editor the plugin has. If the data source class sets `annotations` to an `AnnotationSupport` object with its own `QueryEditor`, such as `this.annotations = createAnnotationSupport(this)`, the plugin has a custom annotation editor, so describe its fields here and its options under Annotation editor. If it sets `annotations = {}` or doesn't set it at all, Grafana uses the panel query editor followed by its standard field mapping, so link to `./query-editor.md` instead of repeating its fields.
34
+ -->
35
+
36
+ ## Annotation editor
37
+
38
+ <!-- section-brief
39
+ Fill this in: Describe the custom annotation editor, from the `QueryEditor` set on `annotations` in the data source class. Add an H3 for each annotation type or preset it offers, saying when to use it, its fields and the query it generates. Say whether the generated query can be edited, and how the editor differs from the panel query editor. Also check `prepareAnnotation` and `processEvents` for behaviour the reader sees, such as defaults or how results become annotations.
40
+
41
+ If the plugin has no custom annotation editor, remove this section entirely.
42
+ -->
43
+
44
+ ## Query requirements
45
+
46
+ <!-- section-brief
47
+ Fill this in: Explain what an annotation query must return. With the standard field mapping, give this table and keep only the fields the plugin can return:
48
+
49
+ | Field | Required | Description |
50
+ | --------- | -------- | ----------- |
51
+ | `time` | Yes | |
52
+ | `timeEnd` | No | |
53
+ | `title` | No | |
54
+ | `text` | Yes | |
55
+ | `tags` | No | |
56
+
57
+ Fields match by name. If there is no `time` field, Grafana uses the first time field, and if there is no `text` field, the first string field. A `timeEnd` field draws a region instead of a single marker. If a custom editor or `processEvents` maps fields differently, describe that mapping instead.
58
+
59
+ If the editor has several query types, add a table of which ones suit annotations and why. Then say how to keep results to the dashboard time range, such as with the `$__timeFilter` macro, and note limits such as a result cap or API rate limits, and whether ad hoc filters also apply to annotation queries.
60
+ -->
61
+
62
+ ## Annotation query examples
63
+
64
+ <!-- section-brief
65
+ Fill this in: Give realistic annotation queries for the events people mark with {{{pluginName}}}, such as deployments, incidents or errors, with an H3 for each. Say what each one marks and show the query the way a reader enters it, as a code block for a query language, or as steps with field labels in bold for a builder. Use the field names and syntax the editor really accepts.
66
+
67
+ Include a region example with `timeEnd` if the plugin can return one, and an example that filters events with a dashboard variable if annotation queries interpolate variables.
68
+ -->