Skip to content

log_to_metric: Histogram and summary metrics are converted incorrectly #24393

@jblazquez

Description

@jblazquez

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

The log_to_metric transform handles metrics with a value type of MetricValue::AggregatedHistogram or MetricValue::AggregatedSummary incorrectly, because it looks for the wrong keys in the log event when converting the log back to a metric. It's looking for the histogram and summary keys, but the keys are actually named aggregated_histogram and aggregated_summary, as per the log schema and based on how serde_json encodes the MetricValue enum in metric_to_log.

This causes any use of a log_to_metric transform with histogram or summary metrics to fail with this error:

vector::internal_events::log_to_metric: Missing required metric details. Required one of gauge, distribution, histogram, summary, counter error_code="missing_metric_details" error_type="parser_failed" stage="processing"

Configuration

[sources.opentelemetry]
type = "opentelemetry"
grpc.address = "0.0.0.0:4317"
http.address = "0.0.0.0:4318"

[transforms.my_metric_to_log]
type = "metric_to_log"
inputs = ["opentelemetry.metrics"]

[transforms.my_log_to_metric]
type = "log_to_metric"
inputs = [ "my_metric_to_log" ]
all_metrics = true
metrics = []

Version

0.53.0

Debug Output

vector::internal_events::log_to_metric: Missing required metric details. Required one of gauge, distribution, histogram, summary, counter error_code="missing_metric_details" error_type="parser_failed" stage="processing"

Example Data

No response

Additional Context

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA code related bug.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions