-
Notifications
You must be signed in to change notification settings - Fork 2k
chore(core): use latest VRL and update function signature #23221
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
98a6509
Update to_alternative_components function signature from VRL
thomasqueirozb 3f90f90
Merge remote-tracking branch 'origin/master' into update-vrl-to-alter…
thomasqueirozb 1a0919b
Simplify + add interval_ms to mut code path
thomasqueirozb bc788aa
Fix clippy warnings
thomasqueirozb 2822fab
cargo vdev build licenses
thomasqueirozb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -284,10 +284,7 @@ impl Target for VrlTarget { | |
| return Err(MetricPathError::SetPathError.to_string()); | ||
| } | ||
|
|
||
| if let Some(paths) = path | ||
| .to_alternative_components(MAX_METRIC_PATH_DEPTH) | ||
| .first() | ||
| { | ||
| if let Some(paths) = path.to_alternative_components(MAX_METRIC_PATH_DEPTH) { | ||
| match paths.as_slice() { | ||
| ["tags"] => { | ||
| let value = | ||
|
|
@@ -418,7 +415,6 @@ impl Target for VrlTarget { | |
| if let Some(paths) = target_path | ||
| .path | ||
| .to_alternative_components(MAX_METRIC_PATH_DEPTH) | ||
| .first() | ||
| { | ||
| let removed_value = match paths.as_slice() { | ||
| ["namespace"] => metric.series.name.namespace.take().map(Into::into), | ||
|
|
@@ -447,10 +443,10 @@ impl Target for VrlTarget { | |
|
|
||
| value.remove(&target_path.path, false); | ||
|
|
||
| return Ok(removed_value); | ||
| Ok(removed_value) | ||
| } else { | ||
| Ok(None) | ||
| } | ||
|
|
||
| Ok(None) | ||
| } | ||
| }, | ||
| PathPrefix::Metadata => Ok(self | ||
|
|
@@ -497,27 +493,25 @@ fn target_get_metric<'a>( | |
|
|
||
| let value = value.get(path); | ||
|
|
||
| for paths in path.to_alternative_components(MAX_METRIC_PATH_DEPTH) { | ||
| match paths.as_slice() { | ||
| ["name"] | ["kind"] | ["type"] | ["tags", _] => return Ok(value), | ||
| ["namespace"] | ["timestamp"] | ["interval_ms"] | ["tags"] => { | ||
| if let Some(value) = value { | ||
| return Ok(Some(value)); | ||
| } | ||
| } | ||
| _ => { | ||
| return Err(MetricPathError::InvalidPath { | ||
| path: &path.to_string(), | ||
| expected: VALID_METRIC_PATHS_GET, | ||
| } | ||
| .to_string()) | ||
| } | ||
| let Some(paths) = path.to_alternative_components(MAX_METRIC_PATH_DEPTH) else { | ||
| return Ok(None); | ||
| }; | ||
|
|
||
| match paths.as_slice() { | ||
| ["name"] | ||
| | ["kind"] | ||
| | ["type"] | ||
| | ["tags", _] | ||
| | ["namespace"] | ||
| | ["timestamp"] | ||
| | ["interval_ms"] | ||
| | ["tags"] => Ok(value), | ||
| _ => Err(MetricPathError::InvalidPath { | ||
| path: &path.to_string(), | ||
| expected: VALID_METRIC_PATHS_GET, | ||
| } | ||
| .to_string()), | ||
| } | ||
|
|
||
| // We only reach this point if we have requested a tag that doesn't exist or an empty | ||
| // field. | ||
| Ok(None) | ||
| } | ||
|
|
||
| fn target_get_mut_metric<'a>( | ||
|
|
@@ -530,27 +524,24 @@ fn target_get_mut_metric<'a>( | |
|
|
||
| let value = value.get_mut(path); | ||
|
|
||
| for paths in path.to_alternative_components(MAX_METRIC_PATH_DEPTH) { | ||
| match paths.as_slice() { | ||
| ["name"] | ["kind"] | ["tags", _] => return Ok(value), | ||
| ["namespace"] | ["timestamp"] | ["tags"] => { | ||
| if let Some(value) = value { | ||
| return Ok(Some(value)); | ||
| } | ||
| } | ||
| _ => { | ||
| return Err(MetricPathError::InvalidPath { | ||
| path: &path.to_string(), | ||
| expected: VALID_METRIC_PATHS_SET, | ||
| } | ||
| .to_string()) | ||
| } | ||
| let Some(paths) = path.to_alternative_components(MAX_METRIC_PATH_DEPTH) else { | ||
| return Ok(None); | ||
| }; | ||
|
|
||
| match paths.as_slice() { | ||
| ["name"] | ||
| | ["kind"] | ||
| | ["tags", _] | ||
| | ["namespace"] | ||
| | ["timestamp"] | ||
| | ["interval_ms"] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was missing, feature was working without this so not sure how critical it is |
||
| | ["tags"] => Ok(value), | ||
| _ => Err(MetricPathError::InvalidPath { | ||
| path: &path.to_string(), | ||
| expected: VALID_METRIC_PATHS_SET, | ||
| } | ||
| .to_string()), | ||
| } | ||
|
|
||
| // We only reach this point if we have requested a tag that doesn't exist or an empty | ||
| // field. | ||
| Ok(None) | ||
| } | ||
|
|
||
| /// pre-compute the `Value` structure of the metric. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before it'd return
vec![]on the effective None case and therefore the for loop would never run and would eventually returnOk(None);. This just makes it more explicit + the comment was very misleading