EventMetadata

pydantic model safir.metrics.EventMetadata

Common fields for all metrics events.

Contains the minimum required fields. This gets mixed in to a class also containing event payload fields, and then gets shipped to Kafka, by the EventManager

Parameters:

data (Any)

Show JSON schema
{
   "title": "EventMetadata",
   "description": "Common fields for all metrics events.\n\nContains the minimum required fields. This gets mixed in\nto a class also containing event payload fields, and\nthen gets shipped to Kafka, by the ``EventManager``",
   "type": "object",
   "properties": {
      "id": {
         "description": "A globally unique value that identifies this event",
         "format": "uuid4",
         "title": "id",
         "type": "string"
      },
      "app_name": {
         "description": "The application generating this event.",
         "examples": [
            "gafaelfawr",
            "mobu"
         ],
         "title": "App Name",
         "type": "string"
      },
      "timestamp": {
         "description": "The time at which this event occurred, or the time at which this event completed if it is a duration event.",
         "format": "date-time",
         "title": "Timestamp",
         "type": "string"
      },
      "timestamp_ns": {
         "description": "The number of nanoseconds since the unix epoch. This is used as the InfluxDB timestamp.",
         "title": "Timestamp Ns",
         "type": "integer"
      }
   },
   "required": [
      "id",
      "app_name",
      "timestamp",
      "timestamp_ns"
   ]
}

Fields:
field app_name: str [Required]

The application generating this event.

field id: Annotated[UUID] [Required]

A globally unique value that identifies this event

Constraints:
  • uuid_version = 4

field timestamp: AwareDatetime [Required]

The time at which this event occurred, or the time at which this event completed if it is a duration event.

field timestamp_ns: int [Required]

The number of nanoseconds since the unix epoch. This is used as the InfluxDB timestamp.