Skip to content

Commit 3a1532a

Browse files
fix unit conversion in jaeger http search endpoint (#5519)
1 parent f0ff912 commit 3a1532a

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

quickwit/quickwit-serve/src/jaeger_api/model.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ pub struct TracesSearchQueryParams {
5555
pub service: Option<String>,
5656
#[serde(default)]
5757
pub operation: Option<String>,
58+
// these are microsecond precision
5859
pub start: Option<i64>,
5960
pub end: Option<i64>,
6061
pub tags: Option<String>,
62+
// these are unit-suffixed numbers. in practice we only support precision up to the ms
6163
pub min_duration: Option<String>,
6264
pub max_duration: Option<String>,
6365
pub lookback: Option<String>,

quickwit/quickwit-serve/src/jaeger_api/rest_handler.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,12 @@ async fn jaeger_traces_search(
248248
service_name: search_params.service.unwrap_or_default(),
249249
operation_name: search_params.operation.unwrap_or_default(),
250250
tags,
251-
start_time_min: search_params.start.map(to_well_known_timestamp),
252-
start_time_max: search_params.end.map(to_well_known_timestamp),
251+
start_time_min: search_params
252+
.start
253+
.map(|ts| to_well_known_timestamp(ts * 1000)),
254+
start_time_max: search_params
255+
.end
256+
.map(|ts| to_well_known_timestamp(ts * 1000)),
253257
duration_min,
254258
duration_max,
255259
num_traces: search_params.limit.unwrap_or(DEFAULT_NUMBER_OF_TRACES),
@@ -449,6 +453,18 @@ mod tests {
449453
"{\"type\":\"term\",\"field\":\"resource_attributes.tag.second\",\"value\":\"\
450454
true\"}"
451455
));
456+
assert!(req.query_ast.contains(
457+
"{\"type\":\"term\",\"field\":\"resource_attributes.tag.second\",\"value\":\"\
458+
true\"}"
459+
));
460+
// no lowerbound because minDuration < 1ms,
461+
assert!(req.query_ast.contains(
462+
"{\"type\":\"range\",\"field\":\"span_duration_millis\",\"lower_bound\":\"\
463+
Unbounded\",\"upper_bound\":{\"Included\":1200}}"
464+
));
465+
assert_eq!(req.start_timestamp, Some(1702352106));
466+
// TODO(trinity) i think we have an off by 1 here, imo this should be rounded up
467+
assert_eq!(req.end_timestamp, Some(1702373706));
452468
assert_eq!(
453469
req.index_id_patterns,
454470
vec![OTEL_TRACES_INDEX_ID.to_string()]

0 commit comments

Comments
 (0)