{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-sdk-event-batch-schema.json",
  "title": "SdkEventBatch",
  "description": "Event batch serialized by public `LogBrew` SDK transports.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-ingestion-api-openapi.yml#/components/schemas/SdkEventBatch",
  "properties": {
    "client_report": {
      "anyOf": [
        {
          "$ref": "#/$defs/SdkClientReport"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional count of events the SDK dropped before sending them."
    },
    "events": {
      "description": "Ordered SDK events.",
      "items": {
        "$ref": "#/$defs/SdkEvent"
      },
      "type": "array"
    },
    "sdk": {
      "$ref": "#/$defs/SdkEventIdentity",
      "description": "SDK identity shared by the batch."
    }
  },
  "required": [
    "sdk",
    "events"
  ],
  "type": "object",
  "$defs": {
    "SdkClientReport": {
      "description": "Events an SDK dropped locally since its previous acknowledged report.",
      "properties": {
        "dropped_events": {
          "additionalProperties": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "default": {},
          "description": "Dropped event count by reason code, such as `queue_overflow`.\n\nAt most 16 reasons matching `^[a-z][a-z0-9_]{0,63}$`, each counting\n1 to 1,000,000,000 events.",
          "type": "object"
        },
        "report_id": {
          "description": "Stable ID of these counts: 16 to 64 characters matching `^[A-Za-z0-9_-]+$`.\n\nEvery resend of one report ID is counted once, even inside a different batch.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "SdkEvent": {
      "description": "One event emitted by a public `LogBrew` SDK.",
      "properties": {
        "attributes": {
          "additionalProperties": true,
          "description": "Validated event attributes emitted by the SDK.",
          "type": "object"
        },
        "id": {
          "description": "Caller-provided stable event identifier.",
          "type": "string"
        },
        "timestamp": {
          "description": "RFC 3339 event timestamp.",
          "format": "date-time",
          "type": "string"
        },
        "type": {
          "description": "Event category such as `issue`, `log`, `span`, or `action`.",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id",
        "timestamp",
        "attributes"
      ],
      "type": "object"
    },
    "SdkEventIdentity": {
      "description": "Public SDK identity attached to one event batch.",
      "properties": {
        "language": {
          "description": "Runtime language name.",
          "type": "string"
        },
        "name": {
          "description": "SDK package or integration name.",
          "type": "string"
        },
        "version": {
          "description": "SDK semantic version.",
          "type": "string"
        }
      },
      "required": [
        "name",
        "language",
        "version"
      ],
      "type": "object"
    }
  }
}