Skip to content

Commit 3730ba5

Browse files
authored
Merge branch 'master' into fix-lefthook-patterns
2 parents 78857d8 + 47cb2ce commit 3730ba5

File tree

6 files changed

+477
-80
lines changed

6 files changed

+477
-80
lines changed

api-docs/influxdb3/core/v3/ref.yml

Lines changed: 208 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ tags:
146146
description: |
147147
Manage Processing engine triggers, test plugins, and send requests to trigger On Request plugins.
148148
149-
InfluxDB 3 Core provides the InfluxDB 3 Processing engine, an embedded Python VM that can dynamically load and trigger Python plugins in response to events in your database.
149+
InfluxDB 3 Core provides the InfluxDB 3 processing engine, an embedded Python VM that can dynamically load and trigger Python plugins in response to events in your database.
150150
Use Processing engine plugins and triggers to run code and perform tasks for different database events.
151151
152-
To get started with the Processing engine, see the [Processing engine and Python plugins](/influxdb3/core/processing-engine/) guide.
152+
To get started with the processing engine, see the [Processing engine and Python plugins](/influxdb3/core/processing-engine/) guide.
153153
- name: Query data
154154
description: Query data using SQL or InfluxQL
155155
- name: Quick start
156156
description: |
157-
1. [Create an admin token](#section/Authentication) for the InfluxDB 3 Core API.
157+
1. [Create an admin token](#section/Authentication) to authorize API requests.
158158
159159
```bash
160160
curl -X POST "http://localhost:8181/api/v3/configure/token/admin"
@@ -385,12 +385,7 @@ paths:
385385
parameters:
386386
- $ref: '#/components/parameters/dbWriteParam'
387387
- $ref: '#/components/parameters/accept_partial'
388-
- name: precision
389-
in: query
390-
required: true
391-
schema:
392-
$ref: '#/components/schemas/PrecisionWrite'
393-
description: Precision of timestamps.
388+
- $ref: '#/components/parameters/precisionParam'
394389
- name: no_sync
395390
in: query
396391
schema:
@@ -440,16 +435,8 @@ paths:
440435
description: Executes an SQL query to retrieve data from the specified database.
441436
parameters:
442437
- $ref: '#/components/parameters/db'
443-
- name: q
444-
in: query
445-
required: true
446-
schema:
447-
type: string
448-
- name: format
449-
in: query
450-
required: false
451-
schema:
452-
type: string
438+
- $ref: '#/components/parameters/querySqlParam'
439+
- $ref: '#/components/parameters/format'
453440
- $ref: '#/components/parameters/AcceptQueryHeader'
454441
- $ref: '#/components/parameters/ContentType'
455442
responses:
@@ -1072,15 +1059,104 @@ paths:
10721059
post:
10731060
operationId: PostConfigureProcessingEngineTrigger
10741061
summary: Create processing engine trigger
1075-
description: Creates a new processing engine trigger.
1062+
description: |
1063+
Creates a processing engine trigger with the specified plugin file and trigger specification.
1064+
1065+
### Related guides
1066+
1067+
- [Processing engine and Python plugins](/influxdb3/core/plugins/)
10761068
requestBody:
10771069
required: true
10781070
content:
10791071
application/json:
10801072
schema:
10811073
$ref: '#/components/schemas/ProcessingEngineTriggerRequest'
1074+
examples:
1075+
schedule_cron:
1076+
summary: Schedule trigger using cron
1077+
description: |
1078+
In `"cron:CRON_EXPRESSION"`, `CRON_EXPRESSION` uses extended 6-field cron format.
1079+
The cron expression `0 0 6 * * 1-5` means the trigger will run at 6:00 AM every weekday (Monday to Friday).
1080+
value:
1081+
db: DATABASE_NAME
1082+
plugin_filename: schedule.py
1083+
trigger_name: schedule_cron_trigger
1084+
trigger_specification: cron:0 0 6 * * 1-5
1085+
schedule_every:
1086+
summary: Schedule trigger using interval
1087+
description: |
1088+
In `"every:DURATION"`, `DURATION` specifies the interval between trigger executions.
1089+
The duration `1h` means the trigger will run every hour.
1090+
value:
1091+
db: mydb
1092+
plugin_filename: schedule.py
1093+
trigger_name: schedule_every_trigger
1094+
trigger_specification: every:1h
1095+
schedule_every_seconds:
1096+
summary: Schedule trigger using seconds interval
1097+
description: |
1098+
Example of scheduling a trigger to run every 30 seconds.
1099+
value:
1100+
db: mydb
1101+
plugin_filename: schedule.py
1102+
trigger_name: schedule_every_30s_trigger
1103+
trigger_specification: every:30s
1104+
schedule_every_minutes:
1105+
summary: Schedule trigger using minutes interval
1106+
description: |
1107+
Example of scheduling a trigger to run every 5 minutes.
1108+
value:
1109+
db: mydb
1110+
plugin_filename: schedule.py
1111+
trigger_name: schedule_every_5m_trigger
1112+
trigger_specification: every:5m
1113+
all_tables:
1114+
summary: All tables trigger example
1115+
description: |
1116+
Trigger that fires on write events to any table in the database.
1117+
value:
1118+
db: mydb
1119+
plugin_filename: all_tables.py
1120+
trigger_name: all_tables_trigger
1121+
trigger_specification: all_tables
1122+
table_specific:
1123+
summary: Table-specific trigger example
1124+
description: |
1125+
Trigger that fires on write events to a specific table.
1126+
value:
1127+
db: mydb
1128+
plugin_filename: table.py
1129+
trigger_name: table_trigger
1130+
trigger_specification: table:sensors
1131+
api_request:
1132+
summary: On-demand request trigger example
1133+
description: |
1134+
Creates an HTTP endpoint `/api/v3/engine/hello-world` for manual invocation.
1135+
value:
1136+
db: mydb
1137+
plugin_filename: request.py
1138+
trigger_name: hello_world_trigger
1139+
trigger_specification: path:hello-world
1140+
cron_friday_afternoon:
1141+
summary: Cron trigger for Friday afternoons
1142+
description: |
1143+
Example of a cron trigger that runs every Friday at 2:30 PM.
1144+
value:
1145+
db: reports
1146+
plugin_filename: weekly_report.py
1147+
trigger_name: friday_report_trigger
1148+
trigger_specification: cron:0 30 14 * * 5
1149+
cron_monthly:
1150+
summary: Cron trigger for monthly execution
1151+
description: |
1152+
Example of a cron trigger that runs on the first day of every month at midnight.
1153+
value:
1154+
db: monthly_data
1155+
plugin_filename: monthly_cleanup.py
1156+
trigger_name: monthly_cleanup_trigger
1157+
trigger_specification: cron:0 0 0 1 * *
10821158
responses:
1083-
'201':
1159+
'200':
10841160
description: Success. Processing engine trigger created.
10851161
'400':
10861162
description: Bad request.
@@ -1157,7 +1233,7 @@ paths:
11571233
$ref: '#/components/schemas/ProcessingEngineTriggerRequest'
11581234
responses:
11591235
'200':
1160-
description: Success. The processing engine trigger has been enabled.
1236+
description: Success. The processing engine trigger is enabled.
11611237
'400':
11621238
description: Bad request.
11631239
'401':
@@ -1170,7 +1246,14 @@ paths:
11701246
post:
11711247
operationId: PostInstallPluginPackages
11721248
summary: Install plugin packages
1173-
description: Installs packages for the plugin environment.
1249+
description: |
1250+
Installs the specified Python packages into the processing engine plugin environment.
1251+
1252+
This endpoint is synchronous and blocks until the packages are installed.
1253+
1254+
### Related guides
1255+
1256+
- [Processing engine and Python plugins](/influxdb3/core/plugins/)
11741257
parameters:
11751258
- $ref: '#/components/parameters/ContentType'
11761259
requestBody:
@@ -1179,10 +1262,30 @@ paths:
11791262
application/json:
11801263
schema:
11811264
type: object
1182-
additionalProperties: true
1265+
properties:
1266+
packages:
1267+
type: array
1268+
items:
1269+
type: string
1270+
description: |
1271+
A list of Python package names to install.
1272+
Can include version specifiers (e.g., "scipy==1.9.0").
1273+
example:
1274+
- influxdb3-python
1275+
- scipy
1276+
- pandas==1.5.0
1277+
- requests
1278+
required:
1279+
- packages
1280+
example:
1281+
packages:
1282+
- influxdb3-python
1283+
- scipy
1284+
- pandas==1.5.0
1285+
- requests
11831286
responses:
11841287
'200':
1185-
description: Success. The packages have been installed.
1288+
description: Success. The packages are installed.
11861289
'400':
11871290
description: Bad request.
11881291
'401':
@@ -1193,7 +1296,15 @@ paths:
11931296
post:
11941297
operationId: PostInstallPluginRequirements
11951298
summary: Install plugin requirements
1196-
description: Installs requirements for the plugin environment.
1299+
description: |
1300+
Installs requirements from a requirements file (also known as a "pip requirements file") into the processing engine plugin environment.
1301+
1302+
This endpoint is synchronous and blocks until the requirements are installed.
1303+
1304+
### Related
1305+
1306+
- [Processing engine and Python plugins](/influxdb3/core/plugins/)
1307+
- [Python requirements file format](https://pip.pypa.io/en/stable/reference/requirements-file-format/)
11971308
parameters:
11981309
- $ref: '#/components/parameters/ContentType'
11991310
requestBody:
@@ -1202,7 +1313,17 @@ paths:
12021313
application/json:
12031314
schema:
12041315
type: object
1205-
additionalProperties: true
1316+
properties:
1317+
requirements_location:
1318+
type: string
1319+
description: |
1320+
The path to the requirements file containing Python packages to install.
1321+
Can be a relative path (relative to the plugin directory) or an absolute path.
1322+
example: requirements.txt
1323+
required:
1324+
- requirements_location
1325+
example:
1326+
requirements_location: requirements.txt
12061327
responses:
12071328
'200':
12081329
description: Success. The requirements have been installed.
@@ -1248,18 +1369,18 @@ paths:
12481369
parameters:
12491370
- name: plugin_path
12501371
description: |
1251-
The path configured in the `trigger-spec` for the plugin.
1372+
The path configured in the request trigger specification "path:<plugin_path>"` for the plugin.
12521373
12531374
For example, if you define a trigger with the following:
12541375
1255-
```
1256-
trigger-spec: "request:hello-world"
1376+
```json
1377+
trigger-spec: "path:hello-world"
12571378
```
12581379
12591380
then, the HTTP API exposes the following plugin endpoint:
12601381
12611382
```
1262-
<INFLUXDB_HOST>/api/v3/engine/hello-world
1383+
<INFLUXDB3_HOST>/api/v3/engine/hello-world
12631384
```
12641385
in: path
12651386
required: true
@@ -1269,7 +1390,7 @@ paths:
12691390
operationId: GetProcessingEnginePluginRequest
12701391
summary: On Request processing engine plugin request
12711392
description: |
1272-
Sends a request to invoke an _On Request_ processing engine plugin.
1393+
Executes the On Request processing engine plugin specified in `<plugin_path>`.
12731394
The request can include request headers, query string parameters, and a request body, which InfluxDB passes to the plugin.
12741395
12751396
An On Request plugin implements the following signature:
@@ -1296,7 +1417,7 @@ paths:
12961417
operationId: PostProcessingEnginePluginRequest
12971418
summary: On Request processing engine plugin request
12981419
description: |
1299-
Sends a request to invoke an _On Request_ processing engine plugin.
1420+
Executes the On Request processing engine plugin specified in `<plugin_path>`.
13001421
The request can include request headers, query string parameters, and a request body, which InfluxDB passes to the plugin.
13011422
13021423
An On Request plugin implements the following signature:
@@ -1335,8 +1456,6 @@ paths:
13351456
description: |
13361457
Creates an admin token.
13371458
An admin token is a special type of token that has full access to all resources in the system.
1338-
1339-
This endpoint is only available in InfluxDB 3 Enterprise.
13401459
responses:
13411460
'201':
13421461
description: |
@@ -1357,8 +1476,6 @@ paths:
13571476
summary: Regenerate admin token
13581477
description: |
13591478
Regenerates an admin token and revokes the previous token with the same name.
1360-
1361-
This endpoint is only available in InfluxDB 3 Enterprise.
13621479
parameters: []
13631480
responses:
13641481
'201':
@@ -1429,7 +1546,6 @@ components:
14291546
schema:
14301547
type: string
14311548
description: |
1432-
The name of the database.
14331549
The name of the database.
14341550
InfluxDB creates the database if it doesn't already exist, and then
14351551
writes all points in the batch to the database.
@@ -1747,15 +1863,69 @@ components:
17471863
type: string
17481864
plugin_filename:
17491865
type: string
1866+
description: |
1867+
The path and filename of the plugin to execute--for example,
1868+
`schedule.py` or `endpoints/report.py`.
1869+
The path can be absolute or relative to the `--plugins-dir` directory configured when starting InfluxDB 3.
1870+
1871+
The plugin file must implement the trigger interface associated with the trigger's specification (`trigger_spec`).
17501872
trigger_name:
17511873
type: string
17521874
trigger_specification:
17531875
type: string
1876+
description: |
1877+
Specifies when and how the processing engine trigger should be invoked.
1878+
1879+
## Supported trigger specifications:
1880+
1881+
### Cron-based scheduling
1882+
Format: `cron:CRON_EXPRESSION`
1883+
1884+
Uses extended (6-field) cron format (second minute hour day_of_month month day_of_week):
1885+
```
1886+
┌───────────── second (0-59)
1887+
│ ┌───────────── minute (0-59)
1888+
│ │ ┌───────────── hour (0-23)
1889+
│ │ │ ┌───────────── day of month (1-31)
1890+
│ │ │ │ ┌───────────── month (1-12)
1891+
│ │ │ │ │ ┌───────────── day of week (0-6, Sunday=0)
1892+
│ │ │ │ │ │
1893+
* * * * * *
1894+
```
1895+
Examples:
1896+
- `cron:0 0 6 * * 1-5` - Every weekday at 6:00 AM
1897+
- `cron:0 30 14 * * 5` - Every Friday at 2:30 PM
1898+
- `cron:0 0 0 1 * *` - First day of every month at midnight
1899+
1900+
### Interval-based scheduling
1901+
Format: `every:DURATION`
1902+
1903+
Supported durations: `s` (seconds), `m` (minutes), `h` (hours), `d` (days):
1904+
- `every:30s` - Every 30 seconds
1905+
- `every:5m` - Every 5 minutes
1906+
- `every:1h` - Every hour
1907+
- `every:1d` - Every day
1908+
1909+
### Table-based triggers
1910+
- `all_tables` - Triggers on write events to any table in the database
1911+
- `table:TABLE_NAME` - Triggers on write events to a specific table
1912+
1913+
### On-demand triggers
1914+
Format: `path:ENDPOINT_NAME`
1915+
1916+
Creates an HTTP endpoint `/api/v3/engine/ENDPOINT_NAME` for manual invocation:
1917+
- `path:hello-world` - Creates endpoint `/api/v3/engine/hello-world`
1918+
- `path:data-export` - Creates endpoint `/api/v3/engine/data-export`
1919+
pattern: ^(cron:[0-9 *,/-]+|every:[0-9]+[smhd]|all_tables|table:[a-zA-Z_][a-zA-Z0-9_]*|path:[a-zA-Z0-9_-]+)$
1920+
example: cron:0 0 6 * * 1-5
17541921
trigger_arguments:
17551922
type: object
17561923
additionalProperties: true
1924+
description: Optional arguments passed to the plugin.
17571925
disabled:
17581926
type: boolean
1927+
default: false
1928+
description: Whether the trigger is disabled.
17591929
required:
17601930
- db
17611931
- plugin_filename
@@ -1879,8 +2049,6 @@ components:
18792049
scheme: bearer
18802050
bearerFormat: JWT
18812051
description: |
1882-
_During Alpha release, an API token is not required._
1883-
18842052
A Bearer token for authentication.
18852053
18862054
Provide the scheme and the API token in the `Authorization` header--for example:

0 commit comments

Comments
 (0)