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(new_relic sink): Fix handling of dotted attribute names #21305

Merged
merged 5 commits into from
Sep 18, 2024

Conversation

bruceg
Copy link
Member

@bruceg bruceg commented Sep 17, 2024

This converts log event into a logs API model simply by transmuting the type
wrapper and dropping all arrays, which are not supported by the API. We could
flatten out the keys, as this is what New Relic does internally, and we used to
do that, but the flattening iterator accessed through
LogEvent::convert_to_fields adds quotes to dotted fields names, which produces
broken attributes in New Relic, and nesting objects is actually a (slightly)
more efficient representation of the key names.

This converts log event into a logs API model simply by transmuting the type
wrapper and dropping all arrays, which are not supported by the API. We could
flatten out the keys, as this is what New Relic does internally, and we used to
do that, but the flattening iterator accessed through
`LogEvent::convert_to_fields` adds quotes to dotted fields names, which produces
broken attributes in New Relic, and nesting objects is actually a (slightly)
more efficient representation of the key names.
@bruceg bruceg added type: bug A code related bug. sink: new_relic Anything `new_relic` sink related labels Sep 17, 2024
@bruceg bruceg requested a review from a team as a code owner September 17, 2024 18:54
@github-actions github-actions bot added the domain: sinks Anything related to the Vector's sinks label Sep 17, 2024
@datadog-vectordotdev
Copy link

Datadog Report

Branch report: bruceg/OPA-2327-fix-newrelic-dotted-attributes
Commit report: eb65599
Test service: vector

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

Copy link
Contributor

@neuronull neuronull left a comment

Choose a reason for hiding this comment

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

LGTM

// broken attributes in New Relic, and nesting objects is actually a (slightly) more
// efficient representation of the key names.
let (value, _metadata) = log.into_parts();
let Some(mut obj) = value.into_object() else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rustlang features too cool for GH syntax highlighting. GH can't handle the coolness

@bruceg bruceg added this pull request to the merge queue Sep 18, 2024
@bruceg
Copy link
Member Author

bruceg commented Sep 18, 2024

Note that this was tested against a real New Relic account to ensure proper operation.

Copy link

Regression Detector Results

Run ID: 1d5f6e79-97c7-4564-8cec-97f729e8e73d Metrics dashboard

Baseline: da1d02d
Comparison: b642efd

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 -1.95 [-9.00, +5.10]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
otlp_http_to_blackhole ingress throughput +2.37 [+2.23, +2.50]
syslog_log2metric_humio_metrics ingress throughput +1.92 [+1.82, +2.01]
datadog_agent_remap_datadog_logs_acks ingress throughput +1.58 [+1.38, +1.77]
socket_to_socket_blackhole ingress throughput +1.48 [+1.41, +1.56]
fluent_elasticsearch ingress throughput +0.98 [+0.49, +1.47]
syslog_regex_logs2metric_ddmetrics ingress throughput +0.93 [+0.81, +1.06]
datadog_agent_remap_blackhole_acks ingress throughput +0.61 [+0.43, +0.80]
syslog_splunk_hec_logs ingress throughput +0.61 [+0.51, +0.71]
syslog_loki ingress throughput +0.51 [+0.43, +0.60]
datadog_agent_remap_blackhole ingress throughput +0.47 [+0.38, +0.55]
http_to_http_noack ingress throughput +0.20 [+0.11, +0.30]
http_to_http_json ingress throughput +0.06 [+0.01, +0.11]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.01 [-0.08, +0.11]
splunk_hec_indexer_ack_blackhole ingress throughput +0.00 [-0.08, +0.08]
splunk_hec_to_splunk_hec_logs_acks ingress throughput -0.00 [-0.12, +0.12]
otlp_grpc_to_blackhole ingress throughput -0.23 [-0.34, -0.12]
http_to_s3 ingress throughput -0.39 [-0.67, -0.11]
http_to_http_acks ingress throughput -0.39 [-1.61, +0.82]
splunk_hec_route_s3 ingress throughput -0.77 [-1.07, -0.47]
http_text_to_http_json ingress throughput -0.77 [-0.90, -0.65]
syslog_humio_logs ingress throughput -0.81 [-0.91, -0.71]
datadog_agent_remap_datadog_logs ingress throughput -0.95 [-1.09, -0.81]
syslog_log2metric_splunk_hec_metrics ingress throughput -1.05 [-1.15, -0.95]
http_elasticsearch ingress throughput -1.08 [-1.25, -0.90]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput -1.43 [-1.52, -1.33]
file_to_blackhole egress throughput -1.95 [-9.00, +5.10]

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 b642efd Sep 18, 2024
72 checks passed
@bruceg bruceg deleted the bruceg/OPA-2327-fix-newrelic-dotted-attributes branch September 18, 2024 04:37
bruceg added a commit that referenced this pull request Sep 19, 2024
…ent API

This could not be accomplished the same way as #21305 since the event API cannot
handle nested JSON data. Instead, a new `LogEvent::convert_to_fields_unquoted`
method was added to produce the flattened data without quoting.
github-merge-queue bot pushed a commit that referenced this pull request Sep 19, 2024
…ent API (#21323)

* fix(new_relic sink): Do not quote paths containing periods for the event API

This could not be accomplished the same way as #21305 since the event API cannot
handle nested JSON data. Instead, a new `LogEvent::convert_to_fields_unquoted`
method was added to produce the flattened data without quoting.

* Fix and add tests

* Drop the extra parameter from `all_fields`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: sinks Anything related to the Vector's sinks sink: new_relic Anything `new_relic` sink related type: bug A code related bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants