Tracing with Elastic

Hi all,

I tried to tracing with Elastic to send data to an APM server.

In my static configuration, I have add the following content:


global:
  sendAnonymousUsage: false
log:
  level: DEBUG
  format: common
ping: {}
api:
  dashboard: true
  debug: false
  insecure: true
providers:
  docker:
    endpoint: 'unix:///var/run/docker.sock'
    watch: true
    exposedByDefault: false
    swarmMode: false
  File:
    directory: /etc/traefik/config/
    watch: true
entryPoints:
  insecure:
    address: ':80'
  secure:
    address: ':443'
tracing:
  serviceName: traefik
  elastic:
    serverURL = "https://apm.example.com"
    secretToken = "dadadadadadadad"
    serviceEnvironment = "my_env"

When I launch Traefik, I have this:

time="2020-04-27T17:12:19+02:00" level=debug msg="Failed to extract the context: opentracing: SpanContext not found in Extract carrier" middlewareName=tracing middlewareType=TracingEntryPoint
time="2020-04-27T17:12:19+02:00" level=debug msg="Reporting span 2318018f734f8eb5:037d43e72292911c:2318018f734f8eb5:1" tracingProviderName=jaeger
time="2020-04-27T17:12:19+02:00" level=debug msg="Reporting span 2318018f734f8eb5:2318018f734f8eb5:0000000000000000:1" tracingProviderName=jaeger
time="2020-04-27T17:12:24+02:00" level=debug msg="Failed to extract the context: opentracing: SpanContext not found in Extract carrier" middlewareType=TracingEntryPoint middlewareName=tracing
time="2020-04-27T17:12:24+02:00" level=debug msg="Reporting span 2bd12edc927a1d64:5a28cd1d3b8d2aff:2bd12edc927a1d64:1" tracingProviderName=jaeger
time="2020-04-27T17:12:24+02:00" level=debug msg="Reporting span 2bd12edc927a1d64:2bd12edc927a1d64:0000000000000000:1" tracingProviderName=jaeger
time="2020-04-27T17:12:25+02:00" level=error msg="Tracing jaeger error: failed to flush Jaeger spans to server: write udp 127.0.0.1:47286->127.0.0.1:6831: write: connection refused" tracingProviderName=jaeger
time="2020-04-27T17:12:29+02:00" level=debug msg="Failed to extract the context: opentracing: SpanContext not found in Extract carrier" middlewareType=TracingEntryPoint middlewareName=tracing
time="2020-04-27T17:12:29+02:00" level=debug msg="Reporting span 79d6d2c5272165ed:08b9d92a3d8b7de9:79d6d2c5272165ed:1" tracingProviderName=jaeger
time="2020-04-27T17:12:29+02:00" level=debug msg="Reporting span 79d6d2c5272165ed:79d6d2c5272165ed:0000000000000000:1" tracingProviderName=jaeger
time="2020-04-27T17:12:34+02:00" level=debug msg="Failed to extract the context: opentracing: SpanContext not found in Extract carrier" middlewareName=tracing middlewareType=TracingEntryPoint
time="2020-04-27T17:12:34+02:00" level=debug msg="Reporting span 5cc8fa2949c19aca:62ef6890642173c4:5cc8fa2949c19aca:1" tracingProviderName=jaeger
time="2020-04-27T17:12:34+02:00" level=debug msg="Reporting span 5cc8fa2949c19aca:5cc8fa2949c19aca:0000000000000000:1" tracingProviderName=jaeger
time="2020-04-27T17:12:35+02:00" level=error msg="Tracing jaeger error: failed to flush Jaeger spans to server: write udp 127.0.0.1:47286->127.0.0.1:6831: write: connection refused" tracingProviderName=jaeger
time="2020-04-27T17:12:39+02:00" level=debug msg="Failed to extract the context: opentracing: SpanContext not found in Extract carrier" middlewareType=TracingEntryPoint middlewareName=tracing
time="2020-04-27T17:12:39+02:00" level=debug msg="Reporting span 660290731952e6a6:0ed0a47848d192d8:660290731952e6a6:1" tracingProviderName=jaeger
time="2020-04-27T17:12:39+02:00" level=debug msg="Reporting span 660290731952e6a6:660290731952e6a6:0000000000000000:1" tracingProviderName=jaeger

I have the impression that Traefik don't interpret Elastic tracing configuration and so, he use the default Jaeger configuration.

Can you help me ?

I use traefik:2.2 version.

Thx :slight_smile:

1 Like
    serverURL = "https://apm.example.com"
    secretToken = "dadadadadadadad"
    serviceEnvironment = "my_env"

I'm curious, if you were to change: serverURL = "..." to serverURL: "https://xyz.com" if the tracer would be configured properly.

Thx @notsureifkevin, it was a mistake from my part :wink:

Change for this make solve the problem:

    serverURL: "https://apm.example.com"
    secretToken: "dadadadadadadad"
    serviceEnvironment: "my_env"

I can send data from Traefik to Elastic APM now.

But, I can see this message in traefik log who appears constantly:

Failed to extract the context: opentracing: SpanContext not found in Extract carrier" middlewareName=tracing middlewareType=TracingEntryPoint

Do you know what it appears ?

Thx :slight_smile:

1 Like

I believe that is just a DEBUG message, and isn't anything bad - it's simply indicating that a span was generated and no SpanContext was found (so it creating the root span/trace).

@notsureifkevin Thanks for the answer :slight_smile:

Have a good day !

1 Like