Skip to content

kafkareceiver and kafkaexporter encoding config does not support named extensions #40142

Closed
@axw

Description

@axw

Component(s)

exporter/kafka, receiver/kafka

What happened?

Description

The Kafka exporter and receiver support encoding configuration, which may identify an encoding extension. This currently only supports unnamed encoding extensions, e.g. "otlp_encoding", but not "otlp_encoding/json".

Steps to Reproduce

Run the collector with the attached config.

Expected Result

It should run.

Actual Result

The collector fails to start.

Collector version

7396e40

Environment information

Environment

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

OpenTelemetry Collector configuration

extensions:
  otlp_encoding/json:
    protocol: otlp_json

receivers:
  kafka:
    brokers: [localhost:9093]
    encoding: otlp_encoding/json
  kafkametrics:
    brokers: [localhost:9093]
    collection_interval: 10s
    scrapers: [topics, consumers]

exporters:
  debug:
    verbosity: detailed
  kafka:     
    brokers: [localhost:9093]
    encoding: otlp_encoding/json

service:
  extensions: [otlp_encoding/json]
  pipelines:
    metrics/kafka:
      receivers: [kafka]
      exporters: [debug]
    metrics:
      receivers: [kafkametrics]
      exporters: [kafka]

Log output

cd ./cmd/otelcontribcol && GO111MODULE=on go run --race . --config ../../local/config.yaml 
2025-05-20T11:51:19.234+0800    info    [email protected]/service.go:199   Setting up own telemetry...     {"resource": {}}
2025-05-20T11:51:19.235+0800    info    builders/builders.go:26 Development component. May change in the future.        {"resource": {}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "metrics"}
2025-05-20T11:51:19.238+0800    info    [email protected]/service.go:266   Starting otelcontribcol...      {"resource": {}, "Version": "0.126.0-dev", "NumCPU": 14}
2025-05-20T11:51:19.238+0800    info    extensions/extensions.go:41     Starting extensions...  {"resource": {}}
2025-05-20T11:51:19.238+0800    info    extensions/extensions.go:45     Extension is starting...        {"resource": {}, "otelcol.component.id": "otlp_encoding/json", "otelcol.component.kind": "extension"}
2025-05-20T11:51:19.238+0800    info    extensions/extensions.go:62     Extension started.      {"resource": {}, "otelcol.component.id": "otlp_encoding/json", "otelcol.component.kind": "extension"}
2025-05-20T11:51:19.238+0800    info    extensions/extensions.go:45     Extension is starting...        {"resource": {}, "otelcol.component.id": "otlp_encoding", "otelcol.component.kind": "extension"}
2025-05-20T11:51:19.238+0800    info    extensions/extensions.go:62     Extension started.      {"resource": {}, "otelcol.component.id": "otlp_encoding", "otelcol.component.kind": "extension"}
2025-05-20T11:51:19.240+0800    error   graph/graph.go:438      Failed to start component       {"resource": {}, "error": "unrecognized metrics encoding \"otlp_encoding/json\"", "type": "Receiver", "id": "kafka"}
2025-05-20T11:51:19.240+0800    info    [email protected]/service.go:331   Starting shutdown...    {"resource": {}}
2025-05-20T11:51:19.241+0800    info    extensions/extensions.go:69     Stopping extensions...  {"resource": {}}
2025-05-20T11:51:19.241+0800    info    [email protected]/service.go:345   Shutdown complete.      {"resource": {}}
Error: cannot start pipelines: failed to start "kafka" receiver: unrecognized metrics encoding "otlp_encoding/json"
2025/05/20 11:51:19 collector server run finished with error: cannot start pipelines: failed to start "kafka" receiver: unrecognized metrics encoding "otlp_encoding/json"
exit status 1
make: *** [Makefile:333: run] Error 1

Additional context

Related issue: #39809

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