Skip to content

miniproto.observability

Structured logging, lightweight metrics, and process-memory observation helpers.

  • LogFormat — Public attribute miniproto.observability.LogFormat.
  • MetricsSink — Protocol implemented by destinations that accept metric events.
  • MetricEvent — Immutable metric event recorded with a unit, attributes, and wall-clock timestamp.
  • InMemoryMetrics — Simple in-memory MetricsSink useful for tests and local diagnostics.
  • ResourceSnapshot — Point-in-time process and tracemalloc memory counters.
  • MemoryDelta — Start, end, and peak resource snapshots for one monitored interval.
  • MemoryMonitor — Collect resource snapshots and optionally manage a temporary tracemalloc session.
  • StructuredFormatter — Formatter that redacts structured events and optionally emits compact JSON.
  • get_logger — Return the root miniproto logger or a named child logger.
  • configure_logging — Install one redacting handler on the miniproto root logger.
  • emit_event — Emit one structured miniproto event if the level is enabled.
  • set_metrics_sink — Set the process-global metrics destination, or disable metric recording.
  • get_metrics_sink — Return the currently configured process-global metrics sink, if any.
  • record_metric — Record a metric through the configured sink, suppressing sink failures.
  • resource_snapshot — Capture current RSS, active tracemalloc counters, and GC object count.
  • process_rss_bytes — Return this process’s reported RSS/working-set byte count when available.
  • current_process_id — Return the current operating-system process identifier.
  • to_jsonable — Recursively convert supported observability values into JSON-compatible shapes.