Skip to content

Commit 2a4308f

Browse files
authored
feat: update script for telegraf plugins (#4220)
1 parent 7b034a0 commit 2a4308f

File tree

4 files changed

+194
-95
lines changed

4 files changed

+194
-95
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"subscriptions-oss": "touch ./src/client/subscriptionsRoutes.ts",
7474
"pinned": "oats ${REMOTE}contracts/priv/pinneditemsd.yml > ./src/client/pinnedItemRoutes.ts",
7575
"fluxdocs": "oats ${REMOTE}contracts/priv/fluxdocsd.yml > ./src/client/fluxdocsdRoutes.ts",
76-
"telegraf-plugins:update": "node src/writeData/utils/parsePluginsConfigurationText.mjs"
76+
"telegraf-plugins:update": "node src/writeData/utils/updateTelegrafPlugins.mjs"
7777
},
7878
"author": "",
7979
"devDependencies": {

src/writeData/components/telegrafPlugins/TelegrafPluginsExplainer.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/writeData/utils/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Updating Telegraf Plugins
2+
3+
Telegraf plugins are found at the Sources page, by navigating Load Data > Sources.
4+
5+
Each plugin has a logo, a markdown file that acts as a README, and a configuration (.conf) file. The markdown and .conf files come directly from the [Telegraf repository](https://github.com/influxdata/telegraf), which is the source of truth for all Telegraf plugins.
6+
7+
As new plugins are added and existing plugins are updated, these changes should also be reflected at the Sources page. To make this possible with minimal effort, a script was created to handle the tedium of repeatedly copy-pasting files. But a little bit of manual work is still required, namely:
8+
9+
# Steps
10+
11+
1. Run the script.
12+
At the root of the repository, run `yarn telegraf-plugins:update`
13+
This will update all Telegraf plugins according to the latest release of Telegraf
14+
Optionally, you may add a version: `yarn telegraf-plugins:update <version>`
15+
For example:
16+
&nbsp;&nbsp;`yarn telegraf-plugins:update v1.22.0` will update according to version 1.22.0
17+
&nbsp;&nbsp;`yarn telegraf-plugins:update master` will update according to master branch
18+
1. Accept the changes to existing files in a new branch in preparation for a pull request.
19+
1. Accept the new files generated. New files, if any, should be only .conf files the first time you run this script during an update cycle.
20+
1. For every new .conf file, add the id of the new plugin (if not already present) into the `inputPluginsList` array found in `src/writeData/utils/updateTelegrafPlugins.mjs`
21+
&nbsp;&nbsp;a. Keep the array alphabetized and the ids unique
22+
&nbsp;&nbsp;b. The id is the second part after the dot of the string between the set of `[[ ]]` found in a .conf file.
23+
For example `[[inputs.activemq]]` has id of `activemq`
24+
1. Repeat the above steps from step 1. Accept the new .md files generated. The reason we need to repeat is because markdown files are generally found by using a file path that includes their id, with each plugin having a different path. There is no other list (except in the steps outlined here) of all plugins.
25+
1. For any id that fails to find an .md file, the correct markdown file path has a slightly different name than its id in the [Telegraf repository](https://github.com/influxdata/telegraf). You may need to look for the correct markdown file path with your own eyes and manually copy-paste it. These exceptions should be limited to only a handful of files.
26+
1. Add or change logos by adding to or editing the svg files at `src/writeData/graphics`
27+
1. Add new plugins to the `WRITE_DATA_TELEGRAF_PLUGINS` array found in `src/writeData/constants/contentTelegrafPlugins.ts`. Be sure that `markdown` and `image` have an imported file. This step allows the plugins to appear at the Sources page.
28+
1. _**Optional**_: add a style property for any plugin in the above step to adjust the logo image.
29+
1. Commit and submit a pull request with all of the changes.
30+
31+
32+

0 commit comments

Comments
 (0)