Skip to content

fleXRPL/datadog-dashboard-deployer

Repository files navigation

DataDog Dashboard Deployer

A powerful framework for deploying DataDog dashboards as code using CI/CD pipelines. Define, version, and automate your DataDog dashboard deployments using YAML configurations.

versions

PyPI version PyPI version Python

health

Quality Gate Status Overall Coverage Security Rating Maintainability Rating Vulnerabilities Dependabot Status Code style: black

stats

Downloads License: MIT

Features

  • πŸš€ Configuration as Code: Define dashboards using YAML configuration files
  • πŸ”„ Automated Deployment: Deploy dashboards automatically via GitHub Actions
  • πŸ“Š Rich Widget Support: Support for timeseries, query values, heatmaps, and more
  • πŸ” Secure Credentials: Handle DataDog API credentials securely
  • 🎨 Templating Support: Create dynamic dashboards using Jinja2 templating
  • πŸ”Œ Extensible Architecture: Easy to extend and customize

Quick Start

Installation

pip install datadog-dashboard-deployer

Basic Usage

  1. Set up your DataDog credentials:
export DATADOG_API_KEY='your-api-key'
export DATADOG_APP_KEY='your-application-key'
  1. Create a dashboard configuration:
# config/dashboard_config.yaml
version: "1.0"
dashboards:
  - name: "System Overview"
    description: "System performance metrics"
    widgets:
      - title: "CPU Usage"
        type: "timeseries"
        query: "avg:system.cpu.user{*}"
      - title: "Memory Usage"
        type: "timeseries"
        query: "avg:system.mem.used{*}"
  1. Deploy your dashboard:
datadog-dashboard-deploy config/dashboard_config.yaml

Project Structure

datadog-dashboard-deployer/
β”œβ”€β”€ src/
β”‚   └── datadog_dashboard_deployer/
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ core.py       # Core logic for dashboard creation
β”‚       β”œβ”€β”€ config.py     # Configuration handling
β”‚       └── utils.py      # Utility functions
β”œβ”€β”€ config/
β”‚   └── dashboard_config.yaml  # Main dashboard configuration
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── deploy.yml      # GitHub Actions workflow
β”œβ”€β”€ tests/                  # Test suite
β”œβ”€β”€ docs/                   # Documentation
β”œβ”€β”€ requirements.txt        # Project dependencies
β”œβ”€β”€ setup.py               # Package configuration
└── README.md

Documentation

GitHub Actions Integration

  1. Add DataDog credentials as secrets:

    • Go to repository Settings > Secrets and Variables > Actions
    • Add DATADOG_API_KEY and DATADOG_APP_KEY
  2. Create a workflow file:

# .github/workflows/deploy.yml
name: Deploy Dashboards
on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.x"
      - name: Deploy dashboards
        env:
          DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
          DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY }}
        run: |
          pip install datadog-dashboard-deployer
          datadog-dashboard-deploy config/dashboard_config.yaml

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Clone the repository:
git clone https://github.com/fleXRPL/datadog-dashboard-deployer.git
cd datadog-dashboard-deployer
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install development dependencies:
pip install -r requirements-dev.txt

Security

  • API keys are stored securely as environment variables or GitHub secrets
  • Regular security audits and dependency updates
  • See our Security Policy for details

Support

License

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

Acknowledgments

Packages

No packages published