Features of Source Code Integration

이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Overview

After you have connected your Git repositories and tagged your services, you can use source code integration features across various Datadog products.

You can see links from stack frames to their source repository in Error Tracking.

  1. Navigate to APM > Error Tracking.
  2. Click on an issue. The Issue Details panel appears on the right.
  3. Under Latest Event, if you’re using the GitHub or GitLab integrations, click Connect to preview on stack frames. You can see inline code snippets directly in the stack trace. Otherwise, you can click the View button on the right of a frame or select View file, View Git blame, or View commit to be redirected to your source code management tool.
A view repository button with three options (view file, view blame, and view commit) available on the right side of an error stack trace in Error Tracking, along with inline code snippets in the stack trace

You can see links from stack frames to their source repository in Error Tracking for RUM.

Source code integration is supported for the following RUM platforms when sourcemaps or debug symbols are uploaded with Git metadata:

Note: Source code integration is not supported for iOS RUM errors.

  1. Navigate to Digital Experience > Error Tracking.
  2. Click on an issue. The Issue Details panel appears on the right.
  3. Under Latest Available Errors or error samples, if you’re using the GitHub or GitLab integrations, click Connect to preview on stack frames. You can see inline code snippets directly in the stack trace. Otherwise, you can click the View button on the right of a frame or select View file, View Git blame, or View commit to be redirected to your source code management tool.
A view repository button with options to view the file, blame, and commit available on the right side of a RUM error stack trace in Error Tracking, along with inline code snippets

You can see source code previews directly in Continuous Profiler flame graphs.

  1. Navigate to APM > Profiles > Explorer.
  2. Select the service you want to investigate.
  3. Hover your cursor over a method in the flame graph.
  4. Press Opt (on macOS) or Ctrl (on other operating systems) to lock the tooltip so you can interact with its contents.
  5. If prompted, click Connect to preview. The first time you do this for a repository, you will be redirected to GitHub to Authorize the Datadog application.
  6. After authorizing, the source code preview appears in the tooltip.
  7. Click the file link in the tooltip to open the full source code file in your repository.
Source code preview in the Continuous Profiler

You can see links from errors in your Lambda functions’ associated stack traces to their source repository in Serverless Monitoring.

  1. Navigate to Infrastructure > Serverless and click on the AWS tab.
  2. Click on a Lambda function and click the Open Trace button for an invocation with an associated stack trace.
  3. If you’re using the GitHub or GitLab integrations, click Connect to preview on stack frames. You can see inline code snippets directly in the stack trace. Otherwise, you can click the View button on the right of a frame or select View file, View Git blame, or View commit to be redirected to your source code management tool.

You can see links from failed test runs to their source repository in Test Optimization.

  1. Navigate to Software Delivery > Test Optimization > Test Runs and select a failed test run.
  2. If you’re using the GitHub or GitLab integrations, click Connect to preview on stack frames. You can see inline code snippets directly in the stack trace. Otherwise, you can click the View button on the right of a frame or select View file, View Git blame, or View commit to be redirected to your source code management tool.
Link to GitHub from the CI Visibility Explorer

For more information, see Enhancing Developer Workflows with Datadog.

You can see links from failed Static Analysis and Software Composition Analysis scans to their source repository in Code Security.

  1. Navigate to Software Delivery > Code Security and select a repository.
  2. In the Code Vulnerabilities or Code Quality view, click on a code vulnerability or violation. In the Details section, if you’re using the GitHub, GitLab, or Azure DevOps integrations, click Connect to preview. You can see inline code snippets highlighting the exact lines of code that triggered the vulnerability or violation. Otherwise, you can click the View button on the right of a frame or select View file, View Git blame, or View commit to be redirected to your source code management tool.
Link to GitHub from the Code Security Code Vulnerabilities view

For more information, see the Code Security documentation.

You can see links from errors in your security signals’ associated stack traces to their source repository in App and API Protection Monitoring.

  1. Navigate to Security > App and API Protection and select a security signal.
  2. Scroll down to the Traces section on the Related Signals tab and click on an associated stack trace.
  3. If you’re using the GitHub or GitLab integrations, click Connect to preview on stack frames. You can see inline code snippets directly in the stack trace. Otherwise, you can click the View button on the right of a frame or select View file, View Git blame, or View commit to be redirected to your source code management tool.
Link to GitHub from App and API Protection Monitoring

You can see full source code files in Dynamic Instrumentation when creating or editing an instrumentation (dynamic log, metric, span, or span tags).

Create new instrumentation

  1. Navigate to APM > Dynamic Instrumentation.
  2. Select Create New Instrumentation and choose a service to instrument.
  3. Search for and select a source code filename or method.

View or edit instrumentation

  1. Navigate to APM > Dynamic Instrumentation.
  2. Select an existing instrumentation from the list, then click View Events.
  3. Select the instrumentation card to view its location in the source code.
Source Code File in Dynamic Instrumentation

For more information, see the Dynamic Instrumentation documentation.

PR comments

PR comments are not supported in pull requests in public repositories, or on pull requests targeting a destination branch in a different repository from the source branch (that is, forked repositories trying to merge into the main repository).

PR comments are automated comments added by Datadog’s source code management integrations to inform developers of issues detected in their code changes and, in certain cases, suggest remediation.

There is a maximum of 31 unique comments per PR at any time to reduce noise and clutter. These comments include:

  • One summary comment is always posted to give a high-level view of all the issues Datadog detected in the PR. This comment is edited by Datadog as new commits pushed to the PR change the results.
  • When applicable, up to 30 inline comments are posted on specific lines of code that triggered a violation. If more than 30 violations are introduced in the PR’s diff, the 30 highest severity violations are posted.

PR comments are enabled by default when first onboarding to CI Visibility if the GitHub or GitLab integration is installed correctly. These integrations post a comment summarizing the failed jobs detected in your pull request.

PR Comment summarizing failed jobs detected by CI Visibility

To disable PR comments for CI Visibility, go to the CI Visibility Repository Settings.

PR comments are enabled by default when first onboarding to Code Security if the GitHub, GitLab, or Azure DevOps integration is installed correctly. These integrations post two types of comments on your pull requests:

  1. A single comment summarizing the new violations detected in your pull request.
PR Comment summarizing the new violations detected by Code Security
  1. Inline comments for each violation detected in your pull request placed directly on the lines of code that triggered the violation in the diff of the pull request.
Inline comment for a specific violation detected by Code Security

To disable PR comments for Code Security, go to the Code Security Repository Settings.

PR comments are enabled by default when first onboarding to Test Optimization if the GitHub or GitLab integration is installed correctly. The integration posts a comment summarizing the failed and flaky tests detected in your pull request.

PR Comment summarizing failed and flaky tests detected by Test Optimization

To disable PR comments for Test Optimization, go to the Test Optimization Advanced Features Settings.

Further reading