Lina
Lina

Reputation: 11

How to configure Jaeger agent to send traces to collector on another server

I'm trying to use Jaeger to manage tracing system. Docker is running locally "all-in-one" image with application (on the same host) without any issues. My question is how to configure jaeger agent on host1 that would send traces jaeger collector on another host2. Host2 is configured with "all-in-one". I can see Jaeger UI on host2 but it doesn't seem getting any traces from host1.

Configure tracer:

var configuration = new Configuration("service-name")
    .withSampler(Configuration.SamplerConfiguration.fromEnv())
    .withReporter(Configuration.ReporterConfiguration.fromEnv());
GlobalTracer.registerIfAbsent(configuration.getTracer());
return openTracer;

Added environment variables in yaml file on host1:

-e JAEGER_AGENT_HOST=jaeger.hostname.com \
-e JAEGER_AGENT_PORT=6831 \

Added jaeger image in yaml file on host2:

$ docker run -d --name jaeger \
  -p 5775:5775/udp \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 14268:14268 \
  -p 9411:9411 \
  jaegertracing/all-in-one:latest

Any suggestions will be appreciated.

Upvotes: 1

Views: 2495

Answers (1)

Gourds
Gourds

Reputation: 111

In my case. Host2

version: '2'

services:
    hotrod:
      image: jaegertracing/example-hotrod:1.28
      ports:
        - '8080:8080'
        - '8083:8083'
      command: ["-m","prometheus","all"]
      environment:
        - JAEGER_AGENT_HOST=jaeger-agent
        - JAEGER_AGENT_PORT=6831
        - JAEGER_SAMPLER_TYPE=remote
        - JAEGER_SAMPLING_ENDPOINT=http://jaeger-agent:5778/sampling
      depends_on:
        - jaeger-agent

    jaeger-collector:
      image: jaegertracing/jaeger-collector:1.28
      command: 
        - "--cassandra.keyspace=jaeger_v1_dc1"
        - "--cassandra.servers=cassandra"
        - "--collector.zipkin.host-port=9411"
        - "--sampling.initial-sampling-probability=.5"
        - "--sampling.target-samples-per-second=.01"
      environment: 
        - SAMPLING_CONFIG_TYPE=adaptive
      ports:
        - "14269:14269"
        - "14268:14268"
        - "14250:14250"
        - "9411:9411"
      restart: on-failure
      depends_on:
        - cassandra-schema

    jaeger-query:
      image: jaegertracing/jaeger-query:1.28
      command: ["--cassandra.keyspace=jaeger_v1_dc1", "--cassandra.servers=cassandra"]
      ports:
        - "16686:16686"
        - "16687"
      restart: on-failure
      depends_on:
        - cassandra-schema

    jaeger-agent:
      image: jaegertracing/jaeger-agent:1.28
      command: ["--reporter.grpc.host-port=jaeger-collector:14250"]
      ports:
        - "5775:5775/udp"
        - "6831:6831/udp"
        - "6832:6832/udp"
        - "5778:5778"
      restart: on-failure
      depends_on:
        - jaeger-collector

    cassandra:
      image: cassandra:4.0

    cassandra-schema:
      image: jaegertracing/jaeger-cassandra-schema:1.28
      depends_on:
        - cassandra

host1 is

version: '2'

services:
    jaeger-agent:
      image: jaegertracing/jaeger-agent:1.28
      command: ["--reporter.grpc.host-port=host2:14250"]
      ports:
        - "5775:5775/udp"
        - "6831:6831/udp"
        - "6832:6832/udp"
        - "5778:5778"
      restart: on-failure

it works well for me

Upvotes: 1

Related Questions