Skip to content
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

fix(reduce transform): use the correct merge strategy for top level objects #21067

Merged
merged 11 commits into from
Aug 16, 2024

Conversation

pront
Copy link
Contributor

@pront pront commented Aug 13, 2024

closes: #21065

This fix addresses a regression introduced by PR #20800.

The add_event function was modified to workaround the fact that the event iterator returns paths in a DFS fashion (and also it doesn't return the top level field).

As a workaround:

  • it now iterates over the configured strategies and instantiates the proper value merger
  • if a path is covered by the above, then it is ignored (no value merger)

Another alternative considered here is a BFS event path traversal but that seemed like a more time consuming change. Also, arguably, the event iterators should return a OwnedTargetPath instead of a KeyString.

@github-actions github-actions bot added the domain: transforms Anything related to Vector's transform components label Aug 13, 2024
@pront pront marked this pull request as ready for review August 13, 2024 19:49
@pront pront requested a review from a team as a code owner August 13, 2024 19:49
@pront pront marked this pull request as draft August 13, 2024 19:51
@datadog-vectordotdev
Copy link

datadog-vectordotdev bot commented Aug 13, 2024

Datadog Report

Branch report: pront/21065-fix
Commit report: 338d684
Test service: vector

✅ 0 Failed, 7 Passed, 0 Skipped, 25.49s Total Time

@pront pront marked this pull request as ready for review August 13, 2024 20:15
@pront pront requested a review from jszwedko August 13, 2024 20:15
@jszwedko jszwedko added this to the Vector v0.40.1 milestone Aug 14, 2024
@jszwedko
Copy link
Member

It looks like this fails to run the example test case in #21065 still. I see:

2024-08-14T20:05:32.608574Z ERROR transform{component_kind="transform" component_id=reduce_scalyr component_type=reduce}: vector::transforms::reduce::transform: error=Invalid field path "sessionInfo.kubernetes\\.cluster" rate_limit=30
2024-08-14T20:05:32.608732Z ERROR transform{component_kind="transform" component_id=reduce_scalyr component_type=reduce}: vector::transforms::reduce::transform: error=Invalid field path "sessionInfo.kubernetes\\.cluster" rate_limit=30
test map_reduce_scalyr.no_sev ... failed

@jszwedko jszwedko changed the title fix(issue 21065): use the correct merge strategy for top level objects fix(reduce transform): use the correct merge strategy for top level objects Aug 14, 2024
Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

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

The general approach here seems sound to me. Just a couple of comments and what seems like an issue with path parsing 🤔

src/transforms/reduce/transform.rs Outdated Show resolved Hide resolved
src/transforms/reduce/transform.rs Show resolved Hide resolved
Comment on lines +62 to +80
for (path, strategy) in strategies {
if let Some(value) = e.get(path) {
match self.fields.entry(path.clone()) {
Entry::Vacant(entry) => match get_value_merger(value.clone(), strategy) {
Ok(m) => {
entry.insert(m);
}
Err(error) => {
warn!(message = "Failed to create value merger.", %error, %path);
}
},
Entry::Occupied(mut entry) => {
if let Err(error) = entry.get_mut().add(value.clone()) {
warn!(message = "Failed to merge value.", %error);
}
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I see the warnings here follow the existing pattern for get_value_merger failures, but I am wondering if these shouldn't be emitting events that have metrics too 🤔

I'm ok leaving this for a follow-up since it doesn't seem to make the situation worse.

@pront pront requested a review from jszwedko August 16, 2024 18:06
Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

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

Nice! I verified that the example from the bug report passes now.

src/transforms/reduce/transform.rs Outdated Show resolved Hide resolved
src/internal_events/reduce.rs Outdated Show resolved Hide resolved
src/internal_events/reduce.rs Show resolved Hide resolved
src/transforms/reduce/transform.rs Outdated Show resolved Hide resolved
@pront pront requested a review from jszwedko August 16, 2024 19:13
Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the final points!

@pront pront added this pull request to the merge queue Aug 16, 2024
Copy link

Regression Detector Results

Run ID: 47059084-5343-43f9-b92e-4b789f7b2a1c Metrics dashboard

Baseline: ac4e194
Comparison: f7e4470

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

No significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI links
file_to_blackhole egress throughput -16.84 [-23.14, -10.54]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
datadog_agent_remap_datadog_logs ingress throughput +3.17 [+2.99, +3.35]
syslog_regex_logs2metric_ddmetrics ingress throughput +2.14 [+1.95, +2.33]
datadog_agent_remap_datadog_logs_acks ingress throughput +1.80 [+1.59, +2.00]
syslog_humio_logs ingress throughput +1.45 [+1.34, +1.55]
syslog_splunk_hec_logs ingress throughput +1.42 [+1.33, +1.51]
syslog_log2metric_splunk_hec_metrics ingress throughput +1.40 [+1.28, +1.52]
http_elasticsearch ingress throughput +1.13 [+0.97, +1.30]
fluent_elasticsearch ingress throughput +1.01 [+0.51, +1.51]
otlp_http_to_blackhole ingress throughput +0.89 [+0.76, +1.02]
syslog_loki ingress throughput +0.77 [+0.63, +0.90]
datadog_agent_remap_blackhole_acks ingress throughput +0.74 [+0.63, +0.86]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput +0.59 [+0.50, +0.67]
http_to_http_noack ingress throughput +0.18 [+0.09, +0.27]
http_to_s3 ingress throughput +0.14 [-0.12, +0.41]
splunk_hec_route_s3 ingress throughput +0.10 [-0.21, +0.42]
http_to_http_json ingress throughput +0.09 [+0.03, +0.15]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.03 [-0.07, +0.13]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.00 [-0.11, +0.12]
splunk_hec_indexer_ack_blackhole ingress throughput -0.00 [-0.08, +0.08]
datadog_agent_remap_blackhole ingress throughput -0.05 [-0.17, +0.07]
otlp_grpc_to_blackhole ingress throughput -0.06 [-0.18, +0.05]
http_to_http_acks ingress throughput -0.11 [-1.43, +1.20]
syslog_log2metric_humio_metrics ingress throughput -0.83 [-0.96, -0.70]
http_text_to_http_json ingress throughput -0.96 [-1.10, -0.83]
socket_to_socket_blackhole ingress throughput -1.51 [-1.57, -1.46]
file_to_blackhole egress throughput -16.84 [-23.14, -10.54]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

Merged via the queue into master with commit f7e4470 Aug 16, 2024
81 checks passed
@pront pront deleted the pront/21065-fix branch August 16, 2024 20:43
jszwedko pushed a commit that referenced this pull request Aug 23, 2024
…bjects (#21067)

* fix(issue 21065): use the correct merge strategy for top level objects

* changelog

* revert config changes to preserve backwards compatibility

* enhance test case

* update test with another merge strategy, note we cannot handle strategies for both 'a' and 'a.b'

* tweak changelog text

* workaround for issue 21077

* add nested path to the test case

* Address review points

* add dot to message

* more review points
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: transforms Anything related to Vector's transform components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reduce transform v0.40.0 regression with reducing structured fields
2 participants