refactor: rename custom_attribute_prefixes to span_attribute_header_prefixes in configuration and related handlers

This commit is contained in:
Musa 2026-02-06 09:33:13 -08:00
parent 40c959ef3f
commit 4b7065817d
6 changed files with 9 additions and 9 deletions

View file

@ -382,7 +382,7 @@ properties:
type: integer
trace_arch_internal:
type: boolean
custom_attribute_prefixes:
span_attribute_header_prefixes:
type: array
items:
type: string

View file

@ -187,7 +187,7 @@ async fn handle_agent_chat(
tracing_config
.as_ref()
.as_ref()
.and_then(|tracing| tracing.custom_attribute_prefixes.as_deref()),
.and_then(|tracing| tracing.span_attribute_header_prefixes.as_deref()),
);
let chat_request_bytes = request.collect().await?.to_bytes();

View file

@ -53,7 +53,7 @@ pub async fn llm_chat(
tracing_config
.as_ref()
.as_ref()
.and_then(|tracing| tracing.custom_attribute_prefixes.as_deref()),
.and_then(|tracing| tracing.span_attribute_header_prefixes.as_deref()),
);
let request_id: String = match request_headers
.get(REQUEST_ID_HEADER)

View file

@ -4,20 +4,20 @@ use hyper::header::HeaderMap;
pub fn extract_custom_trace_attributes(
headers: &HeaderMap,
custom_attribute_prefixes: Option<&[String]>,
span_attribute_header_prefixes: Option<&[String]>,
) -> HashMap<String, String> {
let mut attributes = HashMap::new();
let Some(custom_attribute_prefixes) = custom_attribute_prefixes else {
let Some(span_attribute_header_prefixes) = span_attribute_header_prefixes else {
return attributes;
};
if custom_attribute_prefixes.is_empty() {
if span_attribute_header_prefixes.is_empty() {
return attributes;
}
for (name, value) in headers.iter() {
let header_name = name.as_str();
let mut matched_prefix: Option<&str> = None;
for prefix in custom_attribute_prefixes {
for prefix in span_attribute_header_prefixes {
if header_name.starts_with(prefix) {
matched_prefix = Some(prefix.as_str());
break;

View file

@ -90,7 +90,7 @@ pub struct Overrides {
pub struct Tracing {
pub sampling_rate: Option<f64>,
pub trace_arch_internal: Option<bool>,
pub custom_attribute_prefixes: Option<Vec<String>>,
pub span_attribute_header_prefixes: Option<Vec<String>>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Default)]

View file

@ -55,5 +55,5 @@ listeners:
tracing:
random_sampling: 100
custom_attribute_prefixes:
span_attribute_header_prefixes:
- x-katanemo-