influxdata / influxdata/kapacitor

Multiply templated tasks in one yaml or json, or in folders

Open
#2,364 0 comments 1 reaction 0 assignees View on GitHub
enhancement pm/review
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

Now we can create templated tasks such as:
```
{
"template-id": "generic_mean_alert",
"dbrps": [{"db": "telegraf", "rp": "autogen"}],
"vars": {
"measurement": {"type" : "string", "value" : "mem" },
"groups": {"type": "list", "value": [{"type":"star", "value":"*"}]},
"field": {"type" : "string", "value" : "used_percent" },
"warn": {"type" : "lambda", "value" : "\"mean\" > 80.0" },
"crit": {"type" : "lambda", "value" : "\"mean\" > 90.0" }
}
}
```
Files count is growing and growing.
It will be great to have an option for keeping multiply in one json file.
It will be something like:

```
[
{
"template-id": "generic_mean_alert",
"dbrps": [{"db": "telegraf", "rp": "autogen"}],
"vars": {
"measurement": {"type" : "string", "value" : "mem" },
"groups": {"type": "list", "value": [{"type":"star", "value":"*"}]},
"field": {"type" : "string", "value" : "used_percent" },
"warn": {"type" : "lambda", "value" : "\"mean\" > 80.0" },
"crit": {"type" : "lambda", "value" : "\"mean\" > 90.0" }
}
},
{
"template-id": "generic_mean_alert",
"dbrps": [{"db": "telegraf", "rp": "autogen"}],
"vars": {
"measurement": {"type" : "string", "value" : "mem" },
"groups": {"type": "list", "value": [{"type":"star", "value":"*"}]},
"field": {"type" : "string", "value" : "free_percent" },
"warn": {"type" : "lambda", "value" : "\"mean\" > 20.0" },
"crit": {"type" : "lambda", "value" : "\"mean\" > 10.0" }
}
}
]
```

Also importing from subfolders can be a solution of this problem. Now kapacitor imports only root level tasks.

Contributor guide

Open the contributing guide

Research direction

No implementation files, tests, or entry points are named. Start by locating the code that imports root-level Kapacitor tasks and inspect how JSON and YAML task files are parsed. Define whether completion means supporting multiple task definitions per file, recursive subfolder imports, or both, then add coverage for the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, json, yaml
Domain
backend, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.