You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Adding a feature following
#30644.
This feature allow json_array_parser parser to accept a comma-delimited
header and for every json array it parses, output a map which contains
the header fileds as keys and the matching values are the ones parsed
from the input json array.
This feature as added mainly for performance reasons as from a
functional POV, this is mostly similar to chaining the 2 operators:
`json_array_parser -> assign_keys `
**Link to tracking Issue:** <Issue number if applicable>
#30321
**Testing:** <Describe what testing was performed and which tests were
added.>
- unittests
- End to end tests
Used generated traffic on a running otel collector thats using the
parser and verified the data is as expected in the end table and
performance looks good
**Documentation:** <Describe the documentation added.>
-
[json_array_parser.md](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/58cc91ca30eabbd35c074d79db8630fc474164d9/pkg/stanza/docs/operators/json_array_parser.md)
|`id`|`json_array_parser`| A unique identifier for the operator. |
49
49
|`output`| Next in pipeline | The connected operator(s) that will receive all outbound entries. |
50
+
|`header`| optional | A string of comma delimited field names. When a header is set, the output will be a map containing the header fields as keys and the parsed input json array fields as matching values |
50
51
|`parse_from`|`body`| The [field](../types/field.md) from which the value will be parsed. |
51
-
|`parse_to`| required. can be one of `body` or a nested field inside `body`, `attributes` or `resource` (ie `attributes.parsed`) | The [field](../types/field.md) to which the value will be parsed. |
52
+
|`parse_to`| required. can be one of `body` or a nested field inside `body`, `attributes` or `resource` (ie `attributes.parsed`). When a header is used, `attributes` is also valid| The [field](../types/field.md) to which the value will be parsed. |
52
53
|`on_error`|`send`| The behavior of the operator if it encounters an error. See [on_error](../types/on_error.md). |
53
54
|`timestamp`|`nil`| An optional [timestamp](../types/timestamp.md) block which will parse a timestamp field before passing the entry to the output operator. |
54
55
|`severity`|`nil`| An optional [severity](../types/severity.md) block which will parse a severity field before passing the entry to the output operator. |
@@ -124,6 +125,46 @@ Configuration:
124
125
}
125
126
```
126
127
128
+
</td>
129
+
</tr>
130
+
</table>
131
+
132
+
#### Parse the field `body` with a json array parser and a header into attributes
0 commit comments