Skip to content

Structured logging - #112

Merged
JamesEjembi merged 2 commits into
VeriNode-Labs:mainfrom
gloskull:Structured-Logging
Jul 28, 2026
Merged

Structured logging#112
JamesEjembi merged 2 commits into
VeriNode-Labs:mainfrom
gloskull:Structured-Logging

Conversation

@gloskull

@gloskull gloskull commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Motivation

  • Provide OpenTelemetry-compatible structured logging alongside existing distributed tracing so on‑chain contracts can emit correlated logs and spans for off‑chain observability and dashboards.
  • Expose a compact, contract-safe way to attach semantic‑convention attributes (service, component, critical‑path) to logs without adding storage writes on critical paths.

Description

  • Add OpenTelemetry semantic names in tracing::semconv and a LogSeverity enum to represent severity text and numeric levels used by VeriNode.
  • Introduce LogRecord and StructuredLogger with emit, info, and error helpers that publish structured log events under the log::record Soroban event topic and correlate with TraceId/SpanId.
  • Reuse a shared encode_attributes helper and add critical_path_attributes to serialize attributes as key=value pairs for constrained contract callers.
  • Refactor Tracer to reuse the attribute encoder, add end_span_at helper, and keep trace/span event format consistent with OpenTelemetry semantics.
  • Update module docs in src/lib.rs to mention structured logging and add unit tests in src/tracing/test.rs plus Soroban test snapshots under test_snapshots/tracing to exercise emitted trace/log events.

Testing

  • Ran cargo test tracing::test which executed the tracing/logging unit tests and snapshots with all tracing tests passing (12 passed).
  • Ran the full test suite with cargo test; tracing tests passed but the overall run surfaced pre‑existing pool_manager unit test failures (full run: 134 passed; 17 failed) that are unrelated to the tracing/logging changes.
  • Ran code formatting with cargo fmt / rustfmt during development.

Closes #74

@JamesEjembi
JamesEjembi merged commit ffdb845 into VeriNode-Labs:main Jul 28, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Structured Logging with OpenTelemetry Semantic Conventions

2 participants