influxdata / influxdata/kapacitor
Templates in InfluxDBOutNode tag
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi,
I am trying to use the InfluxDBOutNode to write the results of my tick script back to InfluxDB, and I would like to add a tag that indicates the task who wrote the line,
something like this:
```
var data = stream
|from()
.measurement('cpuStats')
|groupBy('host')
|window()
.period(1h)
.every(1m)
|mean('idle')
|eval(lambda: int(100.0 - "mean"))
.as('load')
//Send alert
data
|alert()
...
//Save data to influxdb for dashboard
data
|influxDBOut()
.database('clusterStatus')
.retentionPolicy('default')
.measurement('cpuStatus')
.tag('kapacitor', 'true')
.tag('cluster_task', '{{ .TaskName }}')
```
unfortunately, this writes "{{ .TaskName }}" in the database, instead of e.g. "cpu_monitor_task".
Is there another way to do this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the InfluxDBOutNode and the influxDBOut() call shown in the example, then trace how tag values are handled. Determine the intended template context and define what output should be written for a task name; no test or implementation file is identified in the issue.
Written by the indexing model from the issue text.
Assessment
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100