mirror of
https://github.com/katanemo/plano.git
synced 2026-05-11 08:42:48 +02:00
* add custom trace attributes * refactor: prefix custom trace attributes and update schema handlers tests configs * refactor: rename custom_attribute_prefixes to span_attribute_header_prefixes in configuration and related handlers * docs: add section on custom span attributes * refactor: update tracing configuration to use span attributes and adjust related handlers * docs: custom span attributes section to include static attributes and clarify configuration * add custom trace attributes * refactor: prefix custom trace attributes and update schema handlers tests configs * refactor: rename custom_attribute_prefixes to span_attribute_header_prefixes in configuration and related handlers * docs: add section on custom span attributes * refactor: update tracing configuration to use span attributes and adjust related handlers * docs: custom span attributes section to include static attributes and clarify configuration * refactor: remove TraceCollector usage and enhance logging with structured attributes * refactor: custom trace attribute extraction to improve clarity --------- Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.2 KiB
Rust
37 lines
1.2 KiB
Rust
mod constants;
|
|
mod custom_attributes;
|
|
mod service_name_exporter;
|
|
|
|
pub use constants::{
|
|
error, http, llm, operation_component, routing, signals, OperationNameBuilder,
|
|
};
|
|
pub use custom_attributes::{append_span_attributes, collect_custom_trace_attributes};
|
|
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(),
|
|
));
|
|
});
|
|
}
|