-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[exporter/clickhouse] Incorrect ServiceName set for Logs Records #36349
Labels
Comments
Fiery-Fenix
added
bug
Something isn't working
needs triage
New item requiring triage
labels
Nov 13, 2024
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Removing triage label as this looks like a valid bug and has a bugfix PR linked |
shivanthzen
pushed a commit
to shivanthzen/opentelemetry-collector-contrib
that referenced
this issue
Dec 5, 2024
…pen-telemetry#36350) #### Description Fixing a bug in `clickhouseexporter` when ServiceName field in ClickHouse for `otel_logs` table is set from previous Log Record, when current LogRecord doesn't have `service.name` set #### Link to tracking issue Fixes open-telemetry#36349 #### Testing Respective unit test is added to code --------- Co-authored-by: Christos Markou <[email protected]> Co-authored-by: Alex Boten <[email protected]>
ZenoCC-Peng
pushed a commit
to ZenoCC-Peng/opentelemetry-collector-contrib
that referenced
this issue
Dec 6, 2024
…pen-telemetry#36350) #### Description Fixing a bug in `clickhouseexporter` when ServiceName field in ClickHouse for `otel_logs` table is set from previous Log Record, when current LogRecord doesn't have `service.name` set #### Link to tracking issue Fixes open-telemetry#36349 #### Testing Respective unit test is added to code --------- Co-authored-by: Christos Markou <[email protected]> Co-authored-by: Alex Boten <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Component(s)
exporter/clickhouse
What happened?
Description
In some corner cases, for Log Records
clickhouseexporter
inserts incorrect ServiceName valueFor example,
clickhouseexporter
receives 2 Log Records in this order:service.name
is equal tosomeservice
service.name
In this case - both records will be written to ClickHouse with
ServiceName = someservice
That is happened because of this line: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/clickhouseexporter/exporter_logs.go#L74
Variable
serviceName
defined outside of the loop and keep last value between loopsThis variable should be defined inside of the loop to keep data only for current Resource Log
Traces part is already have correct code - see https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/clickhouseexporter/exporter_traces.go#L78
Metrics part is also unaffected - for example see https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/clickhouseexporter/internal/gauge_metrics.go#L112
Steps to Reproduce
Feed to
clickhouseexporter
2 Log Records:service.name
is equal tosomeservice
service.name
Expected Result
Written data should have following values in
ServiceName
field ofotel_logs
table:Actual Result
Actual written data have following values in
ServiceName
field ofotel_logs
table:Collector version
v0.113.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: