open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.88k stars 2.25k forks source link

Otel exporter not working with Elasticsearch #34129

Open harshalschaudhari opened 1 month ago

harshalschaudhari commented 1 month ago

Component(s)

exporter/elasticsearch

What happened?

Description

The application generates traces that can be viewed in Jaeger. I attempted to configure the Otel collector to send these traces to Elasticsearch using various combinations within a Docker Compose setup, but encountered the following error:

"Error decoding 'exporters': Unknown type 'elasticsearch' for ID 'elasticsearch/trace' (valid values: [zipkin nop file opencensus prometheus prometheusremotewrite debug logging otlp otlphttp kafka])."

Steps to Reproduce

I have a Docker Compose application set up with Jaeger, Elasticsearch, and an OtelCollector. I've confirmed that all processes are functioning correctly except for the OtelCollector.

Below is the OtelCollector configuration I've used:

`receivers: otlp: protocols: grpc: http:

processors: batch:

exporters:
elasticsearch/trace: endpoints:

service: pipelines: traces: receivers: [otlp] processors: [batch] exporters: [elasticsearch/trace]`

Expected Result

Elasticsearch index shows the traces in respective index.

Actual Result

Otel Collector Container stopped due to error "Error decoding 'exporters': Unknown type 'elasticsearch' for ID 'elasticsearch/trace' (valid values: [zipkin nop file opencensus prometheus prometheusremotewrite debug logging otlp otlphttp kafka])."

Collector version

0.104.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04") Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

receivers:
  otlp:
    protocols:
      grpc:
      http:

processors:
  batch:

exporters:  
  elasticsearch/trace:
    endpoints:
      - "http://elasticsearch:9200/"  # Elasticsearch service URL
    trace_index: "otel-traces"   # Index for traces

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [elasticsearch/trace]

Log output

No response

Additional context

No response

github-actions[bot] commented 1 month ago

Pinging code owners:

crobert-1 commented 1 month ago

You need to reference the contrib docker image in your docker-compose.yaml file. Currently, it looks like it's referencing the core distribution, which only has a subset of exporters (and components in general). This will be the docker image to reference.