docs(processors.parser): Improve documentation of merge strategy#18516
docs(processors.parser): Improve documentation of merge strategy#18516srebhan wants to merge 1 commit intoinfluxdata:masterfrom
Conversation
2f9a962 to
2a9eed6
Compare
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
| ## 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 |
There was a problem hiding this comment.
| ## 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 |
There was a problem hiding this comment.
| ## merged merged but retaining the first timestamp. If drop_original is | |
| ## merged but retaining the first timestamp. If drop_original is |
| ```text | ||
| metric,source=foo,status=fault value1=1i,value2=23i,value3=19i,value4=42i,additional=true 1773258782000000000 | ||
| ``` | ||
|
|
||
| with `drop_original = true` |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
Minor: test uses tt.expected instead of local expected in assertion
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