Help build the future of open source observability software Open positions

Check out the open source projects we support Downloads

The actually useful free plan

Grafana Cloud Free Tier
check

10k series Prometheus metrics

check

50GB logs, 50GB traces, 50GB profiles

check

500VUk k6 testing

check

20+ Enterprise data source plugins

check

100+ pre-built solutions

Featured webinar

Getting started with grafana LGTM stack

Getting started with managing your metrics, logs, and traces using Grafana

Learn how to unify, correlate, and visualize data with dashboards using Grafana.

A serverless approach to CI/CD observability with GitLab and Grafana

A serverless approach to CI/CD observability with GitLab and Grafana

2025-10-10 6 min

In today’s fast-paced development environment, it’s critical that you understand what’s happening in your CI/CD pipeline. And yet, many teams struggle with fragmented tooling that makes it difficult to get a holistic view of their dev lifecycle. 

For example, if you’re using GitLab for CI/CD and Grafana for observability, you’ve probably faced this challenge: how do you bring your GitLab events into your existing observability and alerting infrastructure?

That’s exactly the problem I set out to solve when I created lambda-gitlab-loki—a lightweight, serverless open source project that bridges GitLab webhooks with Grafana Cloud Logs, which is powered by Grafana Loki, our open source log aggregation system.

The problem with isolated CI/CD visibility

Most development teams today use different tools for different aspects of their workflow. GitLab excels at source control and CI/CD, while Grafana provides unparalleled observability dashboards and alerting. However, these tools often operate in silos.

When issues arise, teams find themselves switching between multiple interfaces:

  • Checking GitLab for pipeline status
  • Looking at application metrics in Grafana
  • Reviewing infrastructure logs in yet another tool
  • Manually correlating deployment events in Gitlab with performance changes in Grafana 

This fragmentation reduces visibility into your CI/CD pipeline trends and patterns and slows incident response because you can’t quickly correlate deployment events with system behavior. You’re also left making manual correlations between code changes and system metrics, and you’ll likely end up with alert fatigue from all these disconnected monitoring systems.

How unified observability bridges the gap

Lambda-gitlab-loki leverages the strengths of both platforms while connecting them seamlessly. By using GitLab webhooks and Grafana Cloud, we can create a unified observability experience that provides a number of benefits.

Real-time pipeline monitoring

Every GitLab event—from pushes and merge requests to pipeline completions and deployments—flows directly into Loki as structured logs. This means you can:

  • Monitor pipeline success/failure rates in real-time
  • Track deployment frequency and timing
  • Correlate code changes with system performance
  • Set up alerts for failed builds or unusual deployment patterns

Powerful LogQL queries

With GitLab events stored in Grafana Cloud, you can use LogQL to slice and dice your CI/CD data:

logql
sum by (project_name) (
  count_over_time(
    {job="gitlab-webhook"} 
    | json 
    | object_kind="pipeline" 
    | object_attributes_status="success"[24h]
  )
)

Contextual dashboards

You can also create Grafana dashboards that combine application metrics with CI/CD events. Imagine seeing:

  • Application response times with deployment markers
  • Error rates correlated with specific commits
  • Resource usage trends alongside release velocity
  • Team productivity metrics derived from GitLab activity

I chose AWS Lambda for this integration for several reasons:

  • Cost efficiency: Most GitLab webhooks are infrequent events. With Lambda’s pay-per-execution model, you only pay for actual webhook processing. For typical development teams, this often means costs under $1 per month.
  • Zero infrastructure management: No servers to maintain, no scaling concerns, no security patches to apply. Lambda handles all the operational overhead, letting you focus on deriving insights from your data.
  • Built-in reliability: Lambda provides automatic retry logic, scaling, and monitoring. Your webhook processing becomes as reliable as AWS’ infrastructure.
  • Easy Integration: The serverless approach makes integration straightforward—just point your GitLab webhook at an API Gateway endpoint, and you’re done.

Improve alerting, trend analysis, incident response, and compliance

Once your GitLab events flow into Grafana Cloud, a world of possibilities opens up:

  • Advanced alerting: Set up alerts in Grafana Alerting for pipelines that fail repeatedly, unusually long build times, deployment frequency dropping below thresholds, and specific types of GitLab events (like force pushes to main).
  • Trend analysis: Understand your development patterns, such as team activity, changes in deployment frequency, the busiest times of day for CI/CD activity, and variations in pipeline durations by project.
  • Incident response: Quickly correlate data to resolve incidents faster. For example, you could combine data that pertains to when your last successful deployment was, which commits were included in your recent releases, which pipelines failed around the incident, and how current metrics compare to previous deployment periods.
  • Compliance and reporting: Generate reports on deployment frequency for audit purposes, change failure rates and recovery times, developer productivity metrics, release cadence across different projects, and more.

How to get started

The beauty of this approach lies in its simplicity. You can have GitLab events flowing into Grafana Cloud in under 30 minutes:

1. Deploy the Lambda function with your Grafana Cloud credentials.

2. Create an API Gateway endpoint to receive webhooks.

3. Configure GitLab webhooks to point to your endpoint.

4. Start building dashboards with your new GitLab data stream.

The entire solution consists of just 69 lines of Python code, yet it unlocks powerful observability capabilities that would otherwise require complex, expensive enterprise solutions. (You can find the full step-by-step instructions here.)

Note: I recommend using Grafana Cloud with Lambda-gitlab-loki because you don’t have to manage any of the underlying infrastructure. We even have a generous forever-free tier. However, the steps outlined here can be used with open source Loki, too. 

Lessons learned, and the future of CI/CD observability

Building this integration taught me several important lessons about modern observability:

  • Webhooks are powerful: GitLab’s webhook system is incredibly comprehensive, providing detailed payloads for virtually every action in your development workflow. This richness makes it an ideal data source for observability tools.
  • Structured logging wins: By treating CI/CD events as structured logs rather than traditional metrics, we gain the flexibility to query and aggregate data in ways that weren’t predefined. Loki’s label-based approach makes this particularly powerful.
  • Serverless fits perfectly: Event-driven architectures like webhook processing are perfect fits for serverless computing. The natural mapping between webhooks and function invocations creates an elegant, scalable solution.

This integration represents a broader trend toward unified observability. As development teams adopt cloud-native practices, the lines between application monitoring, infrastructure observability, and CI/CD tracking continue to blur.

By connecting GitLab and Grafana, we’re not just solving a technical integration challenge—we’re enabling a more holistic approach to understanding our development process. When CI/CD events become first-class citizens in our observability stack, we can build more reliable systems, respond to incidents faster, and make data-driven decisions about our development practices.

Try it yourself

Whether you’re troubleshooting CI/CD issues, wanting better visibility into your development process, or looking to correlate deployments with system behavior, this open source project provides a solid foundation for CI/CD observability.

If you’re ready to try it out, start small—set up the basic webhook integration and create a simple dashboard showing pipeline success rates. Then expand from there by adding alerts, correlating with application metrics, and building the solution your team needs.

The lambda-gitlab-loki project is available on GitHub with complete setup instructions, deployment guides, and example dashboards. Join the growing community of teams using Grafana and GitLab together for better CI/CD observability.

And if you’re looking for more ways to use Grafana with GitLab, check out our enterprise plugin for tracking GitLab statistics or our integration with pre-built alerts and a dashboard for monitoring GitLab. 

Grafana Cloud is the easiest way to get started with metrics, logs, traces, dashboards, and more. We have a generous forever-free tier and plans for every use case. Sign up for free now!

Tags