When tracing is enabled, the Apitally SDK captures OpenTelemetry spans during request handling and attaches them to request logs. This allows you to see exactly what happened during each request, including database queries, HTTP calls to external services, and custom operations. If you have an existing OpenTelemetry setup, the SDK automatically registers itself as a span processor with the globalDocumentation Index
Fetch the complete documentation index at: https://docs.apitally.io/llms.txt
Use this file to discover all available pages before exploring further.
TracerProvider. Otherwise, it creates its own. Any spans created using the standard OpenTelemetry API or by instrumentation libraries will be captured.
Enable tracing
To enable tracing, setCaptureTraces to true in your middleware configuration:
Instrument libraries
To capture spans from HTTP clients, database drivers, and other libraries, use the corresponding OpenTelemetry instrumentation libraries. For example, to instrument outgoing HTTP requests usingotelhttp:
Create custom spans
For custom operations that aren’t covered by library instrumentation, you can create spans manually using the standard OpenTelemetry API:ctx returned by tracer.Start() to any child operations to maintain the span hierarchy.