GitLab plugin

For more information about what this plugin does and the data streams it retrieves, see:

GitLab

Monitor the CI/CD metrics from your GitLab environment.

How to add a GitLab data source

To create an API token key:

  1. Access a GitLab account with access to the target projects.
  2. Navigate to https://gitlab.com/-/profile/personal_access_tokens.
  3. Ensure the access is at least read_api and read_repository. Please note, read_user and read_registry are optional.
  4. Click the Create personal access token button.
  5. Copy the provided API token.

Now use the API token to configure the data source in SquaredUp:

  1. To add a data source click on the + next to Data Sources on the left-hand menu in SquaredUp. Search for the data source and click on it to open the Configure data source page.

  2. Display Name:

    Enter a name for your data source. This helps you to identify this data source in the list of your data sources.

  3. Instance URL:
    Enter a URL if you wish to use your own instance of GitLab.

    If you leave this section blank, https://gitlab.com will be used by default.

  4. API Token:
    Paste the API token in here.
  5. Optionally, select whether you would like to restrict access to this data source instance. By default, restricted access is set to off.

  6. Click Test and add to validate the data source configuration.

    You can also add a data source from Settings > Data Sources > Add data source, but sample dashboards are not added when using this method.

Using the GitLab data streams

Data streams are installed with the data source

GQL Query

The GitLab data source allows you to set up configurable data streams for any kind of GQL query. If you need help using GQL, please refer to: GraphQL

  1. Scope to an object that supports a GQL query.
  2. Select + GQL Query from the data stream list.
  3. Enter a Display Name for the new data stream.
  4. Query:
    Enter a GQL query.
  5. RowPath:
    Optional, focus on results within the GQL query. Target on the array of data that you want to display. For example: projects.nodes.
  6. Click Save.

This example query shows you how to get the details about the current user, the groups it has access to and the project IDs in those groups.

query{
  currentUser{
    groups{
      nodes
      {
        projects {
          edges {
            node {
              id
              name
            }
          }
        }
        fullName
        id
      }
      
    }
    name
    id
  }
}

You’ll need to inform the cloud platform where the rows start. It must be a value returned as an array, such as edges (in the above example) or nodes.

You can use mustache to alter the query with values from the scope.

Was this article helpful?


Have more questions or facing an issue?