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. So it's recommended to select one event type and create a Tinybird Data Source for it.
Select Issues Events.
- In Tinybird, create a Data Source, called
gitlab_work_item
. You can follow this schema
Some columns use the JSON Data Type to store the semi-structured data you receive from GitLab webhooks in a single column. You can later retrieve various events and their metadata as needed in your Pipes.
Some other columns are a JSON string. Use the JSONExtract functions to extract the data you need in your Pipes.
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_work_item
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_work_item
Data Source.
You can add more GitLab Webhooks to Tinybird by following the same steps. Find here some more GitLab schemas.