---
title: GitLab Source Code
description: >-
  GitLab is a web-based hosting service for software development projects that
  use the Git revision control system.
breadcrumbs: Docs > Integrations > GitLab Source Code
---

# GitLab Source Code
Integration version1.0.0
{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com



{% alert level="warning" %}
The GitLab Source Code integration is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site) ().
{% /alert %}


{% /callout %}

## Overview{% #overview %}

Integrate Datadog with your GitLab projects to streamline troubleshooting of code issues and get suggested changes on your source code.

Get context-relevant code snippets while investigating issues in Error Tracking, Continuous Profiler, Code Security, and many more areas within Datadog.

Protect your production code base with merge request comments from Code Security, Test Optimization, and CI Visibility that provide automated code reviews and suggested changes.

### GitLab instances{% #gitlab-instances %}

Using the GitLab Source Code integration, connect your GitLab.com or GitLab Self-Managed instance to Datadog to enable source code functionality and monitor your GitLab environment. Manage your GitLab instances through the [Configuration tab](https://app.datadoghq.com/integrations/gitlab-source-code/?integrationId=gitlab-source-code&subPath=configuration) to get started.



### Source code functionality{% #source-code-functionality %}

When installed with the correct scopes, this integration powers [source code integration](https://docs.datadoghq.com/integrations/guide/source-code-integration/) features across Datadog to help you troubleshoot and take action on your code:

- See code snippets in your stack traces to identify where code problems originate. This can speed up investigations in Error Tracking, Continuous Profiler, Dynamic Instrumentation, and Live Debugger.
- Streamline code reviews with automated feedback and suggested changes from [CI Visibility](https://docs.datadoghq.com/integrations/guide/source-code-integration/?tab=civisibility#pr-comments), [Code Security](https://docs.datadoghq.com/security/code_security/dev_tool_int/github_pull_requests/), and [Test Optimization](https://docs.datadoghq.com/continuous_integration/guides/pull_request_comments/), posted directly on merge requests.
- Access multiple service definitions in GitLab from the [Software Catalog](https://docs.datadoghq.com/service_catalog/adding_metadata/#store-and-edit-definitions-in-github).

### GitLab pipelines{% #gitlab-pipelines %}

For more in-depth monitoring of your GitLab pipelines, check out [CI Pipeline Visibility](https://app.datadoghq.com/ci/getting-started). CI Pipeline Visibility provides granular insights into your user workflow, lets you access detailed Git metadata, and tracks pipeline performance over time.

## Setup{% #setup %}

{% alert level="info" %}
Some features require additional setup beyond installing the GitLab Source Code integration. Installing the integration to connect your GitLab groups and projects to Datadog only grants the scopes and roles that features require as prerequisites. It doesn't enable any billable functionality by default, and you won't incur additional charges unless you explicitly configure a paid feature.
{% /alert %}

1. In the [GitLab Source Code integration tile](https://app.datadoghq.com/integrations/gitlab-source-code/), navigate to the **Configuration** tab.
1. Click **Connect GitLab Instance**.
1. Under **Confirm Prerequisites**, select **GitLab.com** or **Self-Managed**:
   - **GitLab.com**: Select **Connect your GitLab account** and authorize Datadog to access your GitLab account.
   - **Self-Managed**: Enter your **GitLab Host Name**, and click **Verify Ingress** to confirm that Datadog servers can connect to your GitLab instance. For server IPs, see the Webhooks section of [IP Ranges](https://docs.datadoghq.com/api/latest/ip-ranges/).
1. Under **Perform Actions in GitLab**, click **Datadog Integration** to open integration settings in GitLab.
1. In GitLab, enter all relevant information to connect to Datadog. This integration ingests GitLab webhooks into Datadog. Optionally, you can also enable CI Visibility here.
1. Click **Save changes**, then **Return to Datadog**.
1. (Optional) In Datadog, click **Token Settings** to return to GitLab. Clear the **Service account token expiration** setting to allow long-lived tokens, which you'll need in the next step. Click **Return to Datadog**.
1. In Datadog, under **Create Service Account**, click **Service Accounts** to go to the service account settings in GitLab. Create a service account with the scopes listed in Datadog. Copy the **Secret Access Token** and paste it into Datadog to register the account.
1. (Self-Managed only) Create an OAuth application on your GitLab instance:
   1. Under **Create OAuth App**, click **Applications** to open GitLab's Application settings.
   1. Create an application with the scopes listed in Datadog, then copy and paste the **Name**, **ID**, and **Secret** into Datadog.
   1. Select **Connect your GitLab account** and authorize Datadog to access your GitLab account.
1. Select **GitLab Groups** and/or **GitLab Projects** to add the service account to at least one group or project. Make sure the service account has the Developer role.
1. Click **Return to Datadog**, then **Finish**.

After setup, you're returned to your original location in Datadog. To enable inline code snippets in APM, [set up Source Code Integration](https://docs.datadoghq.com/integrations/guide/source-code-integration/).

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

GitLab Source Code does not include any metrics.

### Events{% #events %}

GitLab Source Code does not include any events.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
