You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some corner cases, for Log Records clickhouseexporter inserts incorrect ServiceName value
For example, clickhouseexporter receives 2 Log Records in this order:
First record with Resource Attribute service.name is equal to someservice
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: