open-telemetry / opentelemetry-collector-contrib

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

How to use loadbalancingexporter? #17267

Closed Liubey closed 1 year ago

Liubey commented 1 year ago

Component(s)

No response

What happened?

Description

Can I recieve Jaeger thrift_compact(port 6381) and load balance them to another collector such as: Jaeger client(opentracing) --> collector 1 recieve with jaeger+thrift_compact and exporter is loadbalancing --> collector 2 with receiver is otlp Then I got spans in collector1 such as:

2022-12-27T13:59:43.238Z    info    TracesExporter  {"kind": "exporter", "data_type": "traces", "name": "logging", "#spans": 10}

But I got nothing in collector2.

I have some questions for that(sorry for that):

  1. Does I need use docker image of opentelemetry-collector or otel/opentelemetry-collector-contrib?
  2. How can use loadbalancingexporter for opentelemetry-collector? I got "* error decoding 'exporters': unknown type: "loadbalancing" for id: "loadbalancing" (valid values: [logging prometheus zipkin jaeger kafka opencensus prometheusremotewrite otlp otlphttp file])"
  3. Is the loadbalancingexporter just recieve oltp protocol?What can I do?

Thank you so much.

collector 1 config

receivers:
  jaeger/loadbalancer:
    protocols:
      thrift_compact:
        endpoint: localhost:6831

processors:

exporters:
  logging:
    loglevel: debug
  loadbalancing:
    protocol:
      otlp:
        timeout: 1s
        insecure: true
    resolver:
      static:
        hostnames:
          - localhost:4567

service:
  pipelines:
    traces:
      receivers:
        - jaeger/loadbalancer
      processors: []
      exporters:
        - loadbalancing
        - logging

collector 2 config:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: localhost:4567
processors:
 batch:
   timeout: 1s
 resource:
   attributes:
     - key: test.key
       value: "test-value"
       action: insert
exporters:
 logging:
   loglevel: info
 otlp:
   endpoint: localhost:4317
   tls:
    insecure: true
extensions:
 health_check:
 pprof:
   endpoint: :1888
 zpages:
   endpoint: :55679
service:
 extensions: [pprof, zpages, health_check]
 pipelines:
   traces:
     receivers: [otlp]
     processors: [batch, resource]
     exporters: [logging, otlp]

Steps to Reproduce

Expected Result

Actual Result

Collector version

0.68.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

Liubey commented 1 year ago

Maybe I use the wrong config path of collector-contirb. Now It's ok. But I still confusing about "loadbalancingexport can load balance open-tracing's trace?" If It's true, may by this feature can write to Readme to get everyone know it?

frzifus commented 1 year ago

Hi @Liubey

  1. Does I need use docker image of opentelemetry-collector or otel/opentelemetry-collector-contrib?

Yes, you need to use contrib or build your own distro.

See: https://github.com/open-telemetry/opentelemetry-collector-contrib/discussions/6971#discussioncomment-1878280 and https://opentelemetry.io/docs/concepts/distributions/

  1. How can use loadbalancingexporter for opentelemetry-collector? I got "* error decoding 'exporters': unknown type: "loadbalancing" for id: "loadbalancing" (valid values: [logging prometheus zipkin jaeger kafka opencensus prometheusremotewrite otlp otlphttp file])"

There is no way. Since loadbalancingexporter is not part of the core distro.

  1. Is the loadbalancingexporter just recieve oltp protocol?What can I do?

The loadbalancingexporter does only export data. But the opentelemetry collector allows you to receive protocol x and export y. To me it seems the loadbalancingexporter exports everything in the otlp format. See: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/c92de9b66369b069ea05d929e155f6d23b73bb98/exporter/loadbalancingexporter/README.md#configuration

github-actions[bot] commented 1 year ago

Pinging code owners for exporter/loadbalancing: @jpkrohling. See Adding Labels via Comments if you do not have permissions to add labels yourself.

Liubey commented 1 year ago

@frzifus Thanks a lot. I can understand what you say!