skip to Main Content

What I was trying to achieve:
For my testing on trace processor I wanted to run the Opentelemetry provided demo app along with the collector as a docker container.
Also I wanted the OTEL collector to send data to pulsar topic: otlp_traces
Then using a pulsar consumer I could see the trace data on the topic.

What I did:
Ran Opentelemetry demo application along with collector using link: [https://opentelemetry.io/docs/demo/docker-deployment/]

Ran pulsar locally using the link: Pulsar deployment

Challenge I faced:
In the collector logs I could see the below error:

2024-07-16 17:20:41 time="2024-07-16T11:50:41Z" level=info msg="[Connecting to broker]" remote_addr="pulsar://localhost:6650"
2024-07-16 17:20:46 time="2024-07-16T11:50:46Z" level=warning msg="[Failed to connect to broker.]" error="dial tcp localhost:6650: i/o timeout" remote_addr="pulsar://localhost:6650"
2024-07-16 17:20:47 time="2024-07-16T11:50:47Z" level=info msg="Removed connection from pool key=localhost:665045 0 logical_addr=pulsar://localhost:6650 physical_addr=pulsar://localhost:6650

I tried logging inside the docker container and running the below command to verify if I am able to connect to pulsar and it worked. Command: ./bin/pulsar-client consume persistent://public/default/otlp_spans --subscription-name perftest --num-messages 0 --subscription-mode NonDurable

I am not able to figure out why the connector is not able to connect to pulsar. Need help.

This is my connector config:

exporters:
  debug:
  pulsar:
    endpoint: "pulsar://localhost:6650/"
    topic: otlp_spans
    encoding: otlp_json
    timeout: 10s
    tls_allow_insecure_connection: true

2

Answers


  1. Chosen as BEST ANSWER

    The problem was with the pulsar URL. I am not sure why the OTEL collector is not able to connect to pulsar using localhost and 127.0.0.1. Hence I gave the local IP address of my PC and it worked like a charm. endpoint: "pulsar://<--my local PC IP address here-->:6650/"


  2. Explanation

    You run OTEL and pulsar in a docker environment. They deployed in different containers and they have various localhost destinations.
    You can read here an answer about the docker connection between containers.

    Solutions

    1. To use host IP if you did port forward.
    2. Use the service name if you run your applications in the same docker network.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search