Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ logs
# Ignore files generated by scripts
/example
/testnet
bench/trace-schemas/types/
bench/trace-schemas/messages/

.vscode/

Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ cli node:
trace-documentation:
cabal run -- exe:cardano-node trace-documentation --config 'configuration/cardano/mainnet-config.yaml' --output-file 'doc/new-tracing/tracers_doc_generated.md'

trace-schemas-regenerate: ## Regenerate trace schemas, apply overrides, validate
bash bench/trace-schemas/scripts/schema-gen/RegenerateTraceSchemas.sh

trace-schemas-overrides-check: ## Check whether all schema overrides are applied
nix run .#apply-schema-overrides -- --check --verbose

trace-schemas-overrides-coverage: ## Fail when generated schema files change without matching override sidecars (use RANGE=origin/master...HEAD in CI)
nix run .#check-override-coverage -- ${if ${RANGE},--range ${RANGE}}

trace-schemas-validate: ## Validate trace message schemas against meta.schema.json
nix run .#validate-trace-schemas

###
### Workbench
###
Expand Down
51 changes: 51 additions & 0 deletions bench/trace-schemas/TraceMessage.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "io.example.tracing/TraceMessage.schema.json",
"title": "TraceMessage",
"description": "Common envelope for trace messages.",
"type": "object",
"additionalProperties": false,
"required": [
"at",
"ns",
"sev",
"thread",
"host",
"data"
],
"properties": {
"at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of the trace event (RFC 3339 / ISO 8601)."
},
"ns": {
"type": "string",
"description": "Trace namespace."
},
"sev": {
"type": "string",
"description": "Severity level.",
"enum": [
"Debug",
"Info",
"Notice",
"Warning",
"Error",
"Critical"
]
},
"thread": {
"type": "string",
"description": "Thread identifier."
},
"host": {
"type": "string",
"description": "Host name or node identifier."
},
"data": {
"description": "Payload of the trace message.",
"type": "object"
}
}
}
65 changes: 65 additions & 0 deletions bench/trace-schemas/meta.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"$id": "io.example.tracing/generated-schema-entry.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"oneOf": [
{
"not": {
"required": [
"variants"
]
},
"required": [
"data"
]
},
{
"not": {
"required": [
"data"
]
},
"required": [
"variants"
]
}
],
"properties": {
"data": {
"type": "object"
},
"ns": {
"type": "string"
},
"variants": {
"items": {
"additionalProperties": false,
"properties": {
"data": {
"type": "object"
},
"detailLevel": {
"enum": [
"Minimal",
"Normal",
"Detailed",
"Maximum"
],
"type": "string"
}
},
"required": [
"detailLevel",
"data"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"ns"
],
"title": "GeneratedTraceSchemaEntry",
"type": "object"
}
Loading
Loading