fluid-core/schemas/telemetry-envelope.schema.json

114 lines
4.7 KiB
JSON
Raw Normal View History

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://fluid.dev/schemas/telemetry-envelope.schema.json",
"title": "FLUID telemetry envelope",
"description": "The normalized interaction event. Designed for interface learning, not unrestricted behavioral capture: raw payload capture is never the default and redaction happens before an event reaches the store (ArchitectureBlueprint.md section 6.2).",
"type": "object",
"properties": {
"fluid_telemetry": {
"type": "object",
"properties": {
"schema_version": { "$ref": "common.schema.json#/$defs/schemaVersion" },
"id": { "type": "string", "minLength": 1 },
"occurred_at": { "$ref": "common.schema.json#/$defs/timestamp" },
"interface_id": { "$ref": "common.schema.json#/$defs/interfaceId" },
"kind": {
"enum": ["request", "error", "sequence", "adoption", "feedback"],
"description": "ArchitectureBlueprint.md section 6.1."
},
"correlation_id": {
"type": "string",
"description": "Ties an event to the response the consumer saw, and to the other events in its call chain."
},
"consumer_ref": {
"type": "string",
"description": "Pseudonymous and stable. Never a raw end-user identifier."
},
"cohort": { "$ref": "common.schema.json#/$defs/cohortId" },
"revision": { "$ref": "common.schema.json#/$defs/revisionId" },
"experiment": { "oneOf": [{ "$ref": "common.schema.json#/$defs/experimentId" }, { "type": "null" }] },
"resolution": {
"type": "object",
"description": "Why this revision was chosen. Revision resolution must be deterministic and auditable (ArchitectureBlueprint.md section 5.2).",
"properties": {
"reason": {
"enum": ["explicit_revision", "bound_contract", "experiment_assignment", "cohort_rule", "stable_default"]
},
"policy_generation": { "type": "integer", "minimum": 0 }
},
"required": ["reason"],
"additionalProperties": false
},
"request": {
"type": "object",
"properties": {
"operation": { "type": "string" },
"route": { "type": "string" },
"method": { "type": "string" },
"status": { "type": "integer" },
"latency_ms": { "type": "number", "minimum": 0 },
"request_bytes": { "type": "integer", "minimum": 0 },
"response_bytes": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
},
"error": {
"type": "object",
"properties": {
"class": {
"enum": ["validation", "unknown_path", "unknown_field", "unsupported_parameter", "authorization", "backend_failure", "timeout", "policy_rejection"]
},
"detail": { "type": "string", "description": "Redacted. Must not carry backend internals or consumer data." },
"field": { "type": "string" }
},
"required": ["class"],
"additionalProperties": false
},
"sequence": {
"type": "object",
"description": "Interaction topology is often more informative than error counts (ArchitectureBlueprint.md section 6.4).",
"properties": {
"chain_id": { "type": "string" },
"position": { "type": "integer", "minimum": 0 },
"pattern": { "type": "string" },
"repeat_count": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
},
"adoption": {
"type": "object",
"properties": {
"event": { "enum": ["first_use", "continued_use", "migration", "reversion", "deprecation_response"] },
"from_revision": { "oneOf": [{ "$ref": "common.schema.json#/$defs/revisionId" }, { "type": "null" }] }
},
"required": ["event"],
"additionalProperties": false
},
"feedback_ref": { "$ref": "common.schema.json#/$defs/feedbackId" },
"redaction": {
"type": "object",
"description": "What the privacy filter removed. Recorded so analysis knows what it cannot see.",
"properties": {
"applied": { "type": "boolean" },
"rules": { "type": "array", "items": { "type": "string" } }
},
"required": ["applied"],
"additionalProperties": false
}
},
"required": ["schema_version", "id", "occurred_at", "interface_id", "kind"],
"additionalProperties": false
}
},
"required": ["fluid_telemetry"],
"additionalProperties": false
}