Skip to content

docs(processors.parser): Improve documentation of merge strategy#18516

Open
srebhan wants to merge 1 commit intoinfluxdata:masterfrom
srebhan:processors_parser_issue_16382
Open

docs(processors.parser): Improve documentation of merge strategy#18516
srebhan wants to merge 1 commit intoinfluxdata:masterfrom
srebhan:processors_parser_issue_16382

Conversation

@srebhan
Copy link
Member

@srebhan srebhan commented Mar 11, 2026

Summary

Documentation of merge strategy is misleading in the sense that is suggests that each metric is merged individually with the parent metric and therefore returning parsed-metric many result metrics.

This PR improves the documentation, adding an example and also adding unit-tests for the merge strategy with multiple parsed metrics.

Checklist

Related issues

related to #16382

@telegraf-tiger telegraf-tiger bot added docs Issues related to Telegraf documentation and configuration descriptions plugin/processor labels Mar 11, 2026
@srebhan srebhan force-pushed the processors_parser_issue_16382 branch from 2f9a962 to 2a9eed6 Compare March 11, 2026 21:18
@telegraf-tiger
Copy link
Contributor

Copy link
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srebhan Thanks! A couple of comments.

## set based on the new metrics if present.
## Possible options are:
## - override: emit a single metric with all tags and fields of newly parsed
## merged merged but retaining the first timestamp. If drop_original is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## merged merged but retaining the first timestamp. If drop_original is
## merged but retaining the first timestamp. If drop_original is

## set based on the new metrics if present.
## Possible options are:
## - override: emit a single metric with all tags and fields of newly parsed
## merged merged but retaining the first timestamp. If drop_original is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## merged merged but retaining the first timestamp. If drop_original is
## merged but retaining the first timestamp. If drop_original is

Comment on lines +90 to +94
```text
metric,source=foo,status=fault value1=1i,value2=23i,value3=19i,value4=42i,additional=true 1773258782000000000
```

with `drop_original = true`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The drop_original labels here appear swapped. The shown result has source=foo and additional=true from the parent metric with the parent timestamp, which is the drop_original = false behavior (confirmed by the new tests). Also the drop_original = false block is empty.


// Parse the metric and check the result
output := plugin.Apply(input)
testutil.RequireMetricsEqual(t, tt.expected, output, testutil.SortMetrics())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: test uses tt.expected instead of local expected in assertion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Issues related to Telegraf documentation and configuration descriptions plugin/processor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants