AI-200 · 4.2.1 · Secure, monitor, and troubleshoot Azure solutions
OpenTelemetry tracing
Trace distributed systems by using OpenTelemetry SDKs
one operation across services with linked , identify each service, and send the correlated telemetry to .
One operation, many spans

A is a tree of that follows one operation across services. Configure the Azure Monitor distro once and give each service a distinct service name so Application Map can separate them.
Add spans where libraries cannot
configure_azure_monitor()
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("build-report") as span:
...
A custom span is a dependency by default. Use SpanKind.SERVER when background work should represent an incoming request.
Record handled failures
An exception that escapes a span can be captured automatically. If your code catches it and returns a fallback, call span.record_exception(ex) so the failure is still attached to the trace.
Know where telemetry lands
Incoming request spans appear in requests, outgoing calls in dependencies, and application logs in traces. The operation ID correlates telemetry that belongs to one end-to-end operation.
Control trace volume
Fixed-percentage sampling reduces stored traces, while metrics stay unsampled.
Key points
- : one end-to-end operation made of correlated
- Setup: `configure_azure_monitor()` once per process
- Service identity: distinct service names separate components in Application Map
- Custom span: use `SpanKind.SERVER` when it represents a request
- Caught exception: call `span.record_exception(ex)` explicitly
- Sampling: reduces traces, while metrics remain unsampled
Click an underlined term for a one-line explanation, or see them all in the glossary .
Exam trap
A you create yourself is stored as an InProc dependency by default; pass `kind=SpanKind.SERVER` for a request such as a background job.
Sources · 4 Microsoft Learn pages Show ▾
- Enable Azure Monitor OpenTelemetry for applications
- Add and modify Azure Monitor OpenTelemetry
- Configure Azure Monitor OpenTelemetry
- Application Insights telemetry data model
Checked on October 4, 2026. Report a problem
Go deeper on Microsoft Learn
- Enable Azure Monitor OpenTelemetry for applications
- Add and modify Azure Monitor OpenTelemetry
- Configure Azure Monitor OpenTelemetry
- Application Insights telemetry data model
Checked against Microsoft Learn on October 4, 2026. Report a problem with this card