Datadog Source Code Integration


The source code integration is an integration with Git that enables you to link your telemetry (such as stack traces) with your source code.

Inline code snippet of a Java RuntimeException with a button to view the code in Github

Combined with the GitHub Apps integrations, you can see inline code snippets in your errors. For more information, see Inline Source Code.

Integration NameStack Trace LinksIssue and PR PreviewsInline Code Snippets
Source CodeXX
GitHub AppsXX
Source Code and GitHub Apps


The source code integration supports Go and all JVM languages.
Datadog Agent 7.35.0 or higher is required.

To map telemetry data with your source code:

  1. Add git.commit.sha and git.repository_url tags to your containers, or directly on your telemetry.
  2. Upload metadata about your git repository by running datadog-ci git-metadata upload in your CI pipeline.
  3. Optionally, install a GitHub App to display inline source code snippets.

Tag your telemetry

To link data to a specific commit, tag your telemetry with a git.commit.sha tag.

This approach requires Docker, or containerd >= 1.5.6. For other container setups, see the "Other" section.

If you are running your app in containers, Datadog can extract source code information directly from your images’ Docker labels. During build time, follow the Open Containers standard to add the git commit SHA and repository URL as Docker labels:

docker build . \
  -t my-application \
  --label org.opencontainers.image.revision=$(git rev-parse HEAD) \
  --label org.opencontainers.image.source=https://git-provider.example/me/my-repo

If you use Kubernetes, tag your deployed pod with a pod annotation using Datadog’s Tag Autodiscovery: '{"git.commit.sha": "<FULL_GIT_COMMIT_SHA>", "git.repository_url": "<REPOSITORY_URL>"}'

The git commit SHA and repository URL are added to your telemetry.

For non-containerized or unsupported environments, manually tag your traces, spans, and profiles with the git commit SHA and repository URL.

To tag your traces, spans, and profiles with git.commit.sha and git.repository_url, configure the tracer with the DD_TAGS environment variable:

export DD_TAGS="git.commit.sha:<GIT_COMMIT_SHA> git.repository_url=<REPOSITORY_URL>"
./my-application start

Upload your git metadata

In order to link your telemetry to your source code, Datadog collects information for every commit SHA from your git repository with the datadog-ci git-metadata upload command.

When you run datadog-ci git-metadata upload within a git repository, Datadog receives the repository URL, the commit SHA of the current branch, and a list of tracked file paths.


To ensure the data is being collected, run datadog-ci git-metadata upload in your CI pipeline.

You can expect to see the following output:

Reporting commit 007f7f466e035b052415134600ea899693e7bb34 from repository
180 tracked file paths will be reported.
✅  Handled in 0.077 seconds.

Stack traces

In Error Tracking and on APM error spans, you can directly access links to repositories from your stack traces.

  1. Navigate to APM > Error Tracking.
  2. Click on an issue. The Issue Details panel appears to the right.
  3. Under Latest available errors, hover over a frame. The View button appears to the right and directs you to GitHub.
Inline code snippet
Inline source code

If you are a GitHub SaaS user, install Datadog’s GitHub Apps integration to directly inline code snippets from your GitHub repository in your stack traces.

When specifying your permissions in the integration tile, enable Datadog read permissions to Contents.

To install a GitHub App for your organization, you need to be an organization owner or have admin permissions in a repository. You can also install a GitHub App on your personal GitHub account.

For more information, see GitHub Apps & OAuth Apps.

  1. Click on a frame to expand the code snippet containing lines of your source code.
  2. Click Connect to Preview and Authorize to access the source code snippet containing the error.
Inline code snippet

Continuous Profiler

In the Continuous Profiler, you can directly access traces in the source repository on GitHub.

  1. Navigate to APM > Profile Search.
  2. Click on a profile and hover your cursor over a method in the flamegraph. A kebab icon with the More actions label appears to the right.
  3. Click More actions > View in repo to open the source code repository.
Link to git from profiler

Further Reading

Additional helpful documentation, links, and articles: