Join the Preview!
Code Origins is currently in Preview. To join the preview, follow the instructions below.
To submit questions, feedback, or requests related to Code Origins, fill out this form with details.
Overview
Code Origins captures the exact locations in your codebase where APM spans are created. When enabled, it automatically adds file path, line number, and function name to each span, making it easier to:
- Debug performance issues
- Understand code execution flow
- Identify performance bottlenecks
In Trace Explorer, select a span to see Code Origin details on the Overview tab:
Getting started
Prerequisites
Compatibility requirements
Runtime Language | Tracing Library Version | Frameworks |
---|
Java | 1.47.0+ | Spring Boot/Data, gRPC servers, Micronaut 4, Kafka consumers |
Python | 2.15.0+ | Django, Flask, Starlette and derivatives |
Node.js | 4.49.0+ | Fastify |
.NET | 3.15.0+ | ASP.NET, ASP.NET Core |
Enable Code Origins
Run your service with the following environment variable:
export DD_CODE_ORIGIN_FOR_SPANS_ENABLED=true
Using Code Origins
In the Trace Explorer
Navigate to the Trace Explorer.
Click on any trace to view its details.
In the span details panel, look for the “Code Origin” section.
Optionally, click on source code variables to add them as attributes to future spans with Dynamic Instrumentation.
In your IDE
Set up your Datadog IDE Integration.
- Supported IDEs: IntelliJ, VS Code
- Supported Languages: Java, Python
View RED metrics (Requests, Errors, and Duration) as inline annotations above your endpoint methods.
Troubleshooting
If Code Origin information is missing:
- Verify Code Origins is enabled in your tracing library configuration.
- Confirm that your service meets all compatibility requirements.
- In particular, check whether your service’s language and framework support Code Origins.
- Filter for spans that include Code Origins using the query
@_dd.code_origin.type:*
in the Trace Explorer. - Enable Source Code Integration to see code previews in the APM Trace side panel.
Further Reading
Additional helpful documentation, links, and articles: