Features of Source Code Integration
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel,
n'hésitez pas à nous contacter.
Overview
After you have connected your Git repositories and tagged your services, you can use source code integration features across various Datadog products.
Links to Git providers & code snippets
You can see links from stack frames to their source repository in Error Tracking.
- Navigate to APM > Error Tracking.
- Click on an issue. The Issue Details panel appears on the right.
- 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.
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.
- Navigate to Digital Experience > Error Tracking.
- Click on an issue. The Issue Details panel appears on the right.
- 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.
You can see source code previews directly in Continuous Profiler flame graphs.
- Navigate to APM > Profiles > Explorer.
- Select the service you want to investigate.
- Hover your cursor over a method in the flame graph.
- Press
Opt (on macOS) or Ctrl (on other operating systems) to lock the tooltip so you can interact with its contents. - 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.
- After authorizing, the source code preview appears in the tooltip.
- Click the file link in the tooltip to open the full source code file in your repository.
You can see links from errors in your Lambda functions’ associated stack traces to their source repository in Serverless Monitoring.
- Navigate to Infrastructure > Serverless and click on the AWS tab.
- Click on a Lambda function and click the Open Trace button for an invocation with an associated stack trace.
- 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.
- Navigate to Software Delivery > Test Optimization > Test Runs and select a failed test run.
- 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.
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.
- Navigate to Software Delivery > Code Security and select a repository.
- 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.
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.
- Navigate to Security > App and API Protection and select a security signal.
- Scroll down to the Traces section on the Related Signals tab and click on an associated stack trace.
- 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 full source code files in Dynamic Instrumentation when creating or editing an instrumentation (dynamic log, metric, span, or span tags).
Create new instrumentation
- Navigate to APM > Dynamic Instrumentation.
- Select Create New Instrumentation and choose a service to instrument.
- Search for and select a source code filename or method.
View or edit instrumentation
- Navigate to APM > Dynamic Instrumentation.
- Select an existing instrumentation from the list, then click View Events.
- Select the instrumentation card to view its location in the source code.
For more information, see the Dynamic Instrumentation documentation.
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.
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:
- A single comment summarizing the new violations detected in your pull request.
- 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.
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.
To disable PR comments for Test Optimization, go to the Test Optimization Advanced Features Settings.
Further reading
Documentation, liens et articles supplémentaires utiles: