mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
chore: allow unlimited return if timerange is applied (#7222)
Signed-off-by: shuiyisong <xixing.sys@gmail.com>
This commit is contained in:
@@ -128,6 +128,7 @@ impl JaegerQueryHandler for Instance {
|
||||
trace_id: &str,
|
||||
start_time: Option<i64>,
|
||||
end_time: Option<i64>,
|
||||
limit: Option<usize>,
|
||||
) -> ServerResult<Output> {
|
||||
// It's equivalent to the following SQL query:
|
||||
//
|
||||
@@ -155,6 +156,13 @@ impl JaegerQueryHandler for Instance {
|
||||
filters.push(col(TIMESTAMP_COLUMN).lt_eq(lit_timestamp_nano(end_time)));
|
||||
}
|
||||
|
||||
let limit = if start_time.is_some() && end_time.is_some() {
|
||||
// allow unlimited limit if time range is specified
|
||||
limit
|
||||
} else {
|
||||
limit.or(Some(DEFAULT_LIMIT))
|
||||
};
|
||||
|
||||
Ok(query_trace_table(
|
||||
ctx,
|
||||
self.catalog_manager(),
|
||||
@@ -162,7 +170,7 @@ impl JaegerQueryHandler for Instance {
|
||||
selects,
|
||||
filters,
|
||||
vec![col(TIMESTAMP_COLUMN).sort(false, false)], // Sort by timestamp in descending order.
|
||||
Some(DEFAULT_LIMIT),
|
||||
limit,
|
||||
None,
|
||||
vec![],
|
||||
)
|
||||
|
||||
@@ -427,7 +427,13 @@ pub async fn handle_get_trace(
|
||||
let end_time_ns = query_params.end.map(|end_us| end_us * 1000);
|
||||
|
||||
let output = match handler
|
||||
.get_trace(query_ctx, &trace_id, start_time_ns, end_time_ns)
|
||||
.get_trace(
|
||||
query_ctx,
|
||||
&trace_id,
|
||||
start_time_ns,
|
||||
end_time_ns,
|
||||
query_params.limit,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(output) => output,
|
||||
|
||||
@@ -210,6 +210,7 @@ pub trait JaegerQueryHandler {
|
||||
trace_id: &str,
|
||||
start_time: Option<i64>,
|
||||
end_time: Option<i64>,
|
||||
limit: Option<usize>,
|
||||
) -> Result<Output>;
|
||||
|
||||
/// Find traces by query params. It's used for `/api/traces` API.
|
||||
|
||||
Reference in New Issue
Block a user