mirror of
https://github.com/katanemo/plano.git
synced 2026-05-10 16:22:42 +02:00
use standard tracing and logging in brightstaff (#721)
This commit is contained in:
parent
4d9ed74b68
commit
46de89590b
55 changed files with 1494 additions and 2432 deletions
|
|
@ -1,5 +1,35 @@
|
|||
mod constants;
|
||||
mod service_name_exporter;
|
||||
|
||||
pub use constants::{
|
||||
error, http, llm, operation_component, routing, signals, OperationNameBuilder,
|
||||
};
|
||||
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(),
|
||||
));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue