influxdata / influxdata/kapacitor
Converting tag value into field name
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi,
I have some data in InfluxDB where the field name is simply "value" with a tag `instance = temperature_sensor`.
I would like to convert this instead into: a field name of "temperature_sensor", and I'm not fussed about the tag.
I thought to do this as follows:
```
var phidget_points = stream
|from()
.measurement('phidget_value')
var phidgets_as_fields = phidget_points
|eval(lambda: "value")
.as('{{index .Tags "instance"}}')
```
However I was sad to see that the templating doesn't work within "as" methods, or perhaps the tag is already gone by this time.
Do you have any advice on this?
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating the implementation and documentation for the eval node and its as method, then determine whether tag-derived field names are supported; done should be a documented answer or a clearly scoped change request.
Written by the indexing model from the issue text.
Assessment
- Domain
- stream-processing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100