Skip to content

Observed timestamp in logs is not exported to clickhouse #34150

Closed as not planned
@pimeys

Description

@pimeys

Component(s)

exporter/clickhouse

What happened?

Description

Exporting logs from opentelemetry-rust stores zero timestamps to clickhouse.

Steps to Reproduce

  1. Send logs to opentelemetry-collector-contrib server from a Rust application using opentelemetry-rust
  2. Export to clickhouse
  3. Timestamps are zero

Expected Result

The exporter should look first the timestamp and if null take the value from the observed timestamp field.

Actual Result

The exporter only reads the timestamp field, blindly converts it to timestamp and stores a zero value to clickhouse.

https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/clickhouseexporter/exporter_logs.go#L93

Collector version

v0.105.0

Environment information

Environment

OS: The official collector docker image ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.105.0

OpenTelemetry Collector configuration

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317

processors:
  batch:
    send_batch_size: 100000
    timeout: 1s

exporters:
  clickhouse:
    endpoint: tcp://clickhouse:9000
    database: otel
    ttl: 48h
    timeout: 10s
    sending_queue:
      queue_size: 100
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
      max_elapsed_time: 300s

extensions:
  health_check:

service:
  extensions: [health_check]
  pipelines:
    metrics:
      receivers: [otlp]
      processors: [batch]
      exporters: [clickhouse]
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [clickhouse]
    logs:
      receivers: [otlp]
      processors: [batch]
      exporters: [clickhouse]

Log output

No response

Additional context

Should be a quick fix, I'm not a Go developer but planning to take a look :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions