Send GitLab events to Tinybird¶
GitLab is a platform for building and deploying web applications. By integrating GitLab with Tinybird, you can analyze your GitLab events in real time and enrich it with other data sources.
Some common use cases for sending GitLab events to Tinybird include:
- Analyze GitLab issues and merge requests.
- Analyze GitLab push events.
- Analyze and monitor GitLab pipeline.
- Analyze custom DORA metrics.
All this allows you to build a more complete picture of your GitLab events and improve your DevOps processes.
Read on to learn how to send events from GitLab to Tinybird.
Before you start¶
Before you connect GitLab to Tinybird, ensure:
- You have a GitLab account.
- You have a Tinybird Workspace.
Connect GitLab to Tinybird¶
In GitLab, go to Settings > Webhooks.
Select Add new webhook.
Webhooks payloads vary depending on the event type. You can check here the list of GitLab events.
Select Issues Events.
- In Tinybird, create a Data Source, called
gitlab
. You can follow this schema:
SCHEMA > `event_time` DateTime `json:$.tinybirdIngestTime` DEFAULT now(), `event_type` String `json:$.object_kind` DEFAULT 'unknown', `event` JSON `json:$` DEFAULT '{}' ENGINE "MergeTree" ENGINE_PARTITION_KEY "toYYYYMM(event_time)" ENGINE_SORTING_KEY "event_time"
Using the JSON Data Type you can store the semi-structured data you receive from GitLab in a single column. You can later retrieve various events and their metadata as needed in your Pipes.
The JSON
data type is in private beta. If you are interested in using this type, contact Tinybird at support@tinybird.co or in the Community Slack.
In Tinybird, copy a token with privileges to append to the Data Source you created. You can use the admin token or create one with the required scope.
Back in GitLab, paste the Events API URL in your Webhook URL. Use the query parameter
name
to match the name of the Data Source you created in Tinybird.
https://api.tinybird.co/v0/events?name=gitlab
Replace the Tinybird API hostname or region with the API region that matches your Workspace.
- Select Add custom header and add 'Authorization' as Header name and paste the token you created in Tinybird as Header value.
Bearer <your user token>
- You're done. You can select Test to check if the webhook is working.
Check the status of the integration from the Log tab in the Tinybird gitlab
Data Source.