Crate rapace_tracing

Crate rapace_tracing 

Source
Expand description

Tracing subscriber that forwards spans/events over rapace RPC.

This crate enables plugins to use tracing normally while having all spans and events collected in the host process via rapace RPC.

§Architecture

┌─────────────────────────────────────────────────────────────────────────┐
│                             PLUGIN PROCESS                              │
│                                                                         │
│   tracing::info!("hello") ──► RapaceTracingLayer ──► TracingSinkClient ─┤
│                                      ▲                                  │
│                                      │                                  │
│                          TracingConfigServer ◄──────────────────────────┤
│                          (applies host's filter)                        │
└────────────────────────────────────────────────────────────────────────┬┘
                                                                         │
                             rapace transport (TCP/Unix/SHM)             │
                                                                         │
┌────────────────────────────────────────────────────────────────────────┴┐
│                              HOST PROCESS                               │
│                                                                         │
│   TracingSinkServer ──► HostTracingSink ──► tracing_subscriber / logs  │
│                                                                         │
│   TracingConfigClient ──► pushes filter changes to plugin              │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

§Filter Flow

The host is the single source of truth for log filtering:

  1. Host decides what log levels/targets are enabled
  2. Host pushes filter config to plugin via TracingConfig::set_filter
  3. Plugin applies the filter locally (no spam over RPC)
  4. When host changes filters dynamically, it pushes the update

§Example

// Plugin side: install the layer
let layer = RapaceTracingLayer::new(sink_client);
tracing_subscriber::registry().with(layer).init();

// Now all tracing calls are forwarded to the host
tracing::info!("hello from plugin");

Structs§

EventMeta
Metadata about an event.
Field
A field value captured from tracing.
HostTracingSink
Host-side implementation of TracingSink.
RapaceTracingLayer
A tracing Layer that forwards spans/events to a TracingSink via RPC.
SharedFilter
Shared filter state that can be updated by the host.
SpanMeta
Metadata about a span.
TracingConfigClient
Client stub for the #trait_name service.
TracingConfigImpl
Plugin-side implementation of TracingConfig.
TracingConfigRegistryClient
Registry-aware client stub for the #trait_name service.
TracingConfigServer
Server dispatcher for the #trait_name service.
TracingSinkClient
Client stub for the #trait_name service.
TracingSinkRegistryClient
Registry-aware client stub for the #trait_name service.
TracingSinkServer
Server dispatcher for the #trait_name service.

Enums§

TraceRecord
Collected trace data for inspection/testing.

Constants§

TRACING_CONFIG_METHOD_ID_SET_FILTER
TRACING_SINK_METHOD_ID_DROP_SPAN
TRACING_SINK_METHOD_ID_ENTER
TRACING_SINK_METHOD_ID_EVENT
TRACING_SINK_METHOD_ID_EXIT
TRACING_SINK_METHOD_ID_NEW_SPAN
TRACING_SINK_METHOD_ID_RECORD

Traits§

TracingConfig
Service for configuring tracing in plugins.
TracingSink
Service for receiving tracing data from plugins.

Functions§

create_tracing_config_dispatcher
Create a dispatcher for TracingConfig service (plugin side).
create_tracing_sink_dispatcher
Create a dispatcher for TracingSink service.
tracing_config_register
Register this service with a registry.
tracing_sink_register
Register this service with a registry.