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(loki): serialize the structured metadata to JSON #21461

Conversation

maxboone
Copy link
Contributor

@maxboone maxboone commented Oct 9, 2024

fixes: #21443

Structured metadata wasn't added to the serializer implementation, which likely caused it not to be sent to Loki. I added the serialization.

Considering the Encoder<Vec<LokiRecord>> for LokiBatchEncoder is not unit tested anywhere, thus I tested it by trying to (JSON) serialize the event and see if the structured metadata is (correctly) in there.

@maxboone maxboone requested a review from a team as a code owner October 9, 2024 10:16
@maxboone maxboone marked this pull request as draft October 9, 2024 10:16
@github-actions github-actions bot added the domain: sinks Anything related to the Vector's sinks label Oct 9, 2024
@maxboone maxboone marked this pull request as ready for review October 9, 2024 15:20
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! Thank you @maxboone !

auto-merge was automatically disabled October 10, 2024 14:19

Head branch was pushed to by a user without write access

@jszwedko jszwedko added this pull request to the merge queue Oct 10, 2024
Copy link

Regression Detector Results

Run ID: dadd0a54-2ce2-4b87-ac9f-64af883392b1 Metrics dashboard

Baseline: e250dcb
Comparison: 4ba4d61

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

Significant changes in experiment optimization goals

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

perf experiment goal Δ mean % Δ mean % CI links
syslog_regex_logs2metric_ddmetrics ingress throughput -5.54 [-5.74, -5.34]
socket_to_socket_blackhole ingress throughput -7.48 [-7.55, -7.40]
otlp_http_to_blackhole ingress throughput -9.97 [-10.12, -9.83]

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 -4.28 [-10.99, +2.44]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
http_elasticsearch ingress throughput +1.92 [+1.75, +2.09]
datadog_agent_remap_blackhole ingress throughput +0.83 [+0.66, +1.01]
splunk_hec_route_s3 ingress throughput +0.82 [+0.52, +1.13]
datadog_agent_remap_datadog_logs ingress throughput +0.56 [+0.34, +0.77]
http_to_s3 ingress throughput +0.51 [+0.24, +0.79]
fluent_elasticsearch ingress throughput +0.35 [-0.16, +0.86]
http_to_http_acks ingress throughput +0.32 [-0.91, +1.55]
http_to_http_noack ingress throughput +0.16 [+0.08, +0.25]
http_to_http_json ingress throughput +0.02 [-0.02, +0.05]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.01 [-0.08, +0.11]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.01 [-0.10, +0.11]
splunk_hec_indexer_ack_blackhole ingress throughput +0.00 [-0.08, +0.09]
http_text_to_http_json ingress throughput -0.58 [-0.71, -0.45]
syslog_loki ingress throughput -0.68 [-0.74, -0.61]
datadog_agent_remap_datadog_logs_acks ingress throughput -0.80 [-1.03, -0.57]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput -0.89 [-1.01, -0.77]
otlp_grpc_to_blackhole ingress throughput -1.39 [-1.50, -1.28]
syslog_log2metric_humio_metrics ingress throughput -1.40 [-1.59, -1.22]
datadog_agent_remap_blackhole_acks ingress throughput -2.29 [-2.51, -2.06]
syslog_log2metric_splunk_hec_metrics ingress throughput -2.43 [-2.57, -2.28]
syslog_splunk_hec_logs ingress throughput -2.43 [-2.58, -2.29]
syslog_humio_logs ingress throughput -3.02 [-3.15, -2.88]
file_to_blackhole egress throughput -4.28 [-10.99, +2.44]
syslog_regex_logs2metric_ddmetrics ingress throughput -5.54 [-5.74, -5.34]
socket_to_socket_blackhole ingress throughput -7.48 [-7.55, -7.40]
otlp_http_to_blackhole ingress throughput -9.97 [-10.12, -9.83]

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-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 10, 2024
@jszwedko jszwedko added this pull request to the merge queue Oct 10, 2024
Copy link

Regression Detector Results

Run ID: f3cb2a9e-0c84-46e5-a780-4c5da82af27f Metrics dashboard

Baseline: b3dac6e
Comparison: c6d45a1

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

Significant changes in experiment optimization goals

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

perf experiment goal Δ mean % Δ mean % CI links
datadog_agent_remap_blackhole_acks ingress throughput +6.31 [+6.16, +6.47]
socket_to_socket_blackhole ingress throughput -10.53 [-10.59, -10.47]
otlp_http_to_blackhole ingress throughput -11.91 [-12.06, -11.76]

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 -3.79 [-10.70, +3.11]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
datadog_agent_remap_blackhole_acks ingress throughput +6.31 [+6.16, +6.47]
datadog_agent_remap_datadog_logs_acks ingress throughput +2.67 [+2.52, +2.83]
datadog_agent_remap_datadog_logs ingress throughput +2.48 [+2.28, +2.69]
syslog_regex_logs2metric_ddmetrics ingress throughput +1.53 [+1.38, +1.68]
fluent_elasticsearch ingress throughput +1.22 [+0.72, +1.72]
syslog_log2metric_humio_metrics ingress throughput +1.05 [+0.91, +1.19]
http_to_http_acks ingress throughput +0.59 [-0.64, +1.83]
http_to_s3 ingress throughput +0.49 [+0.22, +0.76]
splunk_hec_route_s3 ingress throughput +0.43 [+0.10, +0.77]
http_to_http_noack ingress throughput +0.12 [+0.05, +0.19]
http_to_http_json ingress throughput +0.04 [-0.01, +0.09]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.03 [-0.07, +0.12]
splunk_hec_indexer_ack_blackhole ingress throughput +0.02 [-0.07, +0.11]
splunk_hec_to_splunk_hec_logs_acks ingress throughput -0.01 [-0.09, +0.08]
syslog_log2metric_splunk_hec_metrics ingress throughput -1.90 [-2.03, -1.77]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput -2.01 [-2.12, -1.91]
otlp_grpc_to_blackhole ingress throughput -2.46 [-2.57, -2.34]
syslog_loki ingress throughput -2.53 [-2.62, -2.44]
http_text_to_http_json ingress throughput -2.53 [-2.72, -2.33]
datadog_agent_remap_blackhole ingress throughput -2.88 [-3.03, -2.73]
syslog_splunk_hec_logs ingress throughput -2.93 [-3.06, -2.80]
http_elasticsearch ingress throughput -3.13 [-3.31, -2.94]
syslog_humio_logs ingress throughput -3.28 [-3.44, -3.13]
file_to_blackhole egress throughput -3.79 [-10.70, +3.11]
socket_to_socket_blackhole ingress throughput -10.53 [-10.59, -10.47]
otlp_http_to_blackhole ingress throughput -11.91 [-12.06, -11.76]

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-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 11, 2024
@jszwedko jszwedko added this pull request to the merge queue Oct 11, 2024
github-merge-queue bot pushed a commit that referenced this pull request Oct 11, 2024
* feat(loki): serialize the structured metadata

* feat(loki): serialize structured_metadata in json

* feat(loki): properly serialize for the API

* docs(loki): add structured metadata json serialization to changelog

* style(cargo-fmt): run cargo fmt

---------

Co-authored-by: Max Boone <[email protected]>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 11, 2024
@jszwedko jszwedko added this pull request to the merge queue Oct 11, 2024
Copy link

Regression Detector Results

Run ID: 92cdced0-c2bb-4178-a799-50064aafeb14 Metrics dashboard

Baseline: 202da8b
Comparison: 0eb9efc

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

Significant changes in experiment optimization goals

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

perf experiment goal Δ mean % Δ mean % CI links
syslog_regex_logs2metric_ddmetrics ingress throughput +7.92 [+7.69, +8.15]

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.85 [-0.33, +14.03]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
syslog_regex_logs2metric_ddmetrics ingress throughput +7.92 [+7.69, +8.15]
file_to_blackhole egress throughput +6.85 [-0.33, +14.03]
syslog_log2metric_splunk_hec_metrics ingress throughput +4.67 [+4.48, +4.85]
http_text_to_http_json ingress throughput +2.37 [+2.06, +2.68]
datadog_agent_remap_datadog_logs ingress throughput +1.62 [+1.42, +1.83]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput +0.82 [+0.70, +0.93]
splunk_hec_route_s3 ingress throughput +0.72 [+0.42, +1.03]
syslog_log2metric_humio_metrics ingress throughput +0.72 [+0.49, +0.95]
http_to_s3 ingress throughput +0.40 [+0.13, +0.67]
datadog_agent_remap_blackhole_acks ingress throughput +0.37 [+0.27, +0.47]
http_to_http_noack ingress throughput +0.15 [+0.07, +0.23]
http_to_http_json ingress throughput +0.07 [+0.01, +0.14]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.01 [-0.09, +0.10]
splunk_hec_indexer_ack_blackhole ingress throughput -0.00 [-0.08, +0.08]
syslog_humio_logs ingress throughput -0.00 [-0.14, +0.13]
splunk_hec_to_splunk_hec_logs_acks ingress throughput -0.03 [-0.14, +0.09]
syslog_loki ingress throughput -0.04 [-0.15, +0.06]
http_elasticsearch ingress throughput -0.11 [-0.30, +0.08]
syslog_splunk_hec_logs ingress throughput -0.35 [-0.43, -0.27]
socket_to_socket_blackhole ingress throughput -0.59 [-0.64, -0.53]
otlp_grpc_to_blackhole ingress throughput -0.64 [-0.77, -0.52]
fluent_elasticsearch ingress throughput -0.78 [-1.26, -0.30]
datadog_agent_remap_blackhole ingress throughput -1.11 [-1.27, -0.96]
http_to_http_acks ingress throughput -1.63 [-2.84, -0.42]
datadog_agent_remap_datadog_logs_acks ingress throughput -1.69 [-1.87, -1.51]
otlp_http_to_blackhole ingress throughput -4.55 [-4.69, -4.41]

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 vectordotdev:master with commit 0eb9efc Oct 11, 2024
49 checks passed
@maxboone maxboone deleted the issue/21443/send-loki-structured-metadata-via-json branch October 11, 2024 22:47
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

loki structured metadata not sent unless using snappy compression
3 participants