You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/shared/v3-core-plugins/_index.md
+23-15Lines changed: 23 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,17 +12,7 @@ InfluxDB 3 has an embedded Python VM for dynamically loading plugins that can ex
12
12
13
13
Each plugin type has a different trigger configuration, which will be described in the section on each plugin type.
14
14
15
-
## Installing Plugins from the repo
16
-
The repository at [https://github.com/influxdata/influxdb3_plugins](https://github.com/influxdata/influxdb3_plugins) contans example plugins and contributions from the community. To install a plugin from the repository, you can using the `influxdb3` CLI.
17
-
18
-
Just use `gh:<path>` as the plugin name to install a plugin from the repository. For example, to install the `wal_plugin.py` from the repository, you can use the following command:
You will then need to create a trigger to activate the plugin. Details on triggers for each type of plugin are provided below.
15
+
When starting the server, the argument `--plugin-dir` must be provided that specifies what directory plugins are located in. There is also a public Github repository of example plugins that can be referenced when creating a trigger. The repository at [https://github.com/influxdata/influxdb3_plugins](https://github.com/influxdata/influxdb3_plugins) contans example plugins and contributions from the community.
26
16
27
17
## Shared API
28
18
@@ -195,7 +185,7 @@ influxdb3_local.info("This is an info message with an object", obj_to_log)
195
185
```
196
186
197
187
### Trigger arguments
198
-
Every plugin type can receive arguments from the configuration of the trigger. This is useful for passing configuration to the plugin. This can drive behavior like things to monitor for or it could be connection information to third party services that the plugin will interact with. The arguments are passed as a `Dict` of `String` to `String`where the key is the argument name and the value is the argument value. Here's an example of how to use arguments in a plugin:
188
+
Every plugin type can receive arguments from the configuration of the trigger. This is useful for passing configuration to the plugin. This can drive behavior like things to monitor for or it could be connection information to third party services that the plugin will interact with. The arguments are passed as a `Dict[str, str]`where the key is the argument name and the value is the argument value. Here's an example of how to use arguments in a WAL plugin:
@@ -244,7 +234,17 @@ Every trigger is associated with a specific database. The best reference for the
244
234
influxdb3 create trigger help
245
235
```
246
236
247
-
For the WAL plugin, the `trigger-spec` can be either `all-tables` which will trigger on any write to the assoicated database or `table:<table_name>` which will call the `process_writes` function only with the writes for the given table. The `args` parameter can be used to pass configuration to the plugin.
237
+
For the WAL plugin, the `trigger-spec` can be either `all-tables` which will trigger on any write to the assoicated database or `table:<table_name>` which will call the `process_writes` function only with the writes for the given table. The trigger-spec is what the server uses to determine which plugin type the plugin-filename points to.
238
+
239
+
The `args` parameter can be used to pass configuration to the plugin.
240
+
241
+
For example, if creating a trigger of WAL flush from the examples repo:
Without the `gh:` at the start of the filename, the server will look for the file in its plugin directory.
248
248
249
249
## Schedule Plugin
250
250
Schedule plugins run on a schedule specified in cron syntax. The plugin will receive the local API, the time of the trigger, and any arguments passed in the trigger definition. Here's an example of a simple schedule plugin:
@@ -263,7 +263,11 @@ def process_scheduled_call(influxdb3_local, time, args=None):
263
263
```
264
264
265
265
### Schedule Trigger Configuration
266
-
Schedule plugins are set with a `trigger-spec` of `schedule:<cron_expression>`. The `args` parameter can be used to pass configuration to the plugin. For example, if we wanted the above plugin to run the check every minute, we would use `schedule:*/5 * * * *` as the `trigger-spec`.
266
+
Schedule plugins are set with a `trigger-spec` of `schedule:<cron_expression>` or `every:<duration>`. The `args` parameter can be used to pass configuration to the plugin. For example, if we wanted to use the system-metrics example from the Github repo and have it collect every 10 seconds we could use the following trigger definition:
On Request plugins are triggered by a request to a specific endpoint under `/api/v3/engine`. The plugin will receive the local API, query parameters `Dict[str, str]`, request headers `Dict[str, str]`, request body (as bytes), and any arguments passed in the trigger definition. Here's an example of a simple On Request plugin:
On Request plugins are set with a `trigger-spec` of `request:<endpoint>`. The `args` parameter can be used to pass configuration to the plugin. For example, if we wanted the above plugin to run on the endpoint `/api/v3/engine/my_plugin`, we would use `request:my_plugin` as the `trigger-spec`.
296
300
297
-
Trigger specs must be unique across all configured plugins, regardless of which database they are tied to, given the path is the same.
301
+
Trigger specs must be unique across all configured plugins, regardless of which database they are tied to, given the path is the same. Here's an example to create a request trigger tied to the "hello-world' path using a plugin in the plugin-dir:
0 commit comments