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.Documentation Index
Fetch the complete documentation index at: https://docs.apitally.io/llms.txt
Use this file to discover all available pages before exploring further.
Enable tracing
To enable tracing, setcaptureTraces to true in your request logging configuration:
Set up OpenTelemetry
To capture spans from libraries like HTTP clients and database drivers, you need to set up OpenTelemetry instrumentation. First, install the required packages:instrumentation.ts file (or instrumentation.mjs for JavaScript) that initializes the OpenTelemetry SDK with the ApitallySpanProcessor and auto-instrumentations:
instrumentation.ts / instrumentation.mjs
No trace exporter is required. The
ApitallySpanProcessor collects spans and attaches them to request logs instead.--import flag to load the instrumentation before your application code:
Create custom spans
For custom operations that aren’t covered by library instrumentation, you can create spans manually using thestartActiveSpan method from the standard OpenTelemetry API.