Current section
Files
Jump to
Current section
Files
priv/schema/observer_cli.cli.v1.schema.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/zhongwencool/observer_cli/v2.0.0/priv/schema/observer_cli.cli.v1.schema.json",
"title": "observer_cli CLI response",
"description": "Public structured response contract for observer_cli term and JSON output.",
"type": "object",
"required": [
"schema",
"command",
"outcome",
"data",
"meta",
"issues"
],
"additionalProperties": false,
"properties": {
"schema": {
"const": "observer_cli.cli/v1"
},
"command": {
"type": [
"string",
"null"
]
},
"outcome": {
"enum": [
"complete",
"partial",
"error"
]
},
"data": {
"type": [
"object",
"null"
]
},
"meta": {
"$ref": "#/$defs/meta"
},
"issues": {
"type": "array",
"items": {
"$ref": "#/$defs/issue"
}
}
},
"allOf": [
{
"if": {
"properties": {
"outcome": {
"enum": [
"complete",
"partial"
]
}
},
"required": [
"outcome"
]
},
"then": {
"properties": {
"data": {
"type": "object"
}
}
}
},
{
"if": {
"properties": {
"outcome": {
"const": "complete"
}
},
"required": [
"outcome"
]
},
"then": {
"properties": {
"issues": {
"not": {
"contains": {
"type": "object",
"required": [
"severity"
],
"properties": {
"severity": {
"const": "error"
}
}
}
}
}
}
}
},
{
"if": {
"properties": {
"outcome": {
"const": "partial"
}
},
"required": [
"outcome"
]
},
"then": {
"properties": {
"meta": {
"type": "object",
"properties": {
"target": {
"$ref": "#/$defs/target"
},
"capture": {
"$ref": "#/$defs/capture"
}
}
},
"issues": {
"not": {
"contains": {
"type": "object",
"required": [
"severity"
],
"properties": {
"severity": {
"const": "error"
}
}
}
}
}
}
}
},
{
"if": {
"properties": {
"outcome": {
"const": "error"
},
"data": {
"type": "null"
}
},
"required": [
"outcome",
"data"
]
},
"then": {
"properties": {
"issues": {
"contains": {
"type": "object",
"required": [
"severity"
],
"properties": {
"severity": {
"const": "error"
}
}
},
"minContains": 1
}
}
}
},
{
"if": {
"properties": {
"outcome": {
"const": "error"
},
"data": {
"type": "object"
}
},
"required": [
"outcome",
"data"
]
},
"then": {
"properties": {
"meta": {
"type": "object",
"properties": {
"target": {
"$ref": "#/$defs/target"
},
"capture": {
"$ref": "#/$defs/capture"
}
}
}
}
}
},
{
"if": {
"properties": {
"command": {
"enum": [
"snapshot",
"diagnose",
"memory",
"schedulers",
"distribution",
"processes",
"applications",
"ets",
"mnesia",
"network",
"ports",
"sockets",
"process",
"port",
"otp_state",
"supervision_tree",
"logs",
"trace_call",
"trace_stop_all"
]
},
"data": {
"type": "object"
}
},
"required": [
"command",
"data"
]
},
"then": {
"properties": {
"meta": {
"type": "object",
"properties": {
"target": {
"$ref": "#/$defs/target"
},
"capture": {
"$ref": "#/$defs/capture"
}
}
}
}
}
}
],
"oneOf": [
{
"$ref": "#/$defs/contextCommand"
},
{
"$ref": "#/$defs/snapshotDiagnosticCommand"
},
{
"$ref": "#/$defs/vmHealthCommand"
},
{
"$ref": "#/$defs/resourceListCommand"
},
{
"$ref": "#/$defs/resourceDetailCommand"
},
{
"$ref": "#/$defs/traceCommand"
},
{
"$ref": "#/$defs/logsCommand"
},
{
"$ref": "#/$defs/preCommandError"
}
],
"$defs": {
"meta": {
"type": "object",
"required": [
"target",
"capture"
],
"additionalProperties": false,
"properties": {
"target": {
"oneOf": [
{
"$ref": "#/$defs/target"
},
{
"type": "null"
}
]
},
"capture": {
"oneOf": [
{
"$ref": "#/$defs/capture"
},
{
"type": "null"
}
]
}
}
},
"target": {
"type": "object",
"required": [
"node",
"otp_release"
],
"additionalProperties": false,
"properties": {
"node": {
"type": "string",
"minLength": 1
},
"otp_release": {
"type": "string",
"pattern": "^[1-9][0-9]*$"
}
}
},
"capture": {
"type": "object",
"required": [
"started_at",
"finished_at",
"duration_ms",
"probes",
"observer_effects"
],
"additionalProperties": false,
"properties": {
"started_at": {
"type": "string",
"format": "date-time"
},
"finished_at": {
"type": "string",
"format": "date-time"
},
"duration_ms": {
"type": "integer",
"minimum": 0
},
"probes": {
"type": "array",
"items": {
"$ref": "#/$defs/probe"
}
},
"observer_effects": {
"type": "array",
"items": {
"type": "object"
}
}
}
},
"probe": {
"type": "object",
"required": [
"id",
"required",
"status",
"reason_code",
"duration_ms",
"samples",
"coverage"
],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"minLength": 1
},
"required": {
"type": "boolean"
},
"status": {
"enum": [
"ok",
"unavailable",
"timeout",
"error"
]
},
"reason_code": {
"type": [
"string",
"null"
]
},
"duration_ms": {
"type": "integer",
"minimum": 0
},
"samples": {
"type": "integer",
"minimum": 0
},
"coverage": {
"type": "array",
"items": {
"type": "string"
}
}
},
"oneOf": [
{
"properties": {
"status": {
"const": "ok"
},
"reason_code": {
"type": "null"
}
}
},
{
"properties": {
"status": {
"enum": [
"unavailable",
"timeout",
"error"
]
},
"reason_code": {
"type": "string",
"minLength": 1
}
}
}
]
},
"issue": {
"type": "object",
"required": [
"severity",
"class",
"reason_code",
"message"
],
"additionalProperties": false,
"properties": {
"severity": {
"enum": [
"warning",
"error"
]
},
"class": {
"enum": [
"argument",
"format",
"capability",
"safety_refusal",
"controller",
"distribution",
"connection",
"cleanup",
"schema",
"internal",
"required_probe",
"partial"
]
},
"reason_code": {
"type": "string",
"minLength": 1
},
"message": {
"type": [
"string",
"null"
]
}
}
},
"contextCommand": {
"oneOf": [
{
"required": [
"command"
],
"properties": {
"command": {
"const": "connect"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/contextData"
},
{
"type": "null"
}
]
}
},
"allOf": [
{
"if": {
"properties": {
"data": {
"type": "object"
}
},
"required": [
"data"
]
},
"then": {
"properties": {
"outcome": {
"const": "complete"
},
"meta": {
"type": "object",
"properties": {
"target": {
"$ref": "#/$defs/target"
},
"capture": {
"type": "null"
}
}
}
}
}
}
]
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "status"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/contextData"
},
{
"type": "null"
}
]
}
},
"allOf": [
{
"if": {
"properties": {
"data": {
"type": "object"
}
},
"required": [
"data"
]
},
"then": {
"properties": {
"outcome": {
"const": "complete"
},
"meta": {
"type": "object",
"properties": {
"target": {
"$ref": "#/$defs/target"
},
"capture": {
"type": "null"
}
}
}
}
}
}
]
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "disconnect"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/disconnectData"
},
{
"type": "null"
}
]
}
},
"allOf": [
{
"if": {
"properties": {
"data": {
"type": "object"
}
},
"required": [
"data"
]
},
"then": {
"properties": {
"outcome": {
"const": "complete"
},
"meta": {
"type": "object",
"properties": {
"target": {
"type": "null"
},
"capture": {
"type": "null"
}
}
}
}
}
}
]
}
]
},
"snapshotDiagnosticCommand": {
"oneOf": [
{
"required": [
"command"
],
"properties": {
"command": {
"const": "snapshot"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/snapshotData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "diagnose"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/diagnoseData"
},
{
"type": "null"
}
]
}
}
}
]
},
"vmHealthCommand": {
"oneOf": [
{
"required": [
"command"
],
"properties": {
"command": {
"const": "memory"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/memoryData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "schedulers"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "distribution"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/distributionData"
},
{
"type": "null"
}
]
}
}
}
]
},
"resourceListCommand": {
"oneOf": [
{
"required": [
"command"
],
"properties": {
"command": {
"const": "processes"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "applications"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "ets"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "mnesia"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "network"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "ports"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "sockets"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
}
]
},
"resourceDetailCommand": {
"oneOf": [
{
"required": [
"command"
],
"properties": {
"command": {
"const": "process"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "port"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/statusData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "otp_state"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/supervisionTreeData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "supervision_tree"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/supervisionTreeData"
},
{
"type": "null"
}
]
}
}
}
]
},
"traceCommand": {
"oneOf": [
{
"required": [
"command"
],
"properties": {
"command": {
"const": "trace_call"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/traceData"
},
{
"type": "null"
}
]
}
}
},
{
"required": [
"command"
],
"properties": {
"command": {
"const": "trace_stop_all"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/traceData"
},
{
"type": "null"
}
]
}
}
}
]
},
"preCommandError": {
"required": [
"command",
"outcome",
"data",
"meta",
"issues"
],
"properties": {
"command": {
"type": "null"
},
"outcome": {
"const": "error"
},
"data": {
"type": "null"
},
"meta": {
"type": "object",
"properties": {
"target": {
"type": "null"
},
"capture": {
"type": "null"
}
}
},
"issues": {
"type": "array",
"contains": {
"type": "object",
"required": [
"severity"
],
"properties": {
"severity": {
"const": "error"
}
}
},
"minContains": 1
}
}
},
"contextData": {
"type": "object",
"required": [
"node",
"name_mode",
"cookie_source",
"probe",
"diagnostics_module",
"expected_capabilities",
"observed_capabilities",
"persistent_connection"
],
"properties": {
"node": {
"type": "string"
},
"name_mode": {
"type": "string"
},
"cookie_source": {
"type": "object"
},
"probe": {
"type": "string"
},
"diagnostics_module": {
"type": "string"
},
"expected_capabilities": {
"type": [
"object",
"null"
]
},
"observed_capabilities": {
"type": [
"object",
"null"
]
},
"persistent_connection": {
"type": "boolean"
}
}
},
"disconnectData": {
"type": "object",
"required": [
"node",
"disconnected"
],
"properties": {
"node": {
"type": [
"string",
"null"
]
},
"disconnected": {
"const": true
},
"recovered_invalid_context": {
"type": "boolean"
}
}
},
"snapshotData": {
"type": "object"
},
"diagnoseData": {
"type": "object",
"required": [
"findings",
"context",
"skipped"
],
"properties": {
"findings": {
"type": "array"
},
"context": {
"type": "object"
},
"skipped": {
"type": "array"
}
}
},
"memoryData": {
"type": "object",
"required": [
"runtime",
"memory"
],
"properties": {
"runtime": {
"type": "object"
},
"memory": {
"type": "object"
}
}
},
"statusData": {
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"minLength": 1
}
}
},
"distributionData": {
"type": "object",
"required": [
"connected_peers",
"returned_peer_count",
"truncated"
],
"properties": {
"connected_peers": {
"type": "array"
},
"returned_peer_count": {
"type": "integer",
"minimum": 0
},
"truncated": {
"type": "boolean"
}
}
},
"supervisionTreeData": {
"type": "object",
"required": [
"status",
"risk_level"
],
"properties": {
"status": {
"type": "string",
"minLength": 1
},
"risk_level": {
"type": "string",
"minLength": 1
}
}
},
"traceData": {
"type": "object",
"required": [
"reason",
"trace"
],
"properties": {
"reason": {
"type": [
"string",
"null"
]
},
"trace": {
"type": "object"
}
}
},
"logsCommand": {
"oneOf": [
{
"required": [
"command"
],
"properties": {
"command": {
"const": "logs"
},
"data": {
"oneOf": [
{
"$ref": "#/$defs/logsData"
},
{
"type": "null"
}
]
}
},
"allOf": [
{
"if": {
"properties": {
"data": {
"type": "object"
}
},
"required": [
"data"
]
},
"then": {
"properties": {
"meta": {
"type": "object",
"properties": {
"target": {
"$ref": "#/$defs/target"
},
"capture": {
"$ref": "#/$defs/logsCapture"
}
}
}
}
}
}
]
}
]
},
"logsData": {
"type": "object",
"required": [
"sources",
"selected_source",
"tail"
],
"additionalProperties": false,
"properties": {
"sources": {
"type": "array",
"maxItems": 64,
"items": {
"$ref": "#/$defs/logSource"
}
},
"selected_source": {
"oneOf": [
{
"$ref": "#/$defs/selectedLogSource"
},
{
"type": "null"
}
]
},
"tail": {
"oneOf": [
{
"$ref": "#/$defs/logTail"
},
{
"type": "null"
}
]
}
}
},
"logSource": {
"type": "object",
"required": [
"id",
"addressable",
"handler_kind",
"supported",
"reason_code"
],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 255
},
"addressable": {
"type": "boolean"
},
"handler_kind": {
"enum": [
"logger_std_h_file",
"other"
]
},
"supported": {
"type": "boolean"
},
"reason_code": {
"enum": [
null,
"unaddressable_handler_id",
"unsupported_log_handler",
"unsupported_file_modes",
"log_path_unrepresentable",
"invalid_log_handler_config"
]
}
}
},
"selectedLogSource": {
"type": "object",
"required": [
"id",
"addressable",
"handler_kind",
"supported",
"reason_code",
"configured_path",
"active_handler_fd_match"
],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 255
},
"addressable": {
"type": "boolean"
},
"handler_kind": {
"enum": [
"logger_std_h_file",
"other"
]
},
"supported": {
"type": "boolean"
},
"reason_code": {
"enum": [
null,
"unaddressable_handler_id",
"unsupported_log_handler",
"unsupported_file_modes",
"log_path_unrepresentable",
"invalid_log_handler_config"
]
},
"configured_path": {
"type": "string",
"minLength": 1,
"maxLength": 4096,
"pattern": "^/"
},
"active_handler_fd_match": {
"const": "unknown"
}
}
},
"logTail": {
"type": "object",
"required": [
"scope",
"active_handler_fd_match",
"visibility",
"command_filesync_requested",
"consistency",
"content_trust",
"requested_lines",
"returned_lines",
"captured_eof_bytes",
"bytes_read",
"has_more",
"content_truncated",
"truncation_reasons",
"truncated_line_indexes",
"lines"
],
"additionalProperties": false,
"properties": {
"scope": {
"const": "configured_path"
},
"active_handler_fd_match": {
"const": "unknown"
},
"visibility": {
"const": "reader_visible"
},
"command_filesync_requested": {
"const": false
},
"consistency": {
"const": "non_atomic"
},
"content_trust": {
"const": "untrusted"
},
"requested_lines": {
"type": "integer",
"minimum": 1,
"maximum": 2000
},
"returned_lines": {
"type": "integer",
"minimum": 0,
"maximum": 2000
},
"captured_eof_bytes": {
"type": "integer",
"minimum": 0,
"maximum": 9223372036854775807
},
"bytes_read": {
"type": "integer",
"minimum": 0,
"maximum": 65536
},
"has_more": {
"type": "boolean"
},
"content_truncated": {
"type": "boolean"
},
"truncation_reasons": {
"type": "array",
"maxItems": 2,
"uniqueItems": true,
"items": {
"enum": [
"byte_cap",
"line_cap"
]
}
},
"truncated_line_indexes": {
"type": "array",
"maxItems": 2000,
"uniqueItems": true,
"items": {
"type": "integer",
"minimum": 0,
"maximum": 1999
}
},
"lines": {
"type": "array",
"maxItems": 2000,
"items": {
"$ref": "#/$defs/logLine"
}
}
}
},
"logLine": {
"oneOf": [
{
"type": "string",
"maxLength": 32768
},
{
"type": "object",
"required": [
"encoding",
"data"
],
"additionalProperties": false,
"properties": {
"encoding": {
"const": "base64"
},
"data": {
"type": "string",
"contentEncoding": "base64"
}
}
}
]
},
"logsCapture": {
"type": "object",
"required": [
"started_at",
"finished_at",
"duration_ms",
"probes",
"observer_effects"
],
"additionalProperties": false,
"properties": {
"started_at": {
"type": "string",
"format": "date-time",
"maxLength": 64
},
"finished_at": {
"type": "string",
"format": "date-time",
"maxLength": 64
},
"duration_ms": {
"type": "integer",
"minimum": 0,
"maximum": 9223372036854775807
},
"probes": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"$ref": "#/$defs/probe"
}
},
"observer_effects": {
"oneOf": [
{
"type": "array",
"minItems": 3,
"maxItems": 3,
"prefixItems": [
{
"$ref": "#/$defs/diagnosticsWorkerEffect"
},
{
"$ref": "#/$defs/moduleLoadEffect"
},
{
"$ref": "#/$defs/configuredLogReadEffect"
}
],
"items": false
},
{
"type": "array",
"minItems": 4,
"maxItems": 4,
"prefixItems": [
{
"$ref": "#/$defs/diagnosticsWorkerEffect"
},
{
"$ref": "#/$defs/moduleLoadEffect"
},
{
"$ref": "#/$defs/distributionControllerEffect"
},
{
"$ref": "#/$defs/configuredLogReadEffect"
}
],
"items": false
}
]
}
}
},
"diagnosticsWorkerEffect": {
"type": "object",
"required": [
"id",
"affected_facts"
],
"additionalProperties": false,
"properties": {
"id": {
"const": "diagnostics_worker"
},
"affected_facts": {
"const": [
"process_count",
"port_count",
"memory",
"io",
"garbage_collection"
]
}
}
},
"moduleLoadEffect": {
"type": "object",
"required": [
"id",
"module_loaded_before_sample"
],
"additionalProperties": false,
"properties": {
"id": {
"const": "module_load"
},
"module_loaded_before_sample": {
"type": "boolean"
}
}
},
"distributionControllerEffect": {
"type": "object",
"required": [
"id",
"controller_peer",
"dynamic_controller_name_atom"
],
"additionalProperties": false,
"properties": {
"id": {
"const": "distribution_controller"
},
"controller_peer": {
"type": "string",
"minLength": 1
},
"dynamic_controller_name_atom": {
"const": true
}
}
},
"configuredLogReadEffect": {
"type": "object",
"required": [
"id",
"handler_ids_enumerated",
"handler_config_lookups",
"read_attempts",
"raw_read_cap_bytes",
"atime_may_change",
"consistency",
"command_filesync_attempted"
],
"additionalProperties": false,
"properties": {
"id": {
"const": "configured_log_read"
},
"handler_ids_enumerated": {
"type": "boolean"
},
"handler_config_lookups": {
"type": "integer",
"minimum": 0,
"maximum": 66
},
"read_attempts": {
"type": "integer",
"minimum": 0,
"maximum": 2
},
"raw_read_cap_bytes": {
"const": 65536
},
"atime_may_change": {
"const": true
},
"consistency": {
"const": "non_atomic"
},
"command_filesync_attempted": {
"const": false
}
}
}
}
}