influxdata / influxdata/kapacitor

Question: How to select field based on script variable

Open
#1,888 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

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.