javaspringspring-bootgrafanagrafana-tempo

Can i change distributor's base url in Grafana Tempo with Spring Boot?


I have an application that consists of several microservices that I run in Docker. I'm currently learning observation and have already managed to connect logs with Loki, metrics with Prometheus and traces with Tempo. Logs and metrics works fine, but when I run the app, I get the following error from the services that are supposed to send their data:

Dropped 1 spans due to ResourceAccessException(I/O error on POST request for
"http://localhost:9411/api/v2/spans": Connect to http://localhost:9411
[localhost/127.0.0.1] failed: Connection refused)

As far as I understand, the problem is that the services cannot connect to the Tempo zipkin distributor service through http://localhost:9411 because it is located in container http://tempo:9411 (tempo - container name).

Here is the configuration:

tempo.yml

server:
  http_listen_port: 3110

distributor:
  receivers:
    zipkin:

storage:
  trace:
    backend: local
    local:
      path: /tmp/tempo/blocks

compose.yml

// Other services...

  tempo:
    container_name: tempo
    image: grafana/tempo:2.2.2
    command: [ "-config.file=/etc/tempo.yaml" ]
    volumes:
      - ./docker/tempo/tempo.yml:/etc/tempo.yaml:ro
      - ./docker/tempo/tempo-data:/tmp/tempo

    ports:
      - "3110:3100"  # Tempo
      - "9411:9411" # zipkin
    networks:
      - application-network

And my question is how can i change my distributor's base url from http://localhost:9411 to http://tempo:9411?

I looked for the answer on various sites and in the documentation but nothing worked.


Solution

  • If someone is also facing this problem, it is solved very easily. All you have to do is to add parameter endpoint and provide needed url:

    distributor:
      receivers:
        zipkin:
          endpoint: http://tempo:9411/api/v2/spans