2025-12-11 15:21:57 -08:00
|
|
|
mod constants;
|
2026-02-25 16:27:20 -08:00
|
|
|
mod custom_attributes;
|
2026-03-19 17:58:33 -07:00
|
|
|
mod init;
|
2026-02-09 13:33:27 -08:00
|
|
|
mod service_name_exporter;
|
2025-12-11 15:21:57 -08:00
|
|
|
|
2026-01-07 11:20:44 -08:00
|
|
|
pub use constants::{
|
2026-04-17 14:03:47 -07:00
|
|
|
error, http, llm, operation_component, plano, routing, signals, OperationNameBuilder,
|
2026-01-07 11:20:44 -08:00
|
|
|
};
|
2026-03-19 17:58:33 -07:00
|
|
|
pub use custom_attributes::collect_custom_trace_attributes;
|
|
|
|
|
pub use init::init_tracer;
|
2026-02-09 13:33:27 -08:00
|
|
|
pub use service_name_exporter::{ServiceNameOverrideExporter, SERVICE_NAME_OVERRIDE_KEY};
|
|
|
|
|
|
|
|
|
|
use opentelemetry::trace::get_active_span;
|
|
|
|
|
use opentelemetry::KeyValue;
|
|
|
|
|
|
|
|
|
|
/// Sets the service name override on the current active OpenTelemetry span.
|
|
|
|
|
///
|
|
|
|
|
/// This function adds the `service.name.override` attribute to the active
|
|
|
|
|
/// OpenTelemetry span, which allows observability backends to filter and group
|
|
|
|
|
/// spans by their logical service (e.g., `plano(llm)`, `plano(filter)`).
|
|
|
|
|
///
|
|
|
|
|
/// # Arguments
|
|
|
|
|
/// * `service_name` - The service name to use (e.g., `operation_component::LLM`)
|
|
|
|
|
///
|
|
|
|
|
/// # Example
|
|
|
|
|
/// ```rust,ignore
|
|
|
|
|
/// use brightstaff::tracing::{set_service_name, operation_component};
|
|
|
|
|
///
|
|
|
|
|
/// // Inside a traced function:
|
|
|
|
|
/// set_service_name(operation_component::LLM);
|
|
|
|
|
/// ```
|
|
|
|
|
pub fn set_service_name(service_name: &str) {
|
|
|
|
|
get_active_span(|span| {
|
|
|
|
|
span.set_attribute(KeyValue::new(
|
|
|
|
|
SERVICE_NAME_OVERRIDE_KEY,
|
|
|
|
|
service_name.to_string(),
|
|
|
|
|
));
|
|
|
|
|
});
|
|
|
|
|
}
|