Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(aggregators.final): Add new tag instead of appending "_final" to fields #15267

Closed
LarsStegman opened this issue Apr 30, 2024 · 1 comment · Fixed by #15268
Closed

feat(aggregators.final): Add new tag instead of appending "_final" to fields #15267

LarsStegman opened this issue Apr 30, 2024 · 1 comment · Fixed by #15268
Labels
feature request Requests for new plugin and for new features to existing plugins

Comments

@LarsStegman
Copy link
Contributor

Use Case

We have Telegraf parsing a binary message that comes in at 50Hz. We want to write the 50Hz data to an Influx bucket that is kept locally on a remote location. We want to take the last values and write them to a bucket that is replicated to a central location. We also want to keep the same data schema. By adding a tag instead of changing the field name, we can route the down sampled values to a different influx output.

Expected behavior

The field names are the same, but a tag is added to indicate the metrics have passed through the aggregator.

The extra tag can of course be added using tags.

[[aggregators.final]]
  tags = {"?frequency"="low"}
  period = "1s"
  drop_original = false
  rename_fields = false
  output_strategy = "periodic"

Input

data,my=tag my_field=23i
data,my=tag my_field=24i
data,my=tag my_field=25i
data,my=tag my_field=26i
data,my=tag my_field=27i
data,my=tag my_field=28i
data,my=tag my_field=29i
data,my=tag my_field=30i

Output

data,my=tag my_field=20i
data,my=tag my_field=21i
data,my=tag my_field=22i
data,my=tag my_field=23i
data,my=tag my_field=24i
data,my=tag my_field=25i
data,my=tag,?frequency=low my_field=25i
data,my=tag my_field=26i
data,my=tag my_field=27i
data,my=tag my_field=28i
data,my=tag my_field=29i
data,my=tag my_field=30i
data,my=tag,?frequency=low my_field=30i

Actual behavior

Input

data,my=tag my_field=23i
data,my=tag my_field=24i
data,my=tag my_field=25i
data,my=tag my_field=26i
data,my=tag my_field=27i
data,my=tag my_field=28i
data,my=tag my_field=29i
data,my=tag my_field=30i

Output

data,my=tag my_field=20i
data,my=tag my_field=21i
data,my=tag my_field=22i
data,my=tag my_field=23i
data,my=tag my_field=24i
data,my=tag my_field=25i
data,my=tag,?frequency=low my_field_final=25i
data,my=tag my_field=26i
data,my=tag my_field=27i
data,my=tag my_field=28i
data,my=tag my_field=29i
data,my=tag my_field=30i
data,my=tag,?frequency=low my_field_final=30i

Additional info

I am willing to create a PR for this myself.

@LarsStegman LarsStegman added the feature request Requests for new plugin and for new features to existing plugins label Apr 30, 2024
@LarsStegman
Copy link
Contributor Author

I was under the impressions that adding tags to an aggregator would also add the tags to the output metrics, but that is apparently not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant