Skip to content

Fix warning on nil tag #235

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cleroymira-unabiz
Copy link

Hi,

This aims at fixing warning we see in logs:

{"time":"2025-06-23","level":"warn","message":"send an error event stream to @ERROR: error_class=NoMethodError error=\"undefined method `split' for nil:NilClass\\n\\n          tags = tag.split('.')\\n                    ^^^^^^\" location=\"/fluentd/vendor/bundle/ruby/3.1.0/gems/fluent-plugin-prometheus-2.1.0/lib/fluent/plugin/prometheus/placeholder_expander.rb:42:in `build_tag'\" tag=nil","worker_id":0

I hope it is not too naive.

Thanks!

Signed-off-by: Colin Leroy-Mira <[email protected]>
@Watson1978
Copy link
Contributor

Can you add test cases?

@daipom
Copy link

daipom commented Jun 30, 2025

Thanks!
It appears that it is usually impossible for tag to be nil.
Can you please provide a simple way to reproduce that error?

@cleroymira-unabiz
Copy link
Author

Hi,

Thanks! It appears that it is usually impossible for tag to be nil. Can you please provide a simple way to reproduce that error?

It comes from a misconfiguration: we forgot "key" in a

<filter message>
  @type prometheus
  <metric>
    name message_foo_counter
    type counter
    desc The total number of foo in message.
    #key foo
  </metric>
</filter>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants