Skip to main content

autoagents_telemetry/providers/
mod.rs

1use std::fmt::Debug;
2use std::sync::Arc;
3
4use crate::TelemetryConfig;
5use opentelemetry::Value;
6
7/// Provides a telemetry configuration per tracer instance.
8pub trait TelemetryProvider: Debug {
9    fn telemetry_config(&self) -> TelemetryConfig;
10    fn attribute_provider(&self) -> Option<Arc<dyn TelemetryAttributeProvider>> {
11        None
12    }
13}
14
15/// Provider-specific span attributes for downstream systems.
16pub trait TelemetryAttributeProvider: Debug + Send + Sync {
17    fn task_started_attributes(
18        &self,
19        actor_name: &str,
20        task_input: &str,
21    ) -> Vec<(&'static str, Value)>;
22    fn task_completed_attributes(&self, task_output: &str) -> Vec<(&'static str, Value)>;
23    fn tool_started_attributes(
24        &self,
25        tool_name: &str,
26        tool_args: &str,
27    ) -> Vec<(&'static str, Value)>;
28    fn tool_completed_attributes(
29        &self,
30        tool_name: &str,
31        tool_output: &str,
32    ) -> Vec<(&'static str, Value)>;
33    fn tool_failed_attributes(&self, tool_name: &str, error: &str) -> Vec<(&'static str, Value)>;
34}
35
36#[cfg(feature = "langfuse")]
37pub mod langfuse;