influxdata / influxdata/kapacitor
Question: How to select field based on script variable
Open
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I have simple alert where field name may vary between tasks. How to write basically {{index .Fields hereIsMyVariableThatChanges}}
```
var myFieldName string
...
.alerta()
.value('{{index .Fields myFieldName}}')
...
```
Is there some syntax trick to do that? Or should i write some kind of .eval with .as?
Contributor guide
Research direction
Start with the expression examples in the issue, especially `.alerta()`, `.value(...)`, `.eval`, `.as`, and `.Fields`. Determine whether the requested variable-based field selection is supported and what the documented syntax or limitation should be; the issue provides no file or test to target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100