Kong · Schema

Metering Event

Metering event following the CloudEvents specification.

API GatewayAI GatewayAI ConnectivityAgent GatewayEvent GatewayMCP RegistryService MeshLLMKafkaKonnectOpen Source

Properties

Name Type Description
id string Identifies the event.
source string Identifies the context in which an event happened.
specversion string The version of the CloudEvents specification which the event uses.
type string Contains a value describing the type of event related to the originating occurrence.
datacontenttype string Content type of the CloudEvents data value. Only the value "application/json" is allowed over HTTP.
dataschema string Identifies the schema that data adheres to.
subject string Describes the subject of the event in the context of the event producer (identified by source).
time string Timestamp of when the occurrence happened. Must adhere to RFC 3339.
data object The event payload. Optional, if present it must be a JSON object.
View JSON Schema on GitHub

JSON Schema

kong-meteringevent-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/MeteringEvent",
  "title": "Metering Event",
  "description": "Metering event following the CloudEvents specification.",
  "type": "object",
  "properties": {
    "id": {
      "description": "Identifies the event.",
      "type": "string",
      "example": "5c10fade-1c9e-4d6c-8275-c52c36731d3c",
      "minLength": 1
    },
    "source": {
      "description": "Identifies the context in which an event happened.",
      "type": "string",
      "format": "uri-reference",
      "example": "service-name",
      "minLength": 1
    },
    "specversion": {
      "description": "The version of the CloudEvents specification which the event uses.",
      "type": "string",
      "example": "1.0",
      "default": "1.0",
      "minLength": 1
    },
    "type": {
      "description": "Contains a value describing the type of event related to the originating occurrence.",
      "type": "string",
      "example": "com.example.someevent",
      "minLength": 1
    },
    "datacontenttype": {
      "description": "Content type of the CloudEvents data value. Only the value \"application/json\" is allowed over HTTP.",
      "type": "string",
      "example": "application/json",
      "enum": [
        "application/json"
      ],
      "nullable": true
    },
    "dataschema": {
      "description": "Identifies the schema that data adheres to.",
      "type": "string",
      "format": "uri",
      "minLength": 1,
      "nullable": true
    },
    "subject": {
      "description": "Describes the subject of the event in the context of the event producer (identified by source).",
      "type": "string",
      "example": "customer-id",
      "minLength": 1
    },
    "time": {
      "description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339.",
      "type": "string",
      "format": "date-time",
      "example": "2023-01-01T01:01:01.001Z",
      "nullable": true,
      "title": "RFC3339 Date-Time"
    },
    "data": {
      "description": "The event payload.\nOptional, if present it must be a JSON object.",
      "type": "object",
      "additionalProperties": {},
      "nullable": true
    }
  },
  "example": {
    "specversion": "1.0",
    "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3c",
    "source": "service-name",
    "type": "prompt",
    "subject": "customer-id",
    "time": "2023-01-01T01:01:01.001Z",
    "data": {
      "prompt": "Hello, world!",
      "tokens": 100,
      "model": "gpt-4o",
      "type": "input"
    }
  },
  "required": [
    "id",
    "source",
    "specversion",
    "type",
    "subject"
  ]
}