influxdata / influxdata/kapacitor

Templates in InfluxDBOutNode tag

Open
#979 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.