structured-log-contracts

Define immutable JSON log contracts with trace propagation and safe serialization.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/luansilvadb/agoravai --skill structured-log-contracts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: structured-log-contracts
Source: https://github.com/luansilvadb/agoravai/tree/main/.rag/context/structured-log-contracts
Command: npx skills add https://github.com/luansilvadb/agoravai --skill structured-log-contracts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Define e implemente contratos de log estruturado (JSON) garantindo rastreabilidade ponta-a-ponta, isolamento de side-effects e resiliência a falhas de serialização, com foco em código de observabilidade de infraestrutura.

Core Features & Use Cases

  • Define a interface (schema) do log com campos obrigatórios (timestamp, level, message, service, trace_id, span_id) e campos opcionais para erro e contexto.
  • Assegura a propagação de contexto sem depender de parâmetros manuais, via AsyncLocalStorage (Node) ou ContextVar (Python).
  • Isola a construção do payload da escrita em I/O e fornece fallback seguro se a serialização falhar.
  • Sanitiza PII e limita tamanho de payloads para evitar vazamento e degradação de desempenho.
  • Oferece fallback de I/O para não travar a aplicação quando o destino de logs estiver indisponível.

Quick Start

Configure the structured log contract in your logging layer and wire trace propagation middleware across services.

Frequently Asked Questions about structured-log-contracts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement structured logging with trace propagation in Node microservices?

Structured logging with trace propagation is implemented by defining an immutable JSON schema and using AsyncLocalStorage to pass trace_id and span_id automatically across microservices without manual parameter passing.

What is the best way to sanitize PII in structured JSON log payloads?

Sanitizing PII in structured log payloads is handled by applying sanitization rules during payload construction, ensuring sensitive data is masked and payload sizes are limited to prevent leakage and avoid performance degradation.

How do I handle structured logging when serialization or I/O fails?

Handling structured logging failures involves using a safe serialization fallback to generate a valid payload if the primary serialization fails, and a resilient I/O fallback to prevent application crashes when the log destination is unavailable.

Does this structured logging contract approach work with Python microservices?

Yes, the structured logging contract supports Python microservices by utilizing ContextVar for trace context propagation, offering the same immutable JSON payload guarantees and fault-tolerant I/O as the Node.js implementation.

Why do I need an immutable contract schema for infrastructure observability logs?

An immutable contract schema for observability logs guarantees that mandatory fields like timestamp, level, message, service, and trace_id remain consistent, ensuring reliable end-to-end traceability and preventing runtime payload mutations.