diff --git a/content/en/tracing/code_origin/_index.md b/content/en/tracing/code_origin/_index.md index 849f09f367e..156fc7f32d2 100644 --- a/content/en/tracing/code_origin/_index.md +++ b/content/en/tracing/code_origin/_index.md @@ -36,12 +36,11 @@ Code Origin captures the exact locations in your codebase where APM spans are cr In Trace Explorer, select a span from an enabled service to see Code Origin details on the Overview tab: {{< img src="tracing/code_origin/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 (required for code previews). +- [Source Code Integration][7] is enabled. - Your service meets the [compatibility requirements](#compatibility-requirements). ### Compatibility requirements @@ -93,11 +92,25 @@ In Trace Explorer, select a span from an enabled service to see Code Origin deta {{% /tab %}} +{{% tab "Go" %}} + +Go services get Code Origin data through [Source Code Integration](#code-origin-coverage-through-source-code-integration) rather than the SDK flag. + +| Requirement | Frameworks | +|---|---| +| [Source Code Integration](/integrations/guide/source-code-integration/) enabled | Custom spans, gRPC servers, Gin, Chi, Echo, Fiber, gorilla/mux, OpenTelemetry, OpenTracing | + +{{% /tab %}} + {{% /tabs %}} ### Enable Code Origin -Run your service with the following environment variable: +Source Code Integration alone can infer some Code Origin details automatically, even for services that don't meet the [compatibility requirements](#compatibility-requirements). See [Code Origin coverage through Source Code Integration](#code-origin-coverage-through-source-code-integration). + +Enabling the SDK flag for a compatible language and framework gets you full tracer-instrumented coverage. + +To enable through the SDK, run your service with the following environment variable: ```shell export DD_CODE_ORIGIN_FOR_SPANS_ENABLED=true @@ -145,7 +158,7 @@ export DD_CODE_ORIGIN_FOR_SPANS_ENABLED=true ### Code Origin section is missing - Verify Code Origin is [enabled](#enable-code-origin) in your SDK configuration. -- Confirm that your service meets all [compatibility requirements](#compatibility-requirements) (that is, service language, supported frameworks, and minimum tracer version). +- Confirm that your service meets all [compatibility requirements](#compatibility-requirements), including service language, supported frameworks, and minimum tracer version. If it doesn't, you might still get some Code Origin data automatically if the source code repository is linked in Datadog. See [Code Origin coverage through Source Code Integration](#code-origin-coverage-through-source-code-integration). - For most services, Code Origin data is captured for [service entry spans][12] only. You can filter to "Service Entry Spans" in the [APM Trace Explorer][1]. {{< img src="tracing/code_origin/code_origin_service_entry_spans_filter.png" alt="Code Origin - Search for Service Entry Spans" style="width:100%;">}} @@ -156,6 +169,12 @@ export DD_CODE_ORIGIN_FOR_SPANS_ENABLED=true - For transpiled Node.js applications (for example, TypeScript), make sure to generate and publish source maps with the deployed application, run Node.js with the [`--enable-source-maps`][10] flag, and use v5.59.0 or newer of the Node.js tracer. Otherwise, code previews will not work. See the Node.js [Source Code Integration][9] documentation for more details. - Code Origin is designed to reference user code only, but in some cases, third-party code references may slip through. You can report these cases to [Datadog support][13] and help improve these references. +## Code Origin coverage through Source Code Integration + +[Source Code Integration][7] (for example, with GitHub, GitLab, or Azure DevOps) is required as a [prerequisite](#prerequisites). On its own, it uses static analysis of your repository to automatically determine code locations for some languages and frameworks, without meeting the other requirements. + +To get full tracer-instrumented coverage for the languages and frameworks listed in [compatibility requirements](#compatibility-requirements), also [enable Code Origin](#enable-code-origin) in your SDK. Data from both methods appears in the same Code Origin section of the Trace Explorer and powers the same [IDE integration](#in-your-ide) and [Live Debugger](#in-the-trace-explorer) workflows. + ## Further Reading {{< partial name="whats-next/whats-next.html" >}}