APM Implementation Guide
By Nicolas Narbais
Instrument a service from its first exported traces to actionable service health, release comparison, log correlation, and operational coverage.
Move a service from uninstrumented code to actionable APM in Tsuga by rolling out six levels in order:
| Level | Goal | Primary signal |
|---|---|---|
| 1 | Forward traces with stable identity | OTLP traces |
| 2 | Generate RED metrics for the Service page | span_metrics connector (delta) |
| 3 | Tag immutable releases | service.version across all signals |
| 4 | Correlate logs and traces (sync + async) | trace_id, span_id, W3C propagation |
| 5 | Add owned monitors and one critical SLO | Error rate, p95 latency, SLO |
| 6 | Decide sampling after span_metrics | Full fidelity by default |
Deploy the receiving Collector through your host or cluster path first (this guide does not deploy one), and ensure structured application logs reach Tsuga before starting Level 4.
Before starting
- Pick one pilot service: agree on environments, owners, and one business-critical journey before widening rollout.
- Choose the export route: direct SDK export works for Level 1 validation, but Level 2 requires a Collector for
span_metrics. - Lock identity conventions: standardize
service.name,deployment.environment.name, and immutableservice.version. Renaming later splits history. - Protect credentials: keep the Tsuga OTLP endpoint and ingestion key in your secret store, never in YAML, container images, or Git.
- Bound dimensions early: allow route, method, operation, and status code; ban user IDs, request IDs, raw URLs, and payloads.
- Verify egress: confirm outbound HTTPS from the sender to the Tsuga intake endpoint.
Level 1 - Forward traces to Tsuga
Instrument the service with the OpenTelemetry language SDK or auto-instrumentation (Java, Node.js, Python, .NET, Go, PHP, Ruby, Rust, or C++) and export traces over OTLP.
Set two mandatory resource attributes from day one (resource semantic conventions):
service.name: logical service name.deployment.environment.name: separates production from non-production (paired with the matching environment-scoped Tsuga API key).
Exit criteria: A known request appears as a trace in Tsuga with the agreed service.name and environment, and its root span represents the entry operation rather than an internal function.
Level 2 - Generate RED metrics from traces
Raw traces explain individual requests, but they do not populate Tsuga’s Service page. Add the Collector span_metrics connector with delta temporality to generate request rate, error rate, duration, operation breakdowns, and observed service.version deployments.
connectors:
span_metrics:
aggregation_temporality: AGGREGATION_TEMPORALITY_DELTA
Why delta is the default
With cumulative aggregation, a stopped pod can retain its last total and cumulative_to_delta emits repeated zeroes, keeping stale service versions alive in Deployments views. Delta emits work per interval and stops cleanly when a pod exits:
Cumulative source: 120 → 120 → 120 → 120
After cumulative-to-delta: 0 → 0 → 0
Delta source while serving: 8 → 11 → 6
Pod stops serving: no further datapoints
Use AGGREGATION_TEMPORALITY_CUMULATIVE only when recovering counts across a dropped export matters more than expiring inactive versions promptly.
Stateful Collector routing: When scaling Collectors that run span_metrics or cumulative_to_delta, route each metric stream consistently to the same instance, because splitting a stateful stream produces wrong counts.
Configure span_metrics by deployment model
- Tsuga
opentelemetry-kube-stackHelm chart (0.11.4+): defaults to delta and wiresspan_metricsautomatically. Set it explicitly when upgrading or pinning config:
agent:
spanMetrics:
aggregationTemporality: AGGREGATION_TEMPORALITY_DELTA
- Community Helm chart: declare
span_metricsand wire it as both atracesexporter and ametricsreceiver (unwired connectors do not run):
connectors:
span_metrics:
aggregation_temporality: AGGREGATION_TEMPORALITY_DELTA
service:
pipelines:
traces:
exporters: [span_metrics, otlp_http/tsuga]
metrics:
receivers: [otlp, span_metrics]
- Standalone / local Collector: bind local OTLP to
127.0.0.1unless external senders require a secured interface, and keepcumulative_to_deltainmetricsfor cumulative app metrics (it passes delta span metrics through unchanged):
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 25
resource_detection:
detectors: [env, system]
override: false
cumulative_to_delta: {}
batch: {}
connectors:
span_metrics:
aggregation_temporality: AGGREGATION_TEMPORALITY_DELTA
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, resource_detection, batch]
exporters: [span_metrics, otlp_http/tsuga]
metrics:
receivers: [otlp, span_metrics]
processors: [memory_limiter, resource_detection, cumulative_to_delta, batch]
exporters: [otlp_http/tsuga]
Keep span-metric dimensions strictly bounded (route, method, status code). Never put user IDs, request IDs, raw URLs, or message IDs on span metrics.
Exit criteria: The Service page displays request rate, error rate, and latency; span_metrics is wired from traces into metrics; and a stopped workload’s series disappear instead of emitting zeroes.
Level 3 - Version every release
Attach an immutable service.version resource attribute (such as the build commit SHA or an immutable release tag, never latest, a branch, or an environment) across traces, metrics, and logs via deployment config such as OTEL_RESOURCE_ATTRIBUTES.
Exit criteria: The Deployments tab lists current and previous service.version values, and traces, span metrics, and logs all report the identical version string.
Level 4 - Correlate logs and traces
Emit the active span’s trace_id and span_id alongside matching service.name in application logs by enabling the language logger bridge before framework initialization or adding the fields in your JSON formatter. The Collector preserves context; it cannot recreate missing IDs.
For asynchronous queues or workers, inject W3C context on publish. Continue immediate synchronous work in the same trace; for delayed or decoupled work, create a CONSUMER span linked to the producer context and validate producer, consumer, and correlated logs together.
Exit criteria: Clicking a log from a known request opens its trace, the span displays that log, and the same check passes for every in-scope background job or queue consumer.
Level 5 - Add owned monitors and one critical SLO
Verify service.version before paging: Immutable release identity makes alert spikes and SLO burn immediately attributable to a deployment.
Cover only the small set of services behind your business-critical journey, recording owner, environment, key operations, dependencies, and user impact first:
- Error-rate monitor: agreed threshold + window + minimum traffic floor.
- p95 latency monitor: scoped to a critical endpoint with a traffic floor to prevent single-request pages.
- No-data monitor: enable only when missing traffic or telemetry requires immediate action.
- One customer-visible SLO: event-based for success ratio or time-based for latency, with an owner, rolling window, and error-budget alert. Add more SLOs only after the first proves actionable.
Adaptive paging (upcoming): routes cascading customer-facing errors to the likely culprit service using traces; scope to one service with a fallback and confirm Tsuga availability before adopting.
Exit criteria: The critical service has owned error-rate and latency monitors (with traffic floors), at most one SLO, a tested on-call notification, and a documented response.
Level 6 - Decide sampling after span_metrics
Default to full fidelity: Retain 100% of traces unless measured ingestion volume or cost forces reduction.
Always place sampling after span_metrics so request, error, and latency metrics still reflect 100% of traffic (SDK head sampling drops spans before the Collector sees them). Use head sampling for simplest volume cuts; use tail sampling only when retaining errors, slow requests, or critical flows justifies a stateful, trace-ID-routed Collector tier.
Exit criteria: The sampling choice and rationale are documented, and any active sampling runs downstream of span_metrics.
Troubleshooting path
Validate in signal order and stop at the first failing boundary:
| Symptom | Check first | Fix |
|---|---|---|
| No traces arrive | SDK load order, OTLP endpoint/protocol, Collector auth/export errors | Load SDK before framework; verify service name in Tsuga |
| Traces arrive; Service page is empty | span_metrics pipeline wiring in the target Collector tier | Wire span_metrics as traces exporter and metrics receiver |
| Stale version shows zero traffic | span_metrics aggregation temporality | Switch from cumulative + conversion to AGGREGATION_TEMPORALITY_DELTA |
| Wrong or duplicate service identity | service.name and deployment.environment.name at deploy layer | Fix runtime/env config; do not rename post-collection |
| Logs do not link to traces | Active trace_id/span_id emission and matching service.name | Fix app logger bridge/formatter and async context propagation |
| Monitor silent or noisy | Metric + dimensions in Analytics, traffic floor, window | Validate query first, then tune floor and window |
Completion criterion and CLI validation
The Service page reports request rate, error rate, and latency for a known service.version, and a log emitted during one of those requests pivots directly to its trace.
# 1. Confirm spans arrived with the agreed service.name
tsuga traces search \
--query "context.service.name:<service>" \
--from -15m \
--to now \
--max-results 10
# 2. Confirm a request log carries the matching trace_id
tsuga logs search \
--query "context.service.name:<service> <unique-log-token>" \
--from -15m \
--to now \
--max-results 10
An empty first command means trace export failed (not a Service page bug). The second must return the test log with a non-empty trace_id matching a span from the first command. Confirm span-derived RED metrics directly on Tsuga’s Service page.
References
Written by
Nicolas Narbais
Nicolas Narbais builds, breaks, debugs, and scales observability systems using OpenTelemetry and modern telemetry pipelines. He shares practical, opinionated lessons to help engineers get better signal with less noise.
Olatuak Editorial Philosophy
Better signal, not more telemetry.
Olatuak helps platform engineers, SREs, and observability teams turn noisy telemetry into clear operational decisions without blindly collecting more data.
