{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-spike-protection-response-schema.json",
  "title": "SpikeProtectionResponse",
  "description": "Spike protection of one project: hourly ingest limits sized from the plan's monthly\nallowances, so one burst cannot use the month.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-projects-api-openapi.yml#/components/schemas/SpikeProtectionResponse",
  "properties": {
    "active": {
      "description": "Whether the limits refused events in the last hour.",
      "type": "boolean"
    },
    "dropped_events": {
      "description": "Events the limits refused this period, by reason and meter.",
      "items": {
        "$ref": "#/$defs/SpikeDroppedEventsResponse"
      },
      "type": "array"
    },
    "enabled": {
      "description": "Whether the hourly limits apply. The owner can turn them off.",
      "type": "boolean"
    },
    "key_limits": {
      "$ref": "#/$defs/SpikeLimitsResponse",
      "description": "Hourly limits for each ingest key of the project."
    },
    "multiplier": {
      "description": "How many times the default limits the owner allows, 1 to 15.",
      "format": "uint8",
      "maximum": 255,
      "minimum": 0,
      "type": "integer"
    },
    "project_id": {
      "description": "Project identifier.",
      "format": "uuid",
      "type": "string"
    },
    "project_limits": {
      "$ref": "#/$defs/SpikeLimitsResponse",
      "description": "Hourly limits for the whole project."
    }
  },
  "required": [
    "project_id",
    "enabled",
    "multiplier",
    "active",
    "project_limits",
    "key_limits",
    "dropped_events"
  ],
  "type": "object",
  "$defs": {
    "SpikeDroppedEventsResponse": {
      "description": "Events spike protection refused for one reason and meter.",
      "properties": {
        "events": {
          "description": "Refused events. A client that sends a refused batch again counts again.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "last_dropped_at": {
          "description": "Last refusal.",
          "format": "date-time",
          "type": "string"
        },
        "meter": {
          "description": "Meter whose hourly limit was reached, such as `log_bytes`.",
          "type": "string"
        },
        "reason": {
          "description": "Limit that refused them: `key_limit` or `project_limit`.",
          "type": "string"
        }
      },
      "required": [
        "reason",
        "meter",
        "events",
        "last_dropped_at"
      ],
      "type": "object"
    },
    "SpikeLimitsResponse": {
      "description": "Hourly ingest limits per meter, in the meter's units; null when the meter has no limit.",
      "properties": {
        "issue_events": {
          "description": "Issue events per hour.",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "log_bytes": {
          "description": "Log bytes per hour.",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "metric_bytes": {
          "description": "Metric bytes per hour.",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "trace_spans": {
          "description": "Trace spans per hour.",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "issue_events",
        "log_bytes",
        "metric_bytes",
        "trace_spans"
      ],
      "type": "object"
    }
  }
}