8000 Create new Code Origins doc page by sstonehill12 · Pull Request #28056 · DataDog/documentation · GitHub
[go: up one dir, main page]

Skip to content

Create new Code Origins doc page #2 8000 8056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3d39d4b
Create new Code Origins doc page
sstonehill12 Mar 10, 2025
d28d0c7
Update Code Origins guide and add images
sstonehill12 Mar 24, 2025
145bb7e
Update doc content
sstonehill12 Mar 24, 2025
62338cb
Update troubleshooting section
sstonehill12 Mar 24, 2025
e8b4b52
Fixed some automated styling comments
sstonehill12 Mar 24, 2025
e087ff8
Update content/en/tracing/guide/code_origins.md
sstonehill12 Mar 25, 2025
7f80b92
Update overview content
sstonehill12 Mar 25, 2025
fcb467c
Update prerequisites section
sstonehill12 Mar 25, 2025
871b176
Update enable section
sstonehill12 Mar 25, 2025
c6fb954
Update troubleshooting section
sstonehill12 Mar 25, 2025
b914636
Removed tracing library specific instructions, kept env variable inst…
sstonehill12 Mar 25, 2025
f7ea517
Merge branch 'master' into sarah.stonehill/code-origin-new-doc
sstonehill12 Mar 25, 2025
cb96295
Add Code Origins guide to Tracing Guides index page
sstonehill12 Mar 25, 2025
f68373e
Apply suggestions from code review
sstonehill12 Apr 11, 2025
5422ca0
Clarified no billing impact "while in Preview" and added Live Debugge…
sstonehill12 Apr 11, 2025
1766d6e
Merge branch 'master' into sarah.stonehill/code-origin-new-doc
sstonehill12 Apr 11, 2025
b0abde6
Added preview callout, removed node.js exit span support, and other m…
sstonehill12 Apr 15, 2025
ea176d0
Added back suppor 8000 t for exit spans, added .NET to supported runtimes
sstonehill12 Apr 15, 2025
3aaa871
Add Code Origins page to left hand nav menu
sstonehill12 Apr 18, 2025
23cf6d5
Apply most suggestions from code review
sstonehill12 Apr 18, 2025
99afcc5
Updated images and a couple of other minor edits
sstonehill12 Apr 18, 2025
03f062b
Minor wording change to entry and exit span code origin types
sstonehill12 Apr 18, 2025
858d20a
Apply suggestions from code review
sstonehill12 Apr 21, 2025
a7a7d7d
Image changes and minor change to pricing impact section
sstonehill12 Apr 21, 2025
c669ab1
Merge branch 'master' into sarah.stonehill/code-origin-new-doc
sstonehill12 Apr 21, 2025
efe26e0
Apply suggestions from code review
sstonehill12 Apr 22, 2025
935e096
Removed all exit span references, removed How it works and Impact on …
sstonehill12 Apr 22, 2025
fe4ffc4
Update beta callout text to say time-sensitive instead urgent
sstonehill12 Apr 22, 2025
b541b9c
Merge branch 'master' into sarah.stonehill/code-origin-new-doc
tylfin Apr 23, 2025
9671fe1
Merge branch 'master' into sarah.stonehill/code-origin-new-doc
tylfin Apr 23, 2025
b285814
Merge branch 'master' into sarah.stonehill/code-origin-new-doc
tylfin Apr 23, 2025
93e5911
Removed Datadog support instruction from beta callout
sstonehill12 Apr 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/_default/menus/main.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3792,6 +3792,11 @@ menu:
url: tracing/trace_explorer/trace_queries/
parent: trace_explorer
weight: 606
- name: Code Origins for Spans
url: tracing/guide/code_origins
parent: tracing
identifier: tracing_code_origins
weight: 7
- name: Service Observability
url: tracing/services/
parent: tracing
Expand Down
1 change: 1 addition & 0 deletions content/en/tracing/guide/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ These tutorials walk you through setting up a sample multi-service application w
{{< nextlink href="/tracing/guide/aws_payload_tagging/" >}}Capture requests and responses from AWS services automatically{{< /nextlink >}}
{{< nextlink href="/tracing/guide/service_overrides/" >}}Service Overrides{{< /nextlink >}}
{{< nextlink href="/tracing/guide/injectors/" >}}Understanding injector behavior with Single Step Instrumentation{{< /nextlink >}}
{{< nextlink href="/tracing/guide/code_origins/" >}}Code Origins for Spans{{< /nextlink >}}
{{< /whatsnext >}}
110 changes: 110 additions & 0 deletions content/en/tracing/guide/code_origins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: Code Origins for Spans
description: "Learn how to use Code Origins to understand where your spans originate in your codebase"
further_reading:
- link: "/tracing/glossary/"
tag: "Documentation"
text: "Learn about APM terms and concepts"
- link: "/tracing/trace_collection/"
tag: "Documentation"
text: "Learn how to set up APM tracing with your application"
- link: "/tracing/services/service_page/"
tag: "Documentation"
text: "Learn more about services in Datadog"
- link: "/tracing/services/resource_page/"
tag: "Documentation"
text: "Dive into your resource performance and traces"
- link: "/dynamic_instrumentation/"
tag: "Documentation"
text: "Learn how to add custom spans with Dynamic Instrumentation"

---

{{< beta-callout url="#" btn_hidden="true" >}}
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 <a href="https://docs.google.com/forms/d/e/1FAIpQLScyeRsF2GJjYdf9bUyeDjt8_9id-gvqiBU1SHR3ioDGe5eF3g/viewform?usp=header">this form</a> with details.
{{< /beta-callout >}}

## 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:
{{< img src="tracing/guide/code_origins/code_origin_details_spotlight.png" alt="Code Origin Details" style="width:100%;">}}


## Getting started

### Prerequisites
- [Datadog APM][6] is configured to capture spans.
- [Source Code Integration][7] is enabled (recommended for code previews).
- Your service meets the [compatibility requirements](#compatibility-requirements).

### 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:

```shell
export DD_CODE_ORIGIN_FOR_SPANS_ENABLED=true
```

## Using Code Origins

### In the Trace Explorer

1. Navigate to the [Trace Explorer][1].
2. Click on any trace to view its details.
3. In the span details panel, look for the "Code Origin" section.

{{< img src="tracing/guide/code_origins/code_origin_details_spotlight.png" alt="Code Origin Details in Traces Explorer" style="width:100%;">}}

4. Optionally, click on source code variables to add them as attributes to future spans with [Dynamic Instrumentation][5].

{{< img src="tracing/guide/code_origins/code_origin_add_span_tag_spotlight.png" alt="Code Origin - Add span tag with Dynamic Instrumentation" style="width:100%;">}}

### In your IDE

1. Set up your [Datadog IDE Integration][4].
- Supported IDEs: IntelliJ, VS Code
- Supported Languages: Java, Python
2. View RED metrics (Requests, Errors, and Duration) as inline annotations above your endpoint methods.

{{< img src="tracing/guide/code_origins/code_origin_ide_details.png" alt="Code Origin Details in IDE" style="width:100%;">}}

## Troubleshooting

If Code Origin information is missing:

1. Verify Code Origins is [enabled](#enable-code-origins) in your tracing library configuration.
1. Confirm that your service meets all [compatibility requirements](#compatibility-requirements).
- In particular, check whether your service's language and framework support Code Origins.
1. Filter for spans that include Code Origins using the query `@_dd.code_origin.type:*` in the [Trace Explorer][1].
1. Enable [Source Code Integration][7] to see code previews in the APM Trace side panel.


## Further Reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: https://app.datadoghq.com/apm/traces
[2]: /tracing/services/service_page/
[3]: /tracing/services/resource_page/
[4]: /developers/ide_plugins/
[5]: /dynamic_instrumentation/
[6]: /tracing/trace_collection/
[7]: /integrations/guide/source-code-integration/
[8]: /tracing/trace_collection/compatibility/nodejs#web-framework-compatibility
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
0