Traefik
StackState curated integration
This page describes StackState version 4.3.
The StackState Agent V2 Traefik integration provides the following functionality:
  • Reporting Traefik frontends and backends as topology elements.
  • Reporting all network connections between services, including network traffic telemetry.

Setup

Installation

The StackState Traefik integration is included in the Agent V2 StackPack. Currently this integration supports tracing of Traefik requests using the Datadog tracing backend supported by Traefik.

Configuration

Configure your Traefik instance to report Datadog tracing data to the StackState Agent. Your Traefik.toml configuration file must include the following parameters:
1
# Tracing definition
2
[tracing]
3
# Use the Datadog backend to send the Datadog Tracing format to StackState Agent
4
backend = "datadog"
5
โ€‹
6
# Component name used for your Traefik instance in StackState
7
serviceName = "traefik"
8
โ€‹
9
# Span name limit allows for name truncation in case of very long Frontend/Backend names
10
# This can prevent certain tracing providers to drop traces that exceed their length limits
11
spanNameLimit = 100
12
โ€‹
13
[tracing.datadog]
14
# StackState Agent Host Port instructs reporter to send spans to the StackState Agent at this address
15
localAgentHostPort = "agentHost:8126"
16
โ€‹
17
# Applies a shared tag in a form of source:traefik to all the spans of the trace
18
globalTag = "source:traefik"
Copied!

Integrate with Java traces

When using Traefik in conjunction with one of our language specific trace clients, eg. StackState Java Trace Client - Java APM it is important to note that you should use the backend name of your Traefik service as the service-name for the trace client to allow automatic merging of the service components within StackState.
Eg. for the following Traefik.toml:
1
...
2
[frontends]
3
[frontends.stackstate-demo-frontend]
4
backend = "stackstate-demo-backend"
5
[frontends.stackstate-demo-frontend.routes.test_1]
6
rule = "Host:test.stackstate-demo-backend.localhost"
7
[backends]
8
[[backends.stackstate-demo-backend]]
9
# ...
10
[[backends.stackstate-demo-backend].servers.server1]
11
url = "..."
12
...
13
...
Copied!
you should pass the following jvm argument when starting your java application: -Dsts.service.name=stackstate-demo-backend
or for a similar docker-compose configuration:
1
stackstate-demo-app:
2
image: stackstate-demo-app:latest
3
pid: "host" # use pid:"host" to ensure pid's match with processes reported by the StackState process agent
4
ports:
5
- '8081-8091:8081'
6
depends_on:
7
- another_app
8
- stackstate-agent
9
labels:
10
- "traefik.frontend.rule=Host:stackstate-demo-app.docker.localhost"
11
- "traefik.backend=stackstate-demo-app"
12
environment:
13
MAVEN_OPTS: |
14
-Dsts.service.name=stackstate-demo-app
15
-Dsts.agent.host=${DOCKER_HOST_IP}
16
-Dsts.agent.port=8126
17
-javaagent:/sts-java-agent.jar
Copied!

Troubleshooting

To verify whether the StackState Trace Agent has received traces, set the logging level to debug and check the trace-agent.log:
stackstate.yaml
1
log_level: debug
Copied!
In Docker or Kubernetes, set the following environment variable for the StackState Agent
1
STS_LOG_LEVEL: "DEBUG"
Copied!
Last modified 2mo ago