# ==============================================================================
# ADTLAS DAI MANAGEMENT SYSTEM - GRAFANA DASHBOARD PROVISIONING
# ==============================================================================
#
# This file configures automatic dashboard provisioning for Grafana,
# loading pre-built dashboards for the Adtlas DAI Management System.
#
# Features:
# - Automatic dashboard loading on startup
# - Organized dashboard folders
# - Version control integration
# - Update policies and permissions
#
# Author: Adtlas Development Team
# Version: 2.0.0
# Last Updated: 2025-01-20
# ==============================================================================

apiVersion: 1

# ==============================================================================
# DASHBOARD PROVIDERS CONFIGURATION
# ==============================================================================

providers:
  # ==============================================================================
  # ADTLAS SYSTEM OVERVIEW DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-overview'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/overview
    folder: 'Adtlas Overview'
    folderUid: 'adtlas-overview'
  
  # ==============================================================================
  # INFRASTRUCTURE MONITORING DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-infrastructure'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/infrastructure
    folder: 'Infrastructure'
    folderUid: 'adtlas-infrastructure'
  
  # ==============================================================================
  # APPLICATION MONITORING DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-application'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/application
    folder: 'Application'
    folderUid: 'adtlas-application'
  
  # ==============================================================================
  # DATABASE MONITORING DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-database'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/database
    folder: 'Database'
    folderUid: 'adtlas-database'
  
  # ==============================================================================
  # BUSINESS METRICS DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-business'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/business
    folder: 'Business Metrics'
    folderUid: 'adtlas-business'
  
  # ==============================================================================
  # SECURITY MONITORING DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-security'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/security
    folder: 'Security'
    folderUid: 'adtlas-security'
  
  # ==============================================================================
  # ALERTING AND MONITORING DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-alerting'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/alerting
    folder: 'Alerting'
    folderUid: 'adtlas-alerting'
  
  # ==============================================================================
  # LOGS AND TRACING DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-logs'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/logs
    folder: 'Logs & Tracing'
    folderUid: 'adtlas-logs'
  
  # ==============================================================================
  # DEVELOPMENT AND TESTING DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-development'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/development
    folder: 'Development'
    folderUid: 'adtlas-development'
  
  # ==============================================================================
  # EXTERNAL INTEGRATIONS DASHBOARDS
  # ==============================================================================
  
  - name: 'adtlas-integrations'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    allowUiUpdates: true
    options:
      path: /etc/grafana/provisioning/dashboards/integrations
    folder: 'External Integrations'
    folderUid: 'adtlas-integrations'

# ==============================================================================
# DASHBOARD PROVISIONING CONFIGURATION NOTES
# ==============================================================================
#
# This configuration provides:
# 1. Organized dashboard folders by functional area
# 2. Automatic loading of JSON dashboard files
# 3. Regular update checking for dashboard changes
# 4. UI update permissions for dashboard customization
# 5. Folder-based organization for easy navigation
#
# Dashboard Organization:
# 1. Adtlas Overview - High-level system status and KPIs
# 2. Infrastructure - Server, network, and container metrics
# 3. Application - Django application performance and errors
# 4. Database - PostgreSQL and Redis performance
# 5. Business Metrics - Revenue, campaigns, ad serving
# 6. Security - Authentication, authorization, and threats
# 7. Alerting - Alert status and notification tracking
# 8. Logs & Tracing - Log analysis and distributed tracing
# 9. Development - Development environment metrics
# 10. External Integrations - Third-party service monitoring
#
# Provider Configuration:
# - type: file - Load dashboards from filesystem
# - disableDeletion: false - Allow dashboard deletion via UI
# - updateIntervalSeconds: 30 - Check for updates every 30 seconds
# - allowUiUpdates: true - Allow dashboard editing via UI
#
# Dashboard File Structure:
# /etc/grafana/provisioning/dashboards/
# ├── overview/           # System overview dashboards
# ├── infrastructure/     # Infrastructure monitoring
# ├── application/        # Application performance
# ├── database/          # Database monitoring
# ├── business/          # Business metrics
# ├── security/          # Security monitoring
# ├── alerting/          # Alert management
# ├── logs/              # Log analysis
# ├── development/       # Development metrics
# └── integrations/      # External services
#
# Dashboard Development:
# 1. Create dashboards in Grafana UI
# 2. Export as JSON files
# 3. Place in appropriate folder
# 4. Grafana will auto-load on next scan
# 5. Version control dashboard JSON files
# 6. Use consistent naming conventions
#
# Best Practices:
# 1. Use descriptive dashboard names
# 2. Include documentation in dashboard descriptions
# 3. Use consistent time ranges and refresh intervals
# 4. Implement proper variable usage for filtering
# 5. Create drill-down capabilities between dashboards
# 6. Use appropriate visualization types for data
# 7. Include alert annotations on relevant panels
# 8. Optimize queries for performance
#
# Folder Permissions:
# - Folders can have specific permissions set
# - Control access based on user roles
# - Separate sensitive dashboards appropriately
# - Use service accounts for automated access
#
# Update Policies:
# - updateIntervalSeconds controls scan frequency
# - Lower values provide faster updates but more I/O
# - Balance between responsiveness and performance
# - Consider file system performance characteristics
# ==============================================================================