-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(log_to_metric transform): set not working in log-to-metric transf…
…orm when all_metrics=true (#20228) * Fixing bug - set missing in log-to-metric transform * Adding a test case * Adding unit test * Create 20228_fix-log-to-metric-set-supported.fix.md * Update 20228_fix-log-to-metric-set-supported.fix.md * Update changelog.d/20228_fix-log-to-metric-set-supported.fix.md Co-authored-by: Jesse Szwedko <[email protected]> * Update changelog.d/20228_fix-log-to-metric-set-supported.fix.md Co-authored-by: Jesse Szwedko <[email protected]> * cargo fmt Signed-off-by: Jesse Szwedko <[email protected]> --------- Signed-off-by: Jesse Szwedko <[email protected]> Co-authored-by: Jesse Szwedko <[email protected]> Co-authored-by: Jesse Szwedko <[email protected]>
- Loading branch information
1 parent
0550286
commit b634432
Showing
3 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Fixed an issue where the log_to_metric transform with all_metrics=true config failed to convert properly-formatted 'set'-type events into metrics. | ||
|
||
authors: pabloem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
[[tests]] | ||
name = "Test log_to_metric conversion of sets" | ||
|
||
# The inputs for the test | ||
[[tests.inputs]] | ||
insert_at = "parse_json" | ||
type = "log" | ||
|
||
[tests.inputs.log_fields] | ||
message = '{"name": "sample.set.metric", "tags": {"host": "my-host", "region": "us-west"}, "kind": "incremental", "values": [1, 2, 3, 4, 5]}' | ||
|
||
[[tests.outputs]] | ||
extract_from = "convert_metrics" | ||
|
||
# We just validate that the values are the same | ||
[[tests.outputs.conditions]] | ||
type = "vrl" | ||
source = ''' | ||
assert!(.name == "sample.set.metric") | ||
assert!(.tags.host == "my-host") | ||
assert!(.tags.region == "us-west") | ||
assert!(.kind == "incremental") | ||
''' | ||
|
||
[sources.stdin] | ||
type = "stdin" | ||
|
||
[sinks.stdout] | ||
inputs = ["convert_metrics"] | ||
type = "console" | ||
encoding.codec = "json" | ||
|
||
[transforms.parse_json] | ||
inputs = ["stdin"] | ||
type = "remap" | ||
source = ''' | ||
. = parse_json!(.message) | ||
''' | ||
|
||
[transforms.convert_metrics] | ||
inputs = ["parse_json"] | ||
type = "log_to_metric" | ||
all_metrics = true | ||
metrics = [] | ||
|