log_to_metric in all_metrics mode dropping integer-valued metrics
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
When using all_metrics with log_to_metric, metric values (as well as histogram upper limits, etc.) are extracted using as_float(): https://github.com/vectordotdev/vector/blob/bb6a91404cdc3f662b037cc4d5f52237b28d215d/src/transforms/log_to_metric.rs#L513-L522
However, if the log data serialiser writes the value as an integer, the code fails and the event is dropped with this error:
ERROR transform{component_kind="transform" component_id=metrics component_type=log_to_metric}: vector::internal_events::log_to_metric: Failed to parse field as float. field=counter.value error_code="failed_parsing_FloatError" error_type="parser_failed" stage="processing" internal_log_rate_limit=true
If the same value is serialised with a trailing .0, it works.
Configuration
sources:
gen:
type: "demo_logs"
format: "shuffle"
decoding:
codec: "json"
lines:
- '{"counter":{"value":42},"kind":"incremental","name":"foo","tags":{}}' # "Failed to parse field as float."
- '{"counter":{"value":42.0},"kind":"incremental","name":"foo","tags":{}}' # OK
transforms:
metrics:
type: "log_to_metric"
inputs:
- "gen"
metrics: []
all_metrics: true
sinks:
console:
type: "console"
inputs:
- "metrics"
encoding:
codec: "json"
Version
vector 0.47.0 (aarch64-apple-darwin 3d5af22 2025-05-20 13:53:41.638057046)
Debug Output
Example Data
No response
Additional Context
No response
References
No response