use crate::error::Error;
#[cfg(feature = "opentelemetry")]
pub async fn init_otel(_service_name: &str, _endpoint: &str) -> Result<(), Error> {
tracing::warn!("OpenTelemetry integration is a stub - full implementation pending API research");
Ok(())
}
#[cfg(not(feature = "opentelemetry"))]
pub async fn init_otel(_service_name: &str, _endpoint: &str) -> Result<(), Error> {
tracing::warn!("OpenTelemetry feature is not enabled. Install with: cargo build --features opentelemetry");
Ok(())
}
#[cfg(feature = "opentelemetry")]
pub fn shutdown_otel() {
tracing::info!("OpenTelemetry tracer provider shut down (stub)");
}
#[cfg(not(feature = "opentelemetry"))]
pub fn shutdown_otel() {
}
#[macro_export]
macro_rules! protocol_span {
($protocol:expr, $step:expr) => {
tracing::info_span!(
"protocol_step",
protocol = $protocol,
step = $step,
service.name = "reasonkit-core"
)
};
}
#[macro_export]
macro_rules! llm_span {
($provider:expr, $model:expr) => {
tracing::info_span!(
"llm_call",
provider = $provider,
model = $model,
service.name = "reasonkit-core",
gen_ai.system = "reasonkit"
)
};
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
#[cfg(feature = "opentelemetry")]
async fn test_otel_initialization() {
let result = init_otel("test-service", "http://localhost:4317").await;
assert!(result.is_ok() || result.is_err());
shutdown_otel();
}
#[tokio::test]
#[cfg(not(feature = "opentelemetry"))]
async fn test_otel_noop() {
let result = init_otel("test-service", "http://localhost:4317").await;
assert!(result.is_ok());
}
}