> For the complete documentation index, see [llms.txt](https://docs.revenium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revenium.io/track-and-control-costs/analyze-ai-tooling-spend/gitlab-integration.md).

# GitLab Integration

Connect your GitLab group to surface merge-request attribution and per-user productivity metrics alongside AI coding assistant usage in Revenium.

GitLab is supported for version-control attribution alongside GitHub. Connecting GitLab to Revenium adds output data — the merge requests your developers ship — to your AI coding metrics. Without a version-control integration, the dashboards measure AI assistant activity: sessions, tokens, cost. With GitLab connected, you can cross-reference that spend against what developers actually deliver, attributing merged merge requests to AI-assisted commits per developer.

Teams that host their code on GitLab now get merge-request attribution and per-user coding metrics, the same way GitHub-hosted teams get pull-request attribution.

## What connecting GitLab adds

Once connected, Revenium builds a per-developer GitLab merge-request table. Each row maps a GitLab user to a Revenium user and shows:

| Column           | Description                                                                               |
| ---------------- | ----------------------------------------------------------------------------------------- |
| **GitLab User**  | The GitLab username the activity belongs to                                               |
| **MRs Merged**   | Total merge requests merged by this user in the selected period                           |
| **MRs with AI**  | Merge requests with a commit message or author email that matches an AI detection pattern |
| **Mapped Email** | The email this GitLab user is mapped to in Revenium, when a mapping is available          |

These let you ask: are high-spend developers also shipping the most? Which developers are getting the most delivered per dollar of AI spend?

{% hint style="info" %}
**MRs with AI is based on detected signatures.** A merge request is counted when at least one of its commits matches a detection pattern. See [AI co-author detection patterns](#ai-co-author-detection-patterns) below. AI-assisted work can be missed when it is committed without a matching signature. A pattern can also match a commit that was not AI-assisted, so review the patterns you configure.
{% endhint %}

## Prerequisites

* A GitLab personal access token with `read_api` and `read_user` scopes
* The GitLab group that contains the projects you want to track
* Developer commit emails that map to Revenium users, so per-developer activity can be attributed

## Setting up the integration

Add GitLab from the Integrations page: open the GitLab card and choose to connect, which opens the **Connect GitLab** dialog. The dialog asks for:

* **Name** — a label for the credential (for example, `my-company-gitlab`).
* **GitLab instance URL** — leave the default for gitlab.com, or enter your self-managed instance URL (for example, `https://gitlab.company.com`).
* **Group path** — the GitLab group containing your repositories (for example, `my-company` or `my-company/engineering`).
* **Personal access token** — a token with `read_api` and `read_user` scopes (`glpat-...`). The token is validated against GitLab before being stored, encrypted at rest, and never returned through the API.
* **Allowed projects** (optional) — restrict the integration to specific projects in `group/project` format, one per line. Leave empty to scan all projects in the group. Useful when your token has broad access but you only want merge-request data from selected projects.
* **AI co-author detection patterns** — see below.

## AI co-author detection patterns

Revenium checks commit messages and author emails for AI detection patterns. A merge request counts toward **MRs with AI** when at least one of its commits matches a configured pattern. The defaults include this Claude Code signature:

```
noreply@anthropic.com
```

Add additional patterns, one per line, if your team uses different signatures.

Attribution depends on Claude Code actually adding its signature to commits, and any engineer can turn that off locally. An organization can enforce that setting centrally instead of relying on each engineer to opt in. See **Integrations > Integrations > GitLab > Reconnect > AI co-author detection patterns** in the product for how.

## Attribution across GitHub and GitLab

Both GitHub and GitLab are supported for version-control attribution. If your developers ship across both, connect each one: GitHub contributes pull-request attribution and GitLab contributes merge-request attribution. Revenium uses available identity and email information to map developers, and you can correct mappings by hand.

## Network requirements

If your self-managed GitLab instance sits behind a firewall or restricts access by IP address, allow every address listed on [Revenium Outbound IP Addresses](/integrations/outbound-ip-addresses.md).

Revenium also needs a hostname for your instance that resolves on public DNS. A hostname that only resolves inside your network, or that points to a private IP address, cannot be reached from Revenium.

Revenium only reads data through GitLab's REST API, whose addresses all start with `/api/v4/`. If you put a proxy or load balancer in front of your instance, you only need to expose that API path to Revenium's outbound addresses. Your GitLab web interface and sign-in pages can stay private.

If you use gitlab.com, you don't need to change anything.

## Troubleshooting

**No GitLab data appears after connecting:**

* The table reads "No GitLab merge request data available for this period" until a sync completes for the selected period — allow time for the initial sync
* Confirm the token is valid and carries the `read_api` and `read_user` scopes
* Confirm the Group path is correct and the token can read that group's projects

**MRs with AI count is lower than expected:**

* A merge request counts when at least one commit message or author email matches an AI detection pattern. Check the commits in those merge requests for matching signatures
* If you set Allowed projects, confirm the merge requests you expect are in the listed projects

**A developer isn't attributed:**

* **Mapped Email** shows the Revenium email linked to a GitLab user. If the user is not mapped automatically, check the mapping and assign their corporate email if needed


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.revenium.io/track-and-control-costs/analyze-ai-tooling-spend/gitlab-integration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
