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(config): allow usage of metrics-only decoders in log sources #21040

Conversation

jorgehermo9
Copy link
Contributor

@jorgehermo9 jorgehermo9 commented Aug 10, 2024

Closes #21039

Now this works:

Configuration

sources:
  file:
    type: exec
    command: ["cat", "test.txt"]
    decoding:
      codec: "influxdb"
    mode: streaming
    streaming:
      respawn_on_exit: false
sinks:
  console:
    type: console
    inputs: ["file"]
    encoding:
      codec: "native_json"

Input test.txt

weather,location=us-midwest temperature=82 1465839830100400200

Output

{"metric":{"name":"weather_temperature","tags":{"location":"us-midwest"},"timestamp":"+48420-08-12T18:35:00.400200Z","kind":"absolute","gauge":{"value":82.0}}}

Although, I would like to add some more tests, like for example, integration test for some source with an influxdb decoder config similar to the former. Where should I create those tests? Or isn't that needed?
It would be nice to have this kind of test so we verify that log sources with this codec can really output metrics to a metric sink and this feature doesn't get broken in a future.

@jorgehermo9 jorgehermo9 requested a review from a team as a code owner August 10, 2024 10:27
@github-actions github-actions bot added domain: topology Anything related to Vector's topology code domain: sources Anything related to the Vector's sources domain: core Anything related to core crates i.e. vector-core, core-common, etc labels Aug 10, 2024
@jorgehermo9 jorgehermo9 changed the title fix: allow usage of metrics-only decoder in log sources fix: allow usage of metrics-only decoders in log sources Aug 10, 2024
@jorgehermo9 jorgehermo9 changed the title fix: allow usage of metrics-only decoders in log sources fix(config): allow usage of metrics-only decoders in log sources Aug 10, 2024
@@ -673,4 +671,18 @@ mod test {
new_definition.assert_valid_for_event(&valid_event);
new_definition.assert_valid_for_event(&invalid_event);
}

#[test]
fn test_new_log_source_ignores_definition_with_metric_data_type() {
Copy link
Contributor Author

@jorgehermo9 jorgehermo9 Aug 10, 2024

Choose a reason for hiding this comment

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

Maybe these two tests naming could be improved, I'm open for suggestions on how to name them & test this behavior

Copy link
Member

Choose a reason for hiding this comment

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

I think these tests are good 👍

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 this contribution @jorgehermo9 ! And thanks for catching its lack before we officially released the influxdb codec as others would have likely ran into the panic.

@@ -673,4 +671,18 @@ mod test {
new_definition.assert_valid_for_event(&valid_event);
new_definition.assert_valid_for_event(&invalid_event);
}

#[test]
fn test_new_log_source_ignores_definition_with_metric_data_type() {
Copy link
Member

Choose a reason for hiding this comment

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

I think these tests are good 👍

@jszwedko jszwedko added this pull request to the merge queue Aug 12, 2024
Copy link

Regression Detector Results

Run ID: 4cbfd876-39cb-49c6-bbfe-7885409b43ad Metrics dashboard

Baseline: b9b98ff
Comparison: ee0168a

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 -12.63 [-18.97, -6.28]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
datadog_agent_remap_datadog_logs ingress throughput +1.24 [+1.02, +1.45]
otlp_http_to_blackhole ingress throughput +0.92 [+0.79, +1.05]
syslog_regex_logs2metric_ddmetrics ingress throughput +0.92 [+0.78, +1.06]
syslog_loki ingress throughput +0.82 [+0.71, +0.94]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput +0.55 [+0.46, +0.65]
http_text_to_http_json ingress throughput +0.23 [+0.09, +0.37]
http_to_http_noack ingress throughput +0.13 [+0.06, +0.21]
http_to_http_json ingress throughput +0.06 [+0.01, +0.12]
splunk_hec_indexer_ack_blackhole ingress throughput +0.01 [-0.07, +0.09]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.01 [-0.10, +0.11]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.00 [-0.13, +0.14]
datadog_agent_remap_blackhole ingress throughput -0.02 [-0.12, +0.09]
http_to_http_acks ingress throughput -0.05 [-1.35, +1.26]
syslog_log2metric_splunk_hec_metrics ingress throughput -0.09 [-0.20, +0.02]
otlp_grpc_to_blackhole ingress throughput -0.45 [-0.57, -0.34]
http_to_s3 ingress throughput -0.66 [-0.93, -0.39]
fluent_elasticsearch ingress throughput -0.73 [-1.22, -0.24]
syslog_splunk_hec_logs ingress throughput -0.90 [-1.13, -0.67]
syslog_humio_logs ingress throughput -0.97 [-1.07, -0.86]
syslog_log2metric_humio_metrics ingress throughput -1.13 [-1.28, -0.99]
datadog_agent_remap_datadog_logs_acks ingress throughput -1.17 [-1.39, -0.96]
socket_to_socket_blackhole ingress throughput -1.35 [-1.41, -1.30]
datadog_agent_remap_blackhole_acks ingress throughput -1.54 [-1.64, -1.43]
splunk_hec_route_s3 ingress throughput -2.56 [-2.88, -2.25]
http_elasticsearch ingress throughput -3.33 [-3.50, -3.15]
file_to_blackhole egress throughput -12.63 [-18.97, -6.28]

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 ee0168a Aug 12, 2024
80 checks passed
ym pushed a commit to ym/vector that referenced this pull request Aug 18, 2024
…tordotdev#21040)

* fix: allow usage of metrics-only decoder in log sources

* docs: Add changelog

* refactor(config): Refactor schema definition construction

* Update 21039_allow-usage-of-metrics-only-decoders.fix.md

* test(config): Add tests for SourceOutput::new_maybe_log

* test(config): Add tests for SourceOutput::new_maybe_log
AndrooTheChen pushed a commit to discord/vector that referenced this pull request Sep 23, 2024
…tordotdev#21040)

* fix: allow usage of metrics-only decoder in log sources

* docs: Add changelog

* refactor(config): Refactor schema definition construction

* Update 21039_allow-usage-of-metrics-only-decoders.fix.md

* test(config): Add tests for SourceOutput::new_maybe_log

* test(config): Add tests for SourceOutput::new_maybe_log
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: sources Anything related to the Vector's sources domain: topology Anything related to Vector's topology code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log-only sources can't output metrics with the influxdb decoder
2 participants