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

Metric namespace in log_to_metric transform is mandatory #21423

Closed
jorgehermo9 opened this issue Oct 4, 2024 · 1 comment · Fixed by #21429
Closed

Metric namespace in log_to_metric transform is mandatory #21423

jorgehermo9 opened this issue Oct 4, 2024 · 1 comment · Fixed by #21429
Labels
transform: log_to_metric Anything `log_to_metric` transform related type: bug A code related bug.

Comments

@jorgehermo9
Copy link
Contributor

jorgehermo9 commented Oct 4, 2024

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

We were trying the newly introduced parse_influxdb vrl function, and as the docs states, we should pass its output to a log_to_metric transform to generate Vector metric events from it (contrary to the decoding.codec=influxdb, which outputs real metrics without the need of that transform)

We found that the parse_influxdb function does not output events with the namespace field
Example:

{"gauge":{"value":82.0},"kind":"absolute","name":"weather_temperature","tags":{"location":"us-midwest"},"timestamp":"2016-06-13T17:43:50.100400200Z"}

And although in Vector's metric model the namespace is optional

pub namespace: Option<String>,

It seems to be required by the log_to_metric transform

.with_namespace(try_get_string_from_log(log, "namespace")?)

Should the log_to_metric transform to optionally populate the namespace field, only if present, and not fail if the namespace field is not present?

I can submit a PR addressing it, just want to ask if this is a desired behaviour

Thanks

Configuration

[sources.sample]
type = "demo_logs"
lines = ["weather,location=us-midwest temperature=82 1465839830100400200"]
format = "shuffle"

[transforms.influx]
type = "remap"
inputs = ["sample"]
source = """
. = parse_influxdb!(.message)
"""

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

[sinks.console]
type = "console"
inputs = ["log_to_metric"]
encoding.codec = "json"

Version

vector 0.41.1 (x86_64-unknown-linux-gnu)

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response

@jorgehermo9 jorgehermo9 added the type: bug A code related bug. label Oct 4, 2024
@jszwedko
Copy link
Member

jszwedko commented Oct 4, 2024

Nice find @jorgehermo9 . namespace should, indeed, be optional. A PR would be more than welcome 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transform: log_to_metric Anything `log_to_metric` transform related type: bug A code related bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants