vector icon indicating copy to clipboard operation
vector copied to clipboard

Kubernetes_logs. Add delimiters for different OS in path_helper. Issue#18521

Open tmb-piXel opened this issue 1 year ago • 6 comments
trafficstars

tmb-piXel avatar Feb 05 '24 18:02 tmb-piXel

CLA assistant check
All committers have signed the CLA.

bits-bot avatar Feb 05 '24 18:02 bits-bot

Regression Detector Results

Run ID: 39505e97-d21a-47a7-aa9b-c3199f8650e9 Baseline: a7fe0dbfbd41197bb09fb6a8f2d8562a22384c99 Comparison: 09fab9beab0c4828a36041d5dc7f3ca17b45f5df Total CPUs: 7

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.

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
http_to_http_acks ingress throughput +1.20 [-0.13, +2.52]
http_elasticsearch ingress throughput +1.00 [+0.93, +1.07]
syslog_splunk_hec_logs ingress throughput +0.78 [+0.72, +0.83]
datadog_agent_remap_datadog_logs_acks ingress throughput +0.57 [+0.48, +0.65]
splunk_hec_route_s3 ingress throughput +0.45 [-0.04, +0.95]
syslog_log2metric_humio_metrics ingress throughput +0.40 [+0.30, +0.50]
datadog_agent_remap_datadog_logs ingress throughput +0.25 [+0.16, +0.33]
http_to_s3 ingress throughput +0.11 [-0.17, +0.39]
http_to_http_json ingress throughput +0.07 [-0.01, +0.15]
http_to_http_noack ingress throughput +0.04 [-0.04, +0.13]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.00 [-0.16, +0.16]
splunk_hec_indexer_ack_blackhole ingress throughput -0.00 [-0.14, +0.14]
otlp_grpc_to_blackhole ingress throughput -0.03 [-0.11, +0.06]
splunk_hec_to_splunk_hec_logs_noack ingress throughput -0.03 [-0.14, +0.09]
otlp_http_to_blackhole ingress throughput -0.07 [-0.21, +0.06]
enterprise_http_to_http ingress throughput -0.08 [-0.17, -0.00]
fluent_elasticsearch ingress throughput -0.24 [-0.71, +0.23]
datadog_agent_remap_blackhole ingress throughput -0.29 [-0.39, -0.20]
syslog_loki ingress throughput -0.41 [-0.46, -0.36]
syslog_log2metric_splunk_hec_metrics ingress throughput -0.43 [-0.57, -0.29]
socket_to_socket_blackhole ingress throughput -0.62 [-0.69, -0.55]
http_text_to_http_json ingress throughput -0.67 [-0.80, -0.53]
syslog_regex_logs2metric_ddmetrics ingress throughput -0.69 [-0.84, -0.54]
datadog_agent_remap_blackhole_acks ingress throughput -0.86 [-0.95, -0.77]
syslog_humio_logs ingress throughput -0.96 [-1.05, -0.88]
file_to_blackhole egress throughput -1.02 [-3.49, +1.44]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput -2.16 [-2.29, -2.02]

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".

github-actions[bot] avatar Feb 15 '24 22:02 github-actions[bot]

This change caused a test failure on Windows:

https://github.com/vectordotdev/vector/blob/a7fe0dbfbd41197bb09fb6a8f2d8562a22384c99/src/sources/kubernetes_logs/pod_metadata_annotator.rs#L753-L784

This appears to be because the test is using unix-style path delimiters. I think it needs to be updated to use https://doc.rust-lang.org/std/path/struct.Path.html#method.join.

jszwedko avatar Feb 15 '24 23:02 jszwedko

I can add the following code to the test `

fn test_annotate_from_file_info() {
    let path;
    let path_linux = String::from("/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/sandbox0-container0-name/1.log");
    let path_windows = String::from("/var\\log\\pods\\sandbox0-ns_sandbox0-name_sandbox0-uid\\sandbox0-container0-name\\1.log");

    let os = std::env::consts::OS;

    if os == "windows" {
        path = path_windows;
    } else {
        path = path_linux;
    }

    let cases = vec![(
        FieldsSpec::default(),
        path,
        {
            let mut log = LogEvent::default();
            log.insert(event_path!("kubernetes", "container_name"), "sandbox0-container0-name");
            log
        },
        LogNamespace::Legacy,
    ),(
        FieldsSpec{
            container_name: OwnedTargetPath::event(owned_value_path!("container_name")).into(),
            ..Default::default()
        },
        path,
        {
            let mut log = LogEvent::default();
            log.insert(event_path!("container_name"), "sandbox0-container0-name");
            log
        },
        LogNamespace::Legacy,
    )];

    for (fields_spec, file, expected, log_namespace) in cases.into_iter() {
        let mut log = LogEvent::default();
        let file_info = parse_log_file_path(file).unwrap();
        annotate_from_file_info(&mut log, &fields_spec, &file_info, log_namespace);
        assert_eq!(log, expected);
    }
}`

tmb-piXel avatar Feb 16 '24 10:02 tmb-piXel

@tmb-piXel I'd suggest just doing something like:

let path = ["var", "log", (etc)].iter().collect::<PathBuf>()

that way it'll create the right path for the platform the test is running on rather than you needing to have a conditional in the test file depending on platform. Does that make sense?

jszwedko avatar Feb 16 '24 14:02 jszwedko