Skip to main content

Granyt SDK for Apache Airflow - Automatic lineage tracking and error monitoring

Project description

Granyt Logo

MIT License PyPI Version Build Status Airflow Support

Granyt

Modern, open source Airflow monitoring with error tracking, metrics, and alerts that actually understand your pipelines. Self-hosted. 5 minutes to deploy.

FeaturesWhy Granyt?Quick Start


Granyt Dashboard


Features

  • DAG Monitoring: Know when pipelines break before downstream teams do. Track run history, duration trends, and success rates.
  • Smart Alerts: Get notified when your BigQuery job returns 0 rows instead of finding out from your CEO on Monday. Schema changes, row count drops, failures: all covered.
  • Sentry-like Error Tracking: Stack traces with DAG context, not just Python tracebacks. Errors grouped by fingerprint so you see patterns, not noise.
  • Automatic Metrics: Snowflake query stats, BigQuery bytes scanned, dbt test results - captured automatically from your existing operators.
  • Multi-Environment: Compare errors across dev, staging, and prod without switching tabs or grep-ing through logs.
  • Self-Hosted: Your data never leaves your infrastructure. No $2k/month observability bill. MIT licensed.

Why Granyt?

The Airflow UI shows you what happened. Granyt tells you what went wrong.

If you've ever:

  • Discovered a DAG failed because someone asked "why is the dashboard empty?"
  • Spent 20 minutes clicking through task logs to find the actual error
  • Wished Sentry understood that dag_id and task_id matter
  • Set up Grafana dashboards that nobody looks at

...then you know why generic monitoring tools don't cut it for data pipelines.

Granyt is built specifically for Airflow. It speaks DAG, not just HTTP status codes.


Architecture

Granyt consists of three parts:

  • Frontend: Next.js 15 web application
  • SDK: Airflow pip package for capturing metrics and errors
  • PostgreSQL Database

Quick Start

Get from zero to monitoring in under 5 minutes. No credit card, no sales call, no "contact us for pricing."

1. Deploy the Granyt App

The easiest way to run Granyt is using Docker:

# Clone the repository
git clone https://github.com/jhkessler/getgranyt.git
cd getgranyt

# Create a .env file with required variables
cat > .env << EOF
POSTGRES_PASSWORD=$(openssl rand -hex 24)
BETTER_AUTH_SECRET=$(openssl rand -hex 32)
BETTER_AUTH_URL=http://localhost:3000
EOF

# Build and start with Docker Compose
docker compose -f docker/docker-compose.yml --env-file .env up --build -d

Open http://localhost:3000 and create your account.

For production deployment with prebuilt images, Kubernetes, and more options, see the Deployment Guide.

2. Install the SDK in Airflow

The Granyt SDK is a lightweight Python listener that must be installed where your Airflow workers and scheduler run. It automatically captures DAG and task execution events and sends them to your Granyt dashboard.

Install the SDK in your Airflow environment's Python (e.g., add to your requirements.txt or install directly in your Airflow container/virtualenv):

pip install granyt-sdk

3. Configure the SDK

Set environment variables in your Airflow environment:

export GRANYT_ENDPOINT="https://granyt.yourdomain.com"
export GRANYT_API_KEY="your-api-key"  # Get this from the Granyt dashboard

That's it! The SDK automatically captures task events and errors from your DAGs.


Capture metrics from Popular Operators

Granyt works with the Airflow lifecycle to automatically capture metrics from popular operators. Need support for a custom operator? You can easily build and register your own adapters to extract any metadata you need. Learn more in our docs.

Supported Operators include:

Category Operators
SQL & Warehouses Snowflake, BigQuery, Redshift, Postgres
Cloud Storage AWS S3, Google Cloud Storage, Azure Blob
Transformation dbt Cloud, dbt Core, Spark, Bash

Custom Metrics in Python Tasks

You can emit custom metrics in your python tasks by returning a granyt key in your task's return value.

from granyt_sdk import compute_df_metrics

@task
def transform_data():
    # Load raw data
    df_raw = pd.read_sql("SELECT * FROM raw_events", conn)

    return {
        "granyt": {
            # pass the number of rows to the special "row_count" key to get anomaly warnings
            "row_count": len(df_raw),
            # add custom metrics you want to track
            "high_value_orders": (df_raw["amount"] > 1000).sum()
        }
    }

For deep data insights, use compute_df_metrics. It automatically calculates row counts, null counts, and column types from your Pandas or Polars DataFrames. Pass the result to granyt["df_metrics"] to get schema change detection and rich metrics:

from granyt_sdk import compute_df_metrics

@task
def transform_data():
    df = pd.read_parquet("data.parquet")
    
    return {
        "granyt": {
            # automatically captures schema and df metadata
            "df_metrics": compute_df_metrics(df),
            "data_quality_passed": True
        }
    }

Proactive Data Alerts

Granyt automatically monitors your pipelines and alerts you when data anomalies occur.

Built-in Alert Types:

Alert Type What It Detects
Schema Change Columns added, removed, or data types changed (requires df_metrics key)
Row Count Drop Sudden drops in row count compared to historical baseline (requires row_count or df_metrics key)
Null Occurrence Columns that historically never had nulls now contain null values (requires df_metrics key)

You can also set up custom alerts for your own metrics in the dashboard.


Contact


License

This project is licensed under the MIT License - see the LICENSE file for details.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

granyt_sdk-0.1.2.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

granyt_sdk-0.1.2-py3-none-any.whl (64.7 kB view details)

Uploaded Python 3

File details

Details for the file granyt_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: granyt_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for granyt_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5e0e30fd3e5e384b0ad08cd4bff53ebded0e388e7c830810c1d942a11a8f04cb
MD5 387cc57ac0995fba4e2f3760fc8cd33f
BLAKE2b-256 7d6f82aab0f7141eece5052e7431a8afd2ac8879d40b0ba0539d6e351154a7cf

See more details on using hashes here.

File details

Details for the file granyt_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: granyt_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for granyt_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9c644ba5d94cf092deb56e7f570e9f18668759141cc2606af490e38cfae644e2
MD5 9784b0539f336437a62fde09288fcc76
BLAKE2b-256 9685630957484df58b891b49cb4705e6cc3ff47084c0619d2d9ba34789fe0ece

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page