View all connectors

GitLab Duo

DX does not offer a managed GitLab Duo connector. GitLab exposes Duo usage through its GraphQL API, so pull the data from GitLab on a schedule and import it into DX through one of the two routes below.

Note: An earlier version of this page described a manual CSV export as the only option, because GitLab had no usage API at the time. GitLab now exposes Duo usage through the AiMetrics, AiUserMetrics, and AiUsageData APIs. For availability, ClickHouse requirements, and field definitions, see GitLab Duo and SDLC trends and the GitLab GraphQL API reference.

Whichever route you choose, DX matches records on email address. GitLab returns username for every user but publicEmail only when the user has set one, so plan to resolve usernames to corporate emails from your identity provider.

Choosing an import method

The two routes are not equivalent. DX ships a built-in GitLab Duo tool that reads from one specific table, custom.gitlab_duo_daily_usages. Records pushed through aiToolMetrics land in bespoke_ai_tool_daily_metrics instead and register as a separate tool.

Method What it gives you
Custom table named custom.gitlab_duo_daily_usages Enables DX’s built-in GitLab Duo tool, which is what populates the GitLab Duo usage level attribute described in Custom user attributes. DX reads only date, email, and is_active from this table, so it cannot carry cost or token data.
aiToolMetrics API Accepts spend_cents and token counts, so Duo usage can appear in AI cost management. Creates its own tool entry and AI usage attribute under the tool name you send, not the built-in GitLab Duo usage level attribute.

Pick the custom table if you want the built-in attribute. Pick aiToolMetrics if you want Duo in cost reporting.

Note: Use one route, not both. DX creates its built-in tool as soon as custom.gitlab_duo_daily_usages has at least one row, and creates a separate tool for every distinct tool value in bespoke_ai_tool_daily_metrics. Loading the same Duo activity through both routes registers it as two tools, and AI usage attributes treats usage in two tools as stronger than the same usage in one — moderate usage in two tools is classified as heavy. Renaming the API tool does not help, because the double attribution comes from there being two tools at all, not from the names matching. If you already run both, hide one of them so it is excluded from the combined AI usage level.

Using the custom table

Create the table with a DX database user that has write access. The name must be exactly custom.gitlab_duo_daily_usages — DX looks for that table by name, and the built-in tool stays disabled if it is absent or empty.

CREATE TABLE custom.gitlab_duo_daily_usages (
    id SERIAL PRIMARY KEY,
    date DATE NOT NULL,
    email CHARACTER VARYING(256),
    is_active BOOLEAN NOT NULL
);

DX reads only date, email, and is_active. Add any other columns you want for your own Data Studio queries — they are ignored by the built-in tool, which is why Duo is scored on active days rather than tokens or spend in AI usage attributes.

To keep GitLab’s detailed per-feature counts without affecting attributes, load them into a custom table under a different name. Only the exact name custom.gitlab_duo_daily_usages registers an AI tool. See Custom tables for the custom schema, indexing, and loading options.

Using the aiToolMetrics API

Each record is one user, one date, one tool. Set tool to GitLab Duo and keep it consistent, since DX creates one tool per distinct string and changing it later splits your history. Set is_active to true when the user had any Duo activity that day, and put GitLab’s per-feature counts in the metrics JSON object.

Use aiToolMetrics.pushAll to submit a day of records in one request, or aiToolMetrics.push for a single record. Both methods, including the full field list and example payloads, are documented under aiToolMetrics.

Records are queryable in bespoke_ai_tool_daily_metrics through Data Studio right away, and can take up to an hour to appear in reports outside Data Studio.

Next steps

  • AI usage attributes — how DX turns imported AI tool data into usage levels.
  • AI cost management — what spend_cents and token counts unlock.
  • GitLab — connect GitLab itself for merge request, commit, and pipeline data.