-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[exporter/clickhouse] Nil pointer exception on Metrics without service.name Resource Attributes #37030
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
Labels
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
PR with fix: #37034 |
chengchuanpeng
pushed a commit
to chengchuanpeng/opentelemetry-collector-contrib
that referenced
this issue
Jan 26, 2025
…ort without service.name Resource Attribute (open-telemetry#37034) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Fixing Nil Pointer Exception regression introduced in open-telemetry#35725 <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#37030 <!--Describe what testing was performed and which tests were added.--> #### Testing Unit test adjusted to include test Metric without `service.name` Resource Attributes <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
zeck-ops
pushed a commit
to zeck-ops/opentelemetry-collector-contrib
that referenced
this issue
Apr 23, 2025
…ort without service.name Resource Attribute (open-telemetry#37034) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Fixing Nil Pointer Exception regression introduced in open-telemetry#35725 <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#37030 <!--Describe what testing was performed and which tests were added.--> #### Testing Unit test adjusted to include test Metric without `service.name` Resource Attributes <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Component(s)
exporter/clickhouse
What happened?
Description
This bug is a regression after #33634
In case of not set
service.name
Resource Attribute for Metric clickhouse exporter will throw next panic:This panic happens due to unsafe usage of
pcommon.Map.Get()
in next line:https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/clickhouseexporter/internal/gauge_metrics.go#L112
While documentation explicitly states that "Calling any functions on the returned invalid instance may cause a panic.". This panic happens on line https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/clickhouseexporter/internal/gauge_metrics.go#L125, where in case of absent
service.name
in Map we are trying to call<invalid instance>.AsString()
The bug is valid for all types of Metrics and also Traces, Logs are unaffected because they are using correct value check for some reason
Steps to Reproduce
Just try to export a Metric without
service.name
attribute usingclickhouse
exporterExpected Result
No panic
Actual Result
Panic
Collector version
0.116.0
Environment information
No response
OpenTelemetry Collector configuration
No response
Log output
Additional context
No response
The text was updated successfully, but these errors were encountered: