Skip to content

Commit 6bf3e76

Browse files
authored
Merge pull request #5876 from influxdata/plugin_error_handling
feat: update plugin error handling and request response docs.
2 parents 347cad3 + a1b1705 commit 6bf3e76

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

content/shared/v3-core-plugins/_index.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,39 @@ obj_to_log = {"hello": "world"}
219219
influxdb3_local.info("This is an info message with an object", obj_to_log)
220220
```
221221

222+
### Trigger Settings
223+
224+
#### Control trigger execution
225+
226+
By default, triggers run synchronously—each instance waits for previous instances to complete before executing.
227+
228+
To allow multiple instances of the same trigger to run simultaneously, configure triggers to run asynchronously:
229+
230+
```bash
231+
# Create an asynchronous trigger
232+
influx create trigger --run-asynchronously
233+
234+
#### Configure error handling
235+
#### Configure error behavior for plugins
236+
237+
The Processing engine logs all plugin errors to stdout and the `system.processing_engine_logs` system table.
238+
239+
To configure additional error handling for a trigger, use the `--error-behavior` flag:
240+
241+
- `--error-behavior retry`: Attempt to run the plugin again immediately after an error
242+
- `--error-behavior disable`: Automatically disable the plugin when an error occurs (can be re-enabled later via CLI)
243+
244+
```bash
245+
# Create a trigger that retries on error
246+
influx create trigger --error-behavior retry
247+
248+
# Create a trigger that disables the plugin on error
249+
influx create trigger --error-behavior disable
250+
This behavior can be changed by specifying the "Error behavior", via the `--error-behavior` flag. Apart from the default `log`, you may set
251+
252+
* `--error-behavior retry` will immediately retry the plugin trigger in the event of error.
253+
* `--error-behavior disable` will turn off the plugin as soon as an error occurs. You can enable it again using the CLI.
254+
222255
### Trigger arguments
223256
224257
A plugin can receive arguments from the trigger that runs it.
@@ -388,6 +421,7 @@ influxdb3 create trigger \
388421

389422
On Request plugins are triggered by a request to a custom HTTP API endpoint.
390423
The plugin receives the shared API, query parameters `Dict[str, str]`, request headers `Dict[str, str]`, the request body (as bytes), and any arguments passed in the trigger definition.
424+
On Request plugin responses follow conventions for [Flask responses](https://flask.palletsprojects.com/en/stable/quickstart/#about-responses).
391425

392426
#### Example: On Request plugin
393427

@@ -411,7 +445,7 @@ def process_request(influxdb3_local, query_parameters, request_headers, request_
411445

412446
influxdb3_local.write(line)
413447

414-
return 200, {"Content-Type": "application/json"}, json.dumps({"status": "ok", "line": line_str})
448+
return {"status": "ok", "line": line_str}
415449
```
416450

417451
#### On Request trigger configuration

0 commit comments

Comments
 (0)