Skip to content

convenience

Context-aware processors for domain-specific logging operations

These processors automatically detect and enhance standard log::info!, log::debug! calls based on context and structured fields, maintaining standard Rust logging interface.

Context for LLM operations

Fields

FieldTypeDescription
modelString
componentString
operation_startString

Context for template operations

Fields

FieldTypeDescription
engineString
templateString
componentString
operation_startString

Context for A2A operations

Fields

FieldTypeDescription
message_typeString
from_agentString
to_agentString
componentString
operation_startString

Context for request operations

Fields

FieldTypeDescription
request_idString
user_idOption<String>
session_idOption<String>
operation_startString

Processor that automatically enhances standard log calls with domain-specific structure

Methods

fn new() -> Self

Convenience manager that integrates domain-aware processing into the processor chain

Methods

fn new() -> Result<Self>

Create new convenience manager

fn process_entry(&self, entry: LogEntry) -> Result<LogEntry>

Process log entry through domain-aware enhancement

fn get_processor(&self) -> &DomainContextProcessor

Get the domain context processor for integration with processor chain

fn set_llm_context(model: &str, component: &str)

Set LLM context

fn set_template_context(engine: &str, template: &str, component: &str)

Set template context

fn set_a2a_context(message_type: &str, from_agent: &str, to_agent: &str, component: &str)

Set A2A context

fn set_request_context(request_id: &str, user_id: Option<&str>, session_id: Option<&str>)

Set request context

fn clear_llm_context()

Clear LLM context only

fn clear_template_context()

Clear template context only

fn clear_a2a_context()

Clear A2A context only

fn clear_request_context()

Clear request context only

fn clear_all_contexts()

Clear all contexts

fn set_metrics_port(port: Box<dyn MetricsPort>)

Set the active MetricsPort implementation

fn clear_metrics_port()

Clear the active MetricsPort implementation

fn emit_llm_request_duration(model: &str, duration_ms: u64) -> Result<()>

Emit an LLM request duration metric with context

fn emit_llm_tokens_used(model: &str, tokens: u32) -> Result<()>

Emit an LLM token usage metric with context

fn emit_a2a_message_latency(latency_ms: u64) -> Result<()>

Emit an A2A message latency metric with context

fn emit_template_render_duration(template: &str, duration_ms: u64) -> Result<()>

Emit a template render duration metric with context

fn emit_request_duration(duration_ms: u64) -> Result<()>

Emit request processing duration metric with context

fn emit_counter(name: &str, value: f64) -> Result<()>

Generic counter metric with automatic context detection

fn emit_histogram(name: &str, value: f64) -> Result<()>

Generic histogram metric with automatic context detection

fn log_llm_request(model: &str, duration: web_time::Duration, tokens: u32, status: &str) -> Result<observability_core::LogEntry>

Convenience function to log LLM requests with structured format

fn log_template_render(engine: &str, template: &str, duration: web_time::Duration, size: usize, status: &str) -> Result<observability_core::LogEntry>

Convenience function to log template rendering with structured format

fn log_a2a_message(message_type: &str, from_agent: &str, to_agent: &str, duration: Option<web_time::Duration>, status: &str) -> Result<observability_core::LogEntry>

Convenience function to log A2A messages with structured format