influxdata / influxdata/kapacitor

In batch template, access to the defined dbrp is missing

Open
#2,005 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

A batch template can be bound to a dbrp in different ways:
- explicitly via the `dbrp` keyword inside the template
- via the command line (`kapacitor define cpu_alert -template generic_mean_alert -vars cpu_vars.json -dbrp telegraf.autogen`)
- via the `dbrps` field of a task definition

The problem is that the same dbrp must also appear in the `query` definition, after the `FROM`.

For a batch template to be used with different dbrps, the defined dbrp must be available somehow from the template, for instance as a `dbrp` variable:
```
batch
|query('select ... from ' + dbrp + ' where ...)
.every(1m)
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing how batch templates receive dbrp through the template keyword, the kapacitor define command's -dbrp option, and task definitions' dbrps field, then how the query's FROM clause is represented. Done requires an agreed mechanism for a template to access its selected dbrp so the same template can construct queries for different dbrps.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.