influxdata / influxdata/kapacitor
Kapacitor only loading first TICKScript in Load directory
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I'm trying to use the [Load Directory](https://docs.influxdata.com/kapacitor/v1.5/guides/load_directory/) feature with the Kapacitor [Helm Chart](https://github.com/influxdata/helm-charts/tree/master/charts/kapacitor) sideload functionality.
I have several `.tick` files in the `tasks` folder but Kapacitor only picks up the first file it finds and skips the rest. I have tried renaming the files and they are ordered and processed alphabetically, which is [expected](https://github.com/influxdata/kapacitor/blob/master/services/load/service.go#L122). There are no errors in the logs.
Helm `values.yaml`:
```
kapacitor:
influxURL: 'http://influxdb:8086'
sidecar:
sideload:
enabled: true
label: kapacitor_sideload
folder: /var/lib/kapacitor/sideload/tasks
envVars:
KAPACITOR_LOAD_ENABLED: true
KAPACITOR_LOAD_DIR: /var/lib/kapacitor/sideload
```
Kapacitor container logs:
```
ts=2020-12-14T10:37:10.414Z lvl=debug msg=“loading templates” service=load
ts=2020-12-14T10:37:10.414Z lvl=debug msg=“loading tasks” service=load
ts=2020-12-14T10:37:10.414Z lvl=debug msg=“loading object from file” service=load object=task file=/var/lib/kapacitor/sideload/tasks/a_prod_error_count.tick
ts=2020-12-14T10:37:10.420Z lvl=info msg=“Starting target manager…” service=scraper
ts=2020-12-14T10:37:10.457Z lvl=debug msg=“starting task” service=kapacitor task_master=main task=a_prod_error_count
ts=2020-12-14T10:37:10.457Z lvl=info msg=“started task” service=kapacitor task_master=main task=a_prod_error_count
ts=2020-12-14T10:37:10.457Z lvl=debug msg=“listing dot” service=kapacitor task_master=main dot=“digraph a_prod_error_count {\nstream0 -> from1;\nfrom1 -> window2;\nwindow2 -> sum3;\nsum3 -> alert4;\n}”
ts=2020-12-14T10:37:10.479Z lvl=debug msg=“loading handlers” service=load
```
The script `a_prod_error_count.tick` is processed and I would expect to see logs for the other other scripts. Using the CLI `kapacitor list tasks` only shows the one task processed above.
I have created Kapacitor Tasks using the same `.tick` scripts via the CLI without problem, so the issue appears to be with the Load Directory functionality.
- Kapacitor version `1.5.7-alpine`
- Sidecar version `kiwigrid/k8s-sidecar:0.1.116`
- Helm Chart version `influxdata/kapacitor:1.3.1`
- k8s version `v1.18.9-eks`
Contributor guide
Research direction
Start with services/load/service.go around line 122, where the load directory files are ordered and processed. Reproduce the issue with several .tick files using the shown Helm sidecar configuration, then compare the service logs and `kapacitor list tasks` output. Done means every task file in the directory is loaded and started.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, helm, kubernetes
- Domain
- backend, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100