Skip to content

About

ServerlessPulse collects events from GitHub's public events API, stores raw files in Google Cloud Storage (GCS), loads data into BigQuery, transforms it with dbt, and presents insights in a three-page Looker Studio dashboard. Cloud Run Jobs, Cloud Workflows, and Cloud Scheduler automate the pipeline

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

3 Commits

Folders and files

Repository files navigation

โšก ServerlessPulse

Smart GitHub Analytics Pipeline

Python Google Cloud BigQuery dbt Docker Looker Studio

An end-to-end data engineering portfolio project: GitHub Public Events API โ†’ GCS โ†’ BigQuery โ†’ dbt โ†’ Looker Studio

๐Ÿ“Š Live dashboard: https://datastudio.google.com/reporting/2e818060-5605-4271-b210-12f480cc8903

๐Ÿ‘ค Author: Hemang Joshi ยท GitHub ยท LinkedIn


ServerlessPulse collects events from GitHub's public events API, stores raw files in Google Cloud Storage (GCS), loads data into BigQuery, transforms it with dbt, and presents insights in a three-page Looker Studio dashboard. Cloud Run Jobs, Cloud Workflows, and Cloud Scheduler automate the pipeline.

Warning

Data-scope warning: Metrics represent observed public GitHub events collected by ServerlessPulse during the selected period. They do not represent all GitHub activity or all GitHub developers. GitHub's public events API is a limited, changing feed, not a complete historical archive.

๐Ÿ“‘ Contents

๐Ÿ” Project overview

ServerlessPulse explores observed public GitHub events to understand event types, repository activity, and activity patterns over time. It demonstrates API ingestion, raw-file landing storage, data warehousing, SQL transformations, testing, cloud orchestration, and dashboard delivery.

โœจ Key features

  • Python ingestion from the GitHub Public Events API.
  • Hourly automated runs: Cloud Scheduler triggers Cloud Workflows every hour (UTC) to fetch new events, then refresh the dbt models, so the dashboard
    stays current without manual work.
  • Bounded pagination, retries for selected transient errors, rate-limit logging, and event-ID deduplication within an ingestion run.
  • JSON, NDJSON, and run-metadata files stored in GCS.
  • BigQuery RAW, staging, and analytics layers.
  • dbt models for event-level, hourly, repository-level, and event-type analysis.
  • pytest unit tests and configured dbt data tests.
  • Dockerized Cloud Run Jobs orchestrated by Cloud Workflows and Cloud Scheduler.
  • Interactive Overview, Repository, and Developer dashboard pages.

๐Ÿ—๏ธ Architecture

ServerlessPulse architecture

Data path

flowchart LR
    A[GitHub Public Events API] --> B[Python ingestion]
    B --> C[Cloud Storage: JSON, NDJSON, metadata]
    C --> D[BigQuery RAW]
    D --> E[dbt staging view]
    E --> F[dbt analytics models]
    F --> G[Looker Studio dashboard]
Loading

Automation path

flowchart TD
    A[Cloud Scheduler<br/>hourly UTC] --> B[Cloud Workflows]
    B --> C[Cloud Run ingestion job]
    C --> D[Cloud Run dbt job]
    D --> E[BigQuery analytics refreshed]
Loading

Ingestion and dbt are separate Cloud Run Jobs. The workflow coordinates ingestion first, then transformation. Retry and failure behavior is defined in the deployed workflow.

๐Ÿ“Š Dashboard showcase

The Looker Studio report has three pages with a dark, GitHub-inspired theme and an original project logo. The project is independent and is not affiliated with GitHub.

Live dashboard: https://datastudio.google.com/reporting/2e818060-5605-4271-b210-12f480cc8903

Overview

Overview dashboard

  • KPIs: Total Observed Events, Active Repositories, Active Developers, and Events per Active Hour.
  • Charts: observed events over time, event mix, event-type table with heatmap, and an hour-by-weekday UTC heatmap.
  • Controls: Event and Weekday.
  • Default date window: last 30 days.

Repository

Repository dashboard

  • KPIs: Repositories Observed, Organizations, Events per Repository, and Repeat Repositories.
  • Charts/tables: top 10 repositories by events, top 10 organizations by events, newly observed repositories per day, and repository details with clickable GitHub links.
  • Controls: searchable Organization and Repository dropdowns.

Developer

Developer dashboard

  • KPIs: Active Developers, Peak Developers / Hour, Bot Accounts, and Bot Share of Events.
  • Charts: active developers per hour, human-versus-bot event mix, event groups by developer type, and average developers by UTC hour.
  • Default date window: last 7 days.

๐Ÿงฐ Technology stack

Area Technologies
Language / ingestion Python 3.11, Requests; Pandas where used
Cloud Google Cloud Platform
Storage Google Cloud Storage
Warehouse BigQuery
Transformations dbt Core, dbt-bigquery
Containers Docker, Artifact Registry
Execution Cloud Run Jobs
Orchestration Cloud Workflows, Cloud Scheduler
Visualization Looker Studio
Testing pytest, configured dbt tests
Tools Git, GitHub, Google Cloud CLI, BigQuery CLI

๐Ÿ”„ Pipeline and storage

  1. Python fetches events from the GitHub Public Events API.
  2. The client uses bounded pagination, selected transient-error retries, and API/rate-limit logging.
  3. Event IDs are deduplicated within the current ingestion run.
  4. The job creates JSON, NDJSON, and run metadata files.
  5. Files are uploaded to GCS.
  6. NDJSON is loaded into the BigQuery RAW table using the configured schema.
  7. dbt structures fields in staging and builds analytical models.
  8. Python and dbt tests validate configured behaviors and data assumptions.
  9. Looker Studio visualizes the BigQuery data.
  10. Cloud Scheduler triggers Cloud Workflows, which runs ingestion before dbt.

โ˜๏ธ Google Cloud resources

Resource Name
Project serverlesspulse
Region asia-south1
GCS bucket gs://serverlesspulse-raw-85927034024
RAW table serverlesspulse.serverlesspulse_raw.github_events_raw
Staging view serverlesspulse.serverlesspulse_staging.stg_github_events
Main fact serverlesspulse.serverlesspulse_analytics.fct_github_events
Ingestion job serverlesspulse-ingestion-job
dbt job serverlesspulse-dbt-job
Workflow serverlesspulse-pipeline
Scheduler serverlesspulse-dbt-hourly
Artifact Registry asia-south1-docker.pkg.dev/serverlesspulse/serverlesspulse-dbt

The scheduler runs on 0 * * * * in Etc/UTC, meaning hourly at minute 00 UTC.

๐Ÿ—‚๏ธ GCS hierarchy

gs://serverlesspulse-raw-85927034024/
โ””โ”€โ”€ github_events/
    โ””โ”€โ”€ ingestion_date=YYYY-MM-DD/
        โ””โ”€โ”€ hour=HH/
            โ”œโ”€โ”€ github_events_YYYYMMDD_HHMMSS.json
            โ”œโ”€โ”€ github_events_YYYYMMDD_HHMMSS.ndjson
            โ””โ”€โ”€ github_events_YYYYMMDD_HHMMSS_metadata.json

Files follow this naming convention; individual runs may not produce identical sets of files.

  • github_events/: root prefix for event data.
  • ingestion_date=YYYY-MM-DD/: groups objects by ingestion date.
  • hour=HH/: groups objects by ingestion hour.
  • .json: event payload in JSON format.
  • .ndjson: one JSON record per line, suitable for BigQuery loading.
  • _metadata.json: run metadata generated by the ingestion process.

GCS is the raw-file storage layer; BigQuery is the warehouse used for SQL analysis. To inspect the bucket:

gcloud storage ls gs://serverlesspulse-raw-85927034024/
gcloud storage ls --recursive gs://serverlesspulse-raw-85927034024/github_events/

๐Ÿงฑ BigQuery and dbt models

Dataset layers

serverlesspulse
โ”œโ”€โ”€ serverlesspulse_raw
โ”‚   โ””โ”€โ”€ github_events_raw
โ”œโ”€โ”€ serverlesspulse_staging
โ”‚   โ””โ”€โ”€ stg_github_events [VIEW]
โ””โ”€โ”€ serverlesspulse_analytics
    โ”œโ”€โ”€ fct_github_events
    โ”œโ”€โ”€ fct_hourly_activity
    โ”œโ”€โ”€ dim_repositories
    โ”œโ”€โ”€ agg_repository_activity
    โ””โ”€โ”€ agg_event_type_trends
  • RAW: ingested source records and event payload.
  • STAGING: cleaned and structured fields; stg_github_events is a view.
  • ANALYTICS: models intended for analysis and dashboard use.
Model Materialization Purpose
stg_github_events View Extracts useful fields from raw JSON and structures IDs, types, actors, repositories, organizations, and timestamps.
fct_github_events Incremental table Main event-level analytical dataset; uses event_id as its unique key.
fct_hourly_activity Table Hourly event counts and distinct actors/repositories.
dim_repositories Table Repository attributes, organization where available, counts, and first/last observed timestamps.
agg_repository_activity Table Repository event counts, unique actors, and push/create/delete counts.
agg_event_type_trends Table Event counts grouped by event date and event type.

Model flow

github_events_raw
       |
       v
stg_github_events
       |
       v
fct_github_events ---> Overview and developer event analysis

stg_github_events
       |----> fct_hourly_activity
       |----> dim_repositories
       |----> agg_repository_activity
       โ””----> agg_event_type_trends

Important

Distinct counts (actors, repositories) cannot be summed across hourly buckets to get overall distinct totals.

๐Ÿงฎ Dashboard calculations

The dashboard uses these calculated fields:

  • Hour of Day: hour extracted from created_at or activity_hour.
  • Weekday: weekday number and short label, sorted Monday through Sunday.
  • Event Group: Push, Create, Delete, Pull request, Other.
  • Developer Type: Bot when actor_login ends in [bot]; otherwise Human.
  • Bot Accounts / Bot Share of Events: bot-account count and proportion of events classified as bot events.
  • Repository Link: clickable URL to the public GitHub repository.
  • Events per Repository / Repeat Repositories / Organization Name: repository-level calculations and display fields.

Date fields such as created_at, first_observed_at, and activity_hour are retyped as date/time fields for grouping.

๐Ÿš€ Setup and execution

Prerequisites

  • Python 3.11 and Git.
  • Google Cloud CLI.
  • A Google Cloud project with billing enabled and appropriate IAM access.
  • Docker if building/testing containers locally.
  • Looker Studio access to reproduce or edit the report.

Official documentation: Python ยท Git ยท Google Cloud CLI ยท BigQuery ยท Cloud Run Jobs ยท dbt BigQuery setup ยท Looker Studio

Clone and install

git clone https://github.com/Hemang648/serverlesspulse.git
cd serverlesspulse

Windows CMD virtual environment:

py -3.11 -m venv .venv
.venv\Scripts\activate

Install dependencies if requirements.txt exists:

python -m pip install --upgrade pip
pip install -r requirements.txt

Authenticate for local development:

gcloud auth login
gcloud config set project serverlesspulse
gcloud config set run/region asia-south1
gcloud auth application-default login

Tip

Use least-privilege access. Do not download or commit service-account private keys for convenience.

Python tests

python -m pytest

dbt commands

Run from the directory containing dbt_project.yml, after configuring a local dbt profile:

dbt debug
dbt run --select stg_github_events
dbt run --select fct_github_events
dbt run
dbt test
  • dbt debug checks project/profile configuration and connectivity.
  • Selecting stg_github_events builds the staging view.
  • Selecting fct_github_events builds or updates the fact model according to its materialization.
  • dbt run runs models according to project configuration and dependencies.
  • dbt test runs tests defined in the project.

Keep local profile files such as profiles.yml out of version control.

๐Ÿšข Deployment and orchestration

The pipeline is deployed as two separate container images: Dockerfile.ingestion for ingestion and a dbt Dockerfile for transformation.

Deployment sequence:

  1. Build the appropriate image.
  2. Tag it with the Artifact Registry path.
  3. Push it to Artifact Registry.
  4. Update the corresponding Cloud Run Job.
  5. Run a manual job execution and inspect logs.
  6. Execute the workflow and verify ingestion completes before dbt starts.
  7. Confirm analytics reflects the latest RAW batch.

Do not rebuild the dbt image when only ingestion code changes.

Inspect scheduler and workflow history:

gcloud scheduler jobs describe serverlesspulse-dbt-hourly --location=asia-south1
gcloud workflows executions list projects/serverlesspulse/locations/asia-south1/workflows/serverlesspulse-pipeline --limit=5

Review Cloud Run and Workflows logs when troubleshooting.

โœ… Validation

Validate each layer independently:

Layer What to check
Python pytest output
GCS Expected JSON, NDJSON, and metadata objects exist
RAW Latest batch row counts and event IDs
dbt Run results and configured data tests
Analytics Compare latest ingestion timestamps in RAW and analytics
Orchestration Scheduler configuration and recent Workflow execution states
Dashboard Refresh the report, check data sources and date controls, and test its viewer link privately

โš ๏ธ Limitations and data quality

Warning

Data Scope: Metrics represent observed public GitHub events collected by ServerlessPulse during the selected period. They do not represent all GitHub activity or all GitHub developers.

  • Limited source history: The public events API is a changing, limited feed, not a complete historical archive. The oldest returned event does not prove continuous coverage from that date.
  • Bounded pagination: The client fetches up to 10 pages per run; this does not guarantee complete historical coverage.
  • Deduplication scope: Event IDs are deduplicated within one ingestion run. The RAW table uses append behavior, so duplicates across runs may exist unless downstream logic removes them.
  • Incremental model: fct_github_events is incremental with event_id as its unique key, so repeated IDs and null keys are worth testing.
  • Bot definition: An account is classified as a bot when actor_login ends in [bot], a naming convention used by automation accounts such as Dependabot or GitHub Actions. These are apps that run automatically, not people. This rule misses bots that do not use that suffix and may not identify every automation account correctly.
  • Repository identity: Grouping only by repository name can combine different repositories with the same name. Prefer a stable repository ID or owner/name key where available.
  • Missing fields: Some events may not have actor, repository, or organization details.
  • Partial days: The latest day may contain only partial data; spikes and daily totals require care.
  • Newly observed is not created: The dashboard records when the pipeline first observed a repository, not when it was created.
  • UTC: Time-based dashboard titles specify UTC.
  • Quiet periods: A quiet day may reflect a collection gap rather than no GitHub activity.

๐Ÿ” Security

Before making the repository public:

  • Do not commit .env files, service-account JSON keys, tokens, local dbt profiles, or other secrets.
  • Review .gitignore, .dockerignore, tracked files, and commit history.
  • Prefer attached service accounts and Application Default Credentials over downloaded private keys.
  • Grant only required IAM permissions; do not use broad Owner/Editor roles as a shortcut.
  • Check Looker Studio data-source credentials before enabling public viewing.
  • Remember that a public dashboard can expose public repository and organization names.
Example ignore rules (adapt to the actual project)
.venv/
venv/
__pycache__/
.pytest_cache/
*.py[cod]
.env
.env.*
!.env.example
profiles.yml
.user.yml
target/
dbt_packages/
logs/
raw_data/
*.key
*service-account*.json

Caution

Ignoring a file does not remove it from Git history if it was committed previously. Review existing commits before publishing.

๐Ÿ› ๏ธ Troubleshooting and costs

Troubleshooting table
Symptom Checks
Authentication failure Check gcloud auth list and gcloud config list.
Permission denied Verify the runtime identity and minimum required IAM permissions.
Bucket/dataset not found Check project, bucket, dataset, and location names.
BigQuery schema mismatch Inspect the actual table schema and compare it with the load config and dbt SQL.
Cloud Run image pull failure Confirm image path/tag and Artifact Registry permissions.
Container startup failure Review Cloud Run logs, command, dependencies, and environment configuration.
dbt profile failure Check dbt_project.yml, local profile path, adapter, and region.
dbt tests fail Inspect failing rows, nulls, unique-key assumptions, and incremental behavior.
Workflow fails Identify the failing step and inspect the corresponding job logs.
GitHub rate limit Review rate-limit logs and the configured retry behavior.
Docker build/push failure Confirm Docker is running, authentication, project/region, and repository name.

๐Ÿ’ฐ Costs

Potential charges include BigQuery storage/query processing, Cloud Run executions, Workflows, Scheduler, Artifact Registry, GCS storage/operations, and logging.

  • Set billing budgets and alerts.
  • Monitor query and storage usage.
  • Avoid unnecessary full refreshes.
  • Disable scheduled runs when not needed.
  • Review resources before leaving the project running.
  • Verify targets before destructive cleanup; deleting buckets, tables, or images can permanently remove data.

๐Ÿ“ Repository structure

serverlesspulse/
โ”œโ”€โ”€ ingestion/
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ github_client.py
โ”‚   โ”œโ”€โ”€ bigquery_loader.py
โ”‚   โ””โ”€โ”€ storage_uploader.py
โ”œโ”€โ”€ dbt_project/
โ”‚   โ”œโ”€โ”€ dbt_project.yml
โ”‚   โ””โ”€โ”€ models/
โ”‚       โ”œโ”€โ”€ staging/
โ”‚       โ””โ”€โ”€ analytics/
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_github_client.py
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ architecture.png
โ”‚   โ”œโ”€โ”€ architecture.mmd
โ”‚   โ”œโ”€โ”€ dashboard-overview.png
โ”‚   โ”œโ”€โ”€ dashboard-repository.png
โ”‚   โ””โ”€โ”€ dashboard-developer.png
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ Dockerfile.ingestion
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ workflow.yaml
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .dockerignore
โ””โ”€โ”€ README.md

Do not commit local virtual environments, generated event dumps, caches, or credential-bearing profile files.

๐Ÿ”ฎ Future improvements

Potential next steps:

  • Robust cross-run deduplication.
  • Better backfill support where a suitable historical source exists.
  • More orchestration retries, alerts, and pipeline-health monitoring.
  • Broader data-quality checks and CI testing.
  • Partitioning/clustering where justified by workload.
  • Stable repository identity handling.
  • Bot classification beyond the [bot] suffix heuristic.
  • Dashboard data-freshness and pipeline-health indicators.
  • A daily developer aggregate if distinct-developer trend queries become expensive.

๐Ÿ“„ License and contact

No license has been selected yet.

This is an independent portfolio project using public GitHub event data and Google Cloud services. It is not affiliated with, endorsed by, or sponsored by GitHub, Google Cloud, or Looker Studio. All names and marks belong to their respective owners.


About

ServerlessPulse collects events from GitHub's public events API, stores raw files in Google Cloud Storage (GCS), loads data into BigQuery, transforms it with dbt, and presents insights in a three-page Looker Studio dashboard. Cloud Run Jobs, Cloud Workflows, and Cloud Scheduler automate the pipeline

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages