> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/smc/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/smc/latest/troubleshooting/tracing.md).

# Troubleshooting with traces

Distributed traces locate faults that are hard to isolate with metrics and logs alone: latency that appears only for some sessions, errors that originate at one peer and surface at another, and transactions that involve several protocols. This page describes a general trace-based troubleshooting workflow for Session Management Controller (SMC). For the tracing concept, see [Distributed tracing](https://docs.cennso.com/components/smc/latest/observability/tracing.md); for the configuration reference, see [Tracing configuration](https://docs.cennso.com/components/smc/latest/guides/tracing.md).

## When to use traces

Use traces when the question is about individual transactions rather than aggregates:

- Session setup latency increased, and the metrics do not show which protocol is responsible.
- Requests fail occasionally, and the failing peer is unknown.
- A specific subscriber session misbehaves, and the matching log lines across components are hard to collect.

## Step 1: Enable tracing for the analysis

For a bounded troubleshooting session, sample every transaction:

```yaml
tracing:
  enabled: true
  endpoint: http://otel-collector.monitoring:4317
  sampler: parentbased_always_on
```

> [!IMPORTANT]
> `parentbased_always_on` traces every transaction. On a system with high signaling load, prefer `parentbased_traceidratio` with a raised `samplerArg`, and remember that traces can carry subscriber-correlated data — see the data-sensitivity section of [Distributed tracing](https://docs.cennso.com/components/smc/latest/observability/tracing.md#data-sensitivity).

Changing the `tracing` values restarts the SMC pod. Plan the change accordingly on production systems.

## Step 2: Find the trace

In Grafana, open **Explore** and select **Traces** in the data source picker in the top left. Useful search entry points:

- **By service:** filter on `service.name` equal to the configured service name, then sort by duration to find slow transactions, or filter on the error status to find failed ones.
- **By operation:** filter on a span name such as `gtpc.create_session_request` to analyze one procedure type.
- **By subscriber:** filter on a subscriber identifier span attribute, such as `3gpp.imsi` or `3gpp.supi`, to collect all traces of one subscriber session. SMC records these attributes on the entry-point server spans.
- **By log line:** when a suspicious SMC log line is already known, copy its `trace_id` value and open the trace with that ID directly.

The trace search results and an opened SMC trace in Grafana Explore:

![Trace search and an opened gtpc.create_session_request trace in Grafana Explore](https://docs.cennso.com/api/assets/components/smc/latest/assets/tracing-explore-sample-trace.png)

> [!WARNING]
> Grafana 12.3.3, the version the Cennso Console builds on at the time of writing, has known issues with traces:
>
> - The **Drilldown** > **Traces** view (the queryless experience) shows an error and broken panels. Do not use it. Use **Explore** with the **Traces** data source instead.
> - A trace search retrieves at most 20 spans by default. When more spans match the selected time range and filters, the backend returns an arbitrary subset of them — not the most recent ones.
> - Sorting in the result table is client-side. It only reorders the spans that were already retrieved and cannot bring back spans the limit cut off. The newest row in the table is therefore not necessarily the newest matching span.
> - Narrow the time range and add filters until the number of matches stays below the limit, or raise the limit in the search options.

## Step 3: Read the span tree

A trace for a session creation looks like this:

```text
gtpc.create_session_request          server   48 ms
├── aaa.invoke                       client    2 ms
├── pfcp.session_establishment_request client 14 ms
└── aaa.invoke                       client   30 ms
    └── diameter.CCR                 client   29 ms
```

Read the tree starting at the root span:

- The root span duration is the end-to-end processing time of the inbound request.
- Each child span is one protocol exchange that the request triggered. The slowest child names the exchange that dominates the latency — in the tree shown, the Diameter peer answers in 29 ms while the User Plane Function (UPF) answers the Packet Forwarding Control Protocol (PFCP) request in 14 ms.
- Gaps between child spans are time spent inside SMC.
- A span with the error status marks the protocol exchange where the transaction failed first; parent spans fail as a consequence.

## Step 4: Correlate with logs

Every SMC log line written while a span is active carries the trace ID in the `trace_id` field and the span ID in the `span_id` field:

```text
when=2026-06-02T12:00:00.000Z level=debug trace_id=4bf92f3577b34da6a3ce929d0e0e4736 span_id=00f067aa0ba902b7 msg=create_session_request
```

This works in both directions:

- **From a trace to the logs:** copy the trace ID from the trace backend and filter the SMC logs for `trace_id={TRACE_ID}`.
- **From a log line to the trace:** copy the `trace_id` value from the log line and open the trace with that ID in the trace backend. With a ratio sampler, a log line can carry a trace ID whose transaction was not sampled — the trace backend then has no trace for it.

## Step 5: Revert the tracing change

After the analysis, restore the previous `tracing` values — disable tracing or return to a production sampler — and upgrade the release.

## Common findings

The following table lists common trace observations and their likely causes:

| Observation in the trace | Likely cause |
|---|---|
| Long `pfcp.<message_type>` child span | Slow UPF or congested Sx/N4 path |
| Long `diameter.<command>` child span | Slow Diameter peer (policy or charging system) or transport issues toward it |
| Long `sbi.npcf.<operation>` child span | Slow Policy Control Function (PCF) or HTTP/2 connection issues |
| Large gaps between child spans | SMC under load; inspect the SMC Overview dashboard and the adaptive load control metrics |
| Root span with error status, no failed child | SMC rejected the request itself; filter the logs by `trace_id` for the reason |
