Code suggestions

  • Tier: Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

Code suggestions is a data source that provides aggregated metrics about GitLab Duo Code Suggestions usage across your project or group.

Allowed modes

Allowed scopes

ScopeDescription
projectQuery code suggestions in a specific project.
groupQuery code suggestions across all projects in a group, including subgroups.

Query fields

FieldName (and alias)Operators
IDE nameideName=, in
Languagelanguage=, in
Timestamptimestamp=, >, <, >=, <=
Useruser=, in

IDE name

Description: Filter by the IDE used to generate suggestions.

Allowed value types:

  • String
  • List (use in operator for multiple values)

Language

Description: Filter by the programming language of the suggestion.

Allowed value types:

  • String
  • List (use in operator for multiple values)

Timestamp

Description: Filter by when the suggestion was generated. Use range operators to define a time window.

Allowed value types:

  • AbsoluteDate (in the format YYYY-MM-DD)
  • RelativeDate (in the format <sign><digit><unit>, where sign is +, -, or omitted, digit is an integer, and unit is one of d (days), w (weeks), m (months) or y (years))

User

Description: Filter by the user who received the suggestion.

Allowed value types:

  • Number (user ID)
  • List (use in operator for multiple user IDs)

Support for username filtering is being tracked in issue 599750.

Dimensions

The following dimensions are supported:

DimensionName (and alias)Description
IDE nameideNameGroup by IDE used (for example, VSCode, JetBrains).
LanguagelanguageGroup by programming language.
TimestamptimestampGroup by date.
UseruserGroup by user (displays avatar, name, and username).

Metrics

The following metrics are supported:

MetricName (and alias)Description
Acceptance rateacceptanceRateRatio of accepted to shown suggestions.
Accepted countacceptedCountNumber of accepted suggestions.
Rejected countrejectedCountNumber of rejected suggestions.
Shown countshownCountNumber of suggestions shown to users.
Suggestion size sumsuggestionSizeSumTotal volume of suggestions.
Total counttotalCountTotal number of suggestions.
Users countusersCountNumber of unique users.

Examples

  • Acceptance rate by language for the last 30 days:

    ```glql
    display: table
    mode: analytics
    query: type = CodeSuggestion and timestamp >= -30d
    dimensions: language as "Language"
    metrics: totalCount as "Total", acceptanceRate as "Acceptance Rate"
    sort: acceptanceRate desc
    ```
  • Usage by IDE:

    ```glql
    display: table
    mode: analytics
    query: type = CodeSuggestion and timestamp >= -30d
    dimensions: ideName as "IDE"
    metrics: totalCount as "Total Suggestions", usersCount as "Active Users"
    sort: totalCount desc
    ```
  • Overall metrics without grouping:

    ```glql
    display: table
    mode: analytics
    query: type = CodeSuggestion and timestamp >= -30d
    metrics: totalCount as "Total", acceptedCount as "Accepted", rejectedCount as "Rejected", shownCount as "Shown", acceptanceRate as "Acceptance Rate"
    ```
  • Suggestions per user for a specific project, filtered to Ruby:

    ```glql
    display: table
    mode: analytics
    query: type = CodeSuggestion and timestamp >= -30d and language = "ruby"
    dimensions: user as "User"
    metrics: totalCount as "Total", acceptanceRate as "Acceptance Rate"
    sort: totalCount desc
    limit: 10
    ```
  • Suggestions over time by language in a date range:

    ```glql
    display: table
    mode: analytics
    query: type = CodeSuggestion and timestamp >= "2026-01-01" and timestamp <= "2026-03-31"
    dimensions: timestamp as "Date", language as "Language"
    metrics: totalCount as "Total", acceptanceRate as "Acceptance Rate"
    sort: timestamp desc
    ```
  • Filter to specific IDEs and languages:

    ```glql
    display: table
    mode: analytics
    query: type = CodeSuggestion and timestamp >= -7d and ideName in ("Visual Studio Code", "RubyMine") and language in ("ruby", "python")
    dimensions: ideName as "IDE", language as "Language"
    metrics: totalCount as "Total", acceptanceRate as "Rate"
    sort: totalCount desc
    ```