Merge branch 'master' into chore-js-refactor-footer-scripts-modules

chore-js-refactor-footer-scripts-modules
Jason Stirnaman 2025-06-09 16:48:48 -05:00 committed by GitHub
commit ad85c958d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 186 additions and 10 deletions

View File

@ -3,8 +3,7 @@
"baseUrl": ".",
"paths": {
"*": [
"*",
"../node_modules/*"
"*"
]
}
}

View File

@ -0,0 +1,15 @@
---
title: influxdb3 test schedule_plugin
description: >
The `influxdb3 test schedule_plugin` command tests a schedule plugin file without needing to create a trigger.
menu:
influxdb3_core:
parent: influxdb3 test
name: influxdb3 test schedule_plugin
weight: 401
source: /shared/influxdb3-cli/test/schedule_plugin.md
---
<!--
The content of this file is at content/shared/influxdb3-cli/test/schedule_plugin.md
-->

View File

@ -0,0 +1,15 @@
---
title: influxdb3 test schedule_plugin
description: >
The `influxdb3 test schedule_plugin` command tests a schedule plugin file without needing to create a trigger.
menu:
influxdb3_enterprise:
parent: influxdb3 test
name: influxdb3 test schedule_plugin
weight: 401
source: /shared/influxdb3-cli/test/schedule_plugin.md
---
<!--
The content of this file is at content/shared/influxdb3-cli/test/schedule_plugin.md
-->

View File

@ -0,0 +1,84 @@
The `influxdb3 test schedule_plugin` command tests a schedule plugin. Use this command to verify plugin behavior without creating a trigger.
## Usage
<!--pytest.mark.skip-->
```bash
influxdb3 test schedule_plugin [OPTIONS] --database <DATABASE_NAME> <FILENAME>
```
## Arguments
- **FILENAME**: Path to the plugin file. Use the absolute path or the path relative to the current working directory, such as `<plugin-dir>/<plugin-file-name>.py`.
## Options
| Option | Flag | Description |
| :----- | :-------------------- | :-------------------------------------------------------------------------------------------- |
| `-H` | `--host` | URL of the running {{< product-name >}} server <br>(default: `http://127.0.0.1:8181`) |
| `-d` | `--database` | _({{< req >}})_ Name of the database you want to test the plugin against |
| | `--token` | _({{< req >}})_ Authentication token |
| | `--input-arguments` | JSON map of key/value pairs to pass as plugin input arguments (for example, `'{"key":"val"}'`)|
| | `--schedule` | Cron schedule to simulate when testing the plugin <br>(default: `* * * * *`) |
| | `--cache-name` | Optional cache name to associate with the test |
| | `--tls-ca` | Path to a custom TLS certificate authority for self-signed certs |
| `-h` | `--help` | Show basic help information |
| | `--help-all` | Show all available help options |
### Option environment variables
You can use the following environment variables to set command options:
| Environment Variable | Corresponding Option |
| :------------------------ | :------------------- |
| `INFLUXDB3_HOST_URL` | `--host` |
| `INFLUXDB3_DATABASE_NAME` | `--database` |
| `INFLUXDB3_AUTH_TOKEN` | `--token` |
| `INFLUXDB3_TLS_CA` | `--tls-ca` |
## Examples
In the examples below, replace the following:
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: Your target database
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: Your authentication token
- {{% code-placeholder-key %}}`PLUGIN_DIR`{{% /code-placeholder-key %}}:
the path to the plugin directory you provided when starting the server
- {{% code-placeholder-key %}}`FILENAME`{{% /code-placeholder-key %}}:
Plugin file name
{{% code-placeholders "(DATABASE|PLUGIN_DIR|FILENAME|AUTH_TOKEN)" %}}
### Test a schedule plugin
<!--pytest.mark.skip-->
```bash
influxdb3 test schedule_plugin \
--database DATABASE_NAME \
--token AUTH_TOKEN \
PLUGIN_DIR/FILENAME.py
```
### Test with input arguments and a custom cron schedule
You can pass input arguments to your plugin as key-value pairs and specify a custom cron schedule (using Quartz cron syntax with six fields):
<!--pytest.mark.skip-->
```bash
influxdb3 test schedule_plugin \
--host http://localhost:8182 \
--database DATABASE_NAME \
--token AUTH_TOKEN \
--input-arguments threshold=10,unit=seconds \
--schedule "0 0 * * * ?" \
PLUGIN_DIR/FILENAME.py
```
- Pass plugin parameters using `--input-arguments` as comma-separated key=value pairs.
- Use `--schedule` to set the plugins execution time with a Quartz cron expression. For example, "0 0 * * * ?" runs the plugin at the start of every hour.
{{% /code-placeholders %}}

View File

@ -523,27 +523,90 @@ influxdb3 create trigger \
### Install Python dependencies
If your plugin needs additional Python packages, use the `influxdb3 install` command:
Use the `influxdb3 install package` command to add third-party libraries (like `pandas`, `requests`, or `influxdb3-python`) to your plugin environment.
This installs packages into the Processing Engines embedded Python environment to ensure compatibility with your InfluxDB instance.
{{% code-placeholders "CONTAINER_NAME|PACKAGE_NAME" %}}
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[CLI](#)
[Docker](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
```bash
# Install a package directly
# Use the CLI to install a Python package
influxdb3 install package pandas
```
{{% /code-tab-content %}}
{{% code-tab-content %}}
```bash
# With Docker
# Use the CLI to install a Python package in a Docker container
docker exec -it CONTAINER_NAME influxdb3 install package pandas
```
This creates a Python virtual environment in your plugins directory with the specified packages installed.
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
These examples install the specified Python package (for example, pandas) into the Processing Engines embedded virtual environment.
- Use the CLI command when running InfluxDB directly on your system.
- Use the Docker variant if you're running InfluxDB in a containerized environment.
> [!Important]
> #### Use bundled Python for plugins
> When you start the server with the `--plugin-dir` option, InfluxDB 3 creates a Python virtual environment (`<PLUGIN_DIR>/venv`) for your plugins.
> If you need to create a custom virtual environment, use the Python interpreter bundled with InfluxDB 3. Don't use the system Python.
> Creating a virtual environment with the system Python (for example, using `python -m venv`) can lead to runtime errors and plugin failures.
>
>For more information, see the [processing engine README](https://github.com/influxdata/influxdb/blob/main/README_processing_engine.md#official-builds).
{{% /code-placeholders %}}
InfluxDB creates a Python virtual environment in your plugins directory with the specified packages installed.
{{% show-in "enterprise" %}}
### Connect Grafana to your InfluxDB instance
## Distributed cluster considerations
When configuring Grafana to connect to an InfluxDB 3 Enterprise instance:
When you deploy {{% product-name %}} in a multi-node environment, configure each node based on its role and the plugins it runs.
- **URL**: Use a querier URL or any node that serves queries
### Match plugin types to the correct node
Each plugin must run on a node that supports its trigger type:
| Plugin type | Trigger spec | Runs on |
|--------------------|--------------------------|-----------------------------|
| Data write | `table:` or `all_tables` | Ingester nodes |
| Scheduled | `every:` or `cron:` | Any node with scheduler |
| HTTP request | `path:` | Nodes that serve API traffic|
For example:
- Run write-ahead log (WAL) plugins on ingester nodes.
- Run scheduled plugins on any node configured to execute them.
- Run HTTP-triggered plugins on querier nodes or any node that handles HTTP endpoints.
Place all plugin files in the `--plugin-dir` directory configured for each node.
> [!Note]
> Triggers fail if the plugin file isnt available on the node where it runs.
### Route third-party clients to querier nodes
External tools—such as Grafana, custom dashboards, or REST clients—must connect to querier nodes in your InfluxDB Enterprise deployment.
#### Examples
- **Grafana**: When adding InfluxDB 3 as a Grafana data source, use a querier node URL, such as:
`https://querier.example.com:8086`
- **REST clients**: Applications using `POST /api/v3/query/sql` or similar endpoints must target a querier node.
Example URL format: `https://querier.your-influxdb.com:8086`
{{% /show-in %}}