# Monitoring Configuration Schema
# Common schema for metrics, health checks, and observability

{
  # Supported metric exporters

  # Supported health check types

  MonitoringConfig = {
    # Enable monitoring
    enabled | Bool | default = false,

    # Metrics Collection
    metrics | {
      # Enable metrics collection
      enabled | Bool | default = false,

      # Collection interval in seconds
      interval | Number | optional,

      # Exporter type(s)
      exporters | Array String | optional,

      # Prometheus endpoint path
      prometheus_path | String | optional,

      # Metrics retention in days
      retention_days | Number | optional,

      # Buffer size for metrics
      buffer_size | Number | optional,
    } | optional,

    # Health Checks
    health_check | {
      # Enable health checks
      enabled | Bool | default = false,

      # Health check type
      type | String | optional,

      # Check interval in seconds
      interval | Number | optional,

      # Health check timeout in milliseconds
      timeout | Number | optional,

      # Unhealthy threshold (consecutive failures)
      unhealthy_threshold | Number | optional,

      # Healthy threshold (consecutive successes)
      healthy_threshold | Number | optional,

      # Health check endpoint/path
      endpoint | String | optional,
    } | optional,

    # Distributed Tracing
    tracing | {
      # Enable tracing
      enabled | Bool | default = false,

      # Trace sample rate (0.0-1.0)
      sample_rate | Number | optional,

      # Tracing backend (jaeger, zipkin, etc.)
      backend | String | optional,

      # Trace exporter endpoint
      endpoint | String | optional,
    } | optional,

    # Alerting
    alerting | {
      # Enable alerting
      enabled | Bool | default = false,

      # Alert rules file path
      rules_path | String | optional,

      # Alert notification channels
      channels | Array String | optional,
    } | optional,

    # Resource Monitoring
    resources | {
      # Monitor CPU usage
      cpu | Bool | default = false,

      # Monitor memory usage
      memory | Bool | default = false,

      # Monitor disk usage
      disk | Bool | default = false,

      # Monitor network I/O
      network | Bool | default = false,

      # Alert thresholds (percentage)
      alert_threshold | Number | optional,
    } | optional,
  },
}
