i’d like to set up a tcp reverse-proxy with traefik and trace the connections with OpenTelemetry.
I’ve set up jaeger, traefik and the traefik-whoami test enedpoint and with HTTP routers I got everything working as expected – the correct http response is returned and some traces appear in jaeger (spans for the entrypoint, the router, … up to the reverse proxy invocation – enough for me for now…).
For the TCP-based router, the reverse proxy also works as intended, however, no traces appear in jaeger. I’m aware of the limitations and implications of the TCP-based routing and tracing, like no propagation etc.; but I’d be more than happy with just the traefik internal spans.
I use this docker-compose based setup.
kind regards!
version: "3"
services:
jaeger:
image: jaegertracing/all-in-one
ports:
- "16686:16686"
traefik:
image: traefik:v3.1.3
volumes:
- ./traefik_cfg/:/etc/traefik/
ports:
- "9000:9000"
- "18080:80"
whoami:
image: traefik/whoami
ports:
- "28080:80"
# traefik.toml
[global]
checkNewVersion = false
sendAnonymousUsage = false
[log]
level = "DEBUG"
[api]
dashboard = true
insecure = true
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.tcp]
address = ":9000"
[providers]
[providers.file]
filename = "/etc/traefik/dynamic_conf.toml"
[tracing]
addInternals = true
[tracing.otlp.grpc]
endpoint = "jaeger:4317"
insecure = true
# dynamic_conf.toml
[tcp]
[tcp.routers]
[tcp.routers.whoami-tcp]
entryPoints = ["tcp"]
rule = "HostSNI(`*`)"
service = "whoami-tcp-svc"
[tcp.services.whoami-tcp-svc.loadBalancer]
[[tcp.services.whoami-tcp-svc.loadBalancer.servers]]
address = "whoami:80"
[http.routers]
[http.routers.whoami-http]
entryPoints = ["web"]
rule = "PathPrefix(`/whoami`)"
service = "whoami-http-svc"
[http.services]
[http.services.whoami-http-svc]
[http.services.whoami-http-svc.loadBalancer]
[[http.services.whoami-http-svc.loadBalancer.servers]]
url = "http://whoami:80"