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.