influxdata / influxdata/kapacitor
groupByMeasurement and .Name variable not working on Deadman-Method
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
OS: Ubuntu 18.04, Kapacitor-Docker-Image
Version: Kapacitor OSS 1.5.2 (git: HEAD 3086452d00830e01d932838d8c6d1df818648ad3)
When using the deadman-switch with the `.groupByMeasurement()` property on a stream I'd expect the `{{ .Group}}` variable to be prepended with the name of the measurement [as stated in the documentation](https://docs.influxdata.com/kapacitor/v1.5/nodes/from_node/#groupbymeasurement). Instead the contents of the `{{.Name}}` variable which the group is prepended with, is `stats`. I suspect this to be caused by the StatsNode, which is internally used by the deadman-switch method.
A test-scenario can easily be created with chronograf by creating a deadman alert on a specific database and measurement and then alter the created tickscript to use `.groupByMeasurement()` instead of `.measurement(foo)`. The message should contain the variables `{{.Name}}` and `{{.Group}}` so the problem can be observed.
**Edit 1:**
I think it is a general problem, that the `StatsNode` used here is altering the `Name` variable. I sent out the json representation via https and noticed that there the name which should be the name of the measurement is also `stats` instead. Also when using `.measurement('')` and not `.groupByMeasurement()`. So this seems to be a general issue in the deadman-method.
Contributor guide
Research direction
Start with the deadman method and its internally used StatsNode, then reproduce the issue using a tickscript with .groupByMeasurement() and messages containing {{.Name}} and {{.Group}}. Compare those variables with the measurement name in the HTTPS JSON output; done means the deadman alert preserves the expected measurement name and group.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100