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): surround invalid path segments with quotes #21201

Merged
merged 6 commits into from
Sep 4, 2024

Conversation

pront
Copy link
Contributor

@pront pront commented Sep 3, 2024

Closes: #21165

Related PR: #21067.

Summary

  • Path segments which contain special characters need to be quoted.
  • The fields iterator used to only escape the . character. Now it detects if a path segment needs to be quoted.
  • This is a more generic fix compared to the ad-hoc quote_invalid_paths function. A side benefit, it that this PR paves the way for Refactor field iterators to return OwnedTargetPaths #21077.

Testing

Added/enhanced unit tests.

Vector Unit Test

transforms:
  reduce_scalyr:
    type: reduce
    inputs:
    - my_input
    group_by:
    - session
    expire_after_ms: 2000
    max_events: 500
    merge_strategies:
      events: array
tests:
- name: map_reduce_scalyr.no_sev
  inputs:
  - type: vrl
    insert_at: reduce_scalyr
    source: |
      . = {
        "events": {
          "attrs": {
            "msg": "foo"
          },
          "sev": 3,
          "ts": "1602349656452332000"
        },
        "session": "session",
        "sessionInfo": {
          "kubernetes.cluster": "cluster",
          "kubernetes.container-name": "container",
          "kubernetes.namespace.name": "namespace",
          "kubernetes.pod.name": "pod",
          "logfile": "p",
          "serverHost": "n"
        },
        "token": "token"
      }
  - type: vrl
    insert_at: reduce_scalyr
    source: |
      . = {
        "events": {
          "attrs": {
            "msg": "bar"
          },
          "sev": 3,
          "ts": "1602349656460000000"
        },
        "session": "session",
        "sessionInfo": {
          "kubernetes.cluster": "cluster",
          "kubernetes.container-name": "container",
          "kubernetes.namespace.name": "namespace",
          "kubernetes.pod.name": "pod",
          "logfile": "p",
          "serverHost": "n"
        },
        "token": "token"
      }
  outputs:
  - extract_from: reduce_scalyr
    conditions:
    - type: vrl
      source: |
        assert_eq!(., {
          "events": [
            {
              "ts": "1602349656452332000",
              "sev": 3,
              "attrs": {
                "msg": "foo",
              },
            },
            {
              "ts": "1602349656460000000",
              "sev": 3,
              "attrs": {
                "msg": "bar",
              },
            },
          ],
          "session": "session",
          "sessionInfo": {
            "kubernetes.cluster": "cluster",
            "kubernetes.container-name": "container",
            "kubernetes.namespace.name": "namespace",
            "kubernetes.pod.name": "pod",
            "logfile": "p",
            "serverHost": "n"
          },
          "token": "token",
        })

@github-actions github-actions bot added domain: transforms Anything related to Vector's transform components domain: core Anything related to core crates i.e. vector-core, core-common, etc labels Sep 3, 2024
@pront pront marked this pull request as ready for review September 3, 2024 20:34
@pront pront requested a review from a team as a code owner September 3, 2024 20:34
@datadog-vectordotdev
Copy link

datadog-vectordotdev bot commented Sep 3, 2024

Datadog Report

Branch report: pront/i21165
Commit report: 1fe6e1b
Test service: vector

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

@jszwedko jszwedko changed the title fix(FieldsIter): surround invalid path segments with quotes fix(reduce transform): surround invalid path segments with quotes Sep 3, 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.

Awesome! This is definitely cleaner 👍 I tested it locally and it seems to work. I appreciate the additional tests here too.

changelog.d/21201_fields_iter.fix.md Outdated Show resolved Hide resolved
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.

🎉

@jszwedko jszwedko added this to the Vector v0.40.2 milestone Sep 3, 2024
@pront pront enabled auto-merge September 3, 2024 22:46
@pront pront added this pull request to the merge queue Sep 3, 2024
Copy link

github-actions bot commented Sep 4, 2024

Regression Detector Results

Run ID: fcdf8565-c858-4041-acfc-860b915dcee6 Metrics dashboard

Baseline: d174d55
Comparison: f2155f1

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 -6.28 [-13.20, +0.64]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput +1.97 [+1.87, +2.08]
syslog_log2metric_splunk_hec_metrics ingress throughput +1.73 [+1.62, +1.85]
datadog_agent_remap_datadog_logs_acks ingress throughput +1.07 [+0.94, +1.20]
syslog_loki ingress throughput +0.63 [+0.56, +0.70]
syslog_splunk_hec_logs ingress throughput +0.53 [+0.44, +0.62]
http_text_to_http_json ingress throughput +0.49 [+0.36, +0.62]
http_to_http_noack ingress throughput +0.16 [+0.08, +0.24]
http_to_s3 ingress throughput +0.16 [-0.11, +0.43]
http_elasticsearch ingress throughput +0.11 [-0.07, +0.29]
http_to_http_json ingress throughput +0.03 [-0.01, +0.06]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.01 [-0.08, +0.11]
otlp_grpc_to_blackhole ingress throughput -0.01 [-0.12, +0.10]
splunk_hec_to_splunk_hec_logs_noack ingress throughput -0.01 [-0.11, +0.08]
splunk_hec_indexer_ack_blackhole ingress throughput -0.01 [-0.09, +0.06]
splunk_hec_route_s3 ingress throughput -0.08 [-0.40, +0.24]
datadog_agent_remap_datadog_logs ingress throughput -0.11 [-0.28, +0.06]
http_to_http_acks ingress throughput -0.23 [-1.50, +1.04]
syslog_regex_logs2metric_ddmetrics ingress throughput -0.29 [-0.40, -0.18]
fluent_elasticsearch ingress throughput -0.33 [-0.82, +0.16]
datadog_agent_remap_blackhole ingress throughput -0.82 [-0.92, -0.71]
syslog_humio_logs ingress throughput -1.36 [-1.48, -1.24]
datadog_agent_remap_blackhole_acks ingress throughput -2.15 [-2.26, -2.04]
otlp_http_to_blackhole ingress throughput -3.05 [-3.18, -2.93]
socket_to_socket_blackhole ingress throughput -3.23 [-3.30, -3.16]
syslog_log2metric_humio_metrics ingress throughput -4.15 [-4.27, -4.03]
file_to_blackhole egress throughput -6.28 [-13.20, +0.64]

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 f2155f1 Sep 4, 2024
80 checks passed
@pront pront deleted the pront/i21165 branch September 4, 2024 00:33
jszwedko added a commit that referenced this pull request Sep 6, 2024
…1201)

* fix(FieldsIter): surround invalid path segments with quotes

* changelog

* fix changelog typos

* Update changelog.d/21201_fields_iter.fix.md

Co-authored-by: Jesse Szwedko <[email protected]>

* update test

* fix changelog message, I believe we didn't panic before

---------

Co-authored-by: Jesse Szwedko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: core Anything related to core crates i.e. vector-core, core-common, etc domain: transforms Anything related to Vector's transform components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v0.40.1 regression in reduce transform is not handling nested keys with dashes
2 participants