Skip to content

Commit 433f380

Browse files
authored
fix: limit argument not being passed to view next page by bt view logs/trace
1 parent 5d39754 commit 433f380

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

src/traces.rs

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,7 @@ async fn run_logs_command(base: BaseArgs, client: ApiClient, args: LogsArgs) ->
10281028
&object_ref_arg,
10291029
next_cursor.as_deref(),
10301030
profile_flag,
1031+
args.limit,
10311032
),
10321033
});
10331034
println!("{}", serde_json::to_string_pretty(&payload)?);
@@ -1191,6 +1192,7 @@ async fn run_trace_command(base: BaseArgs, client: ApiClient, args: TraceArgs) -
11911192
&trace_id,
11921193
next_cursor.as_deref(),
11931194
profile_flag,
1195+
args.limit,
11941196
),
11951197
});
11961198
println!("{}", serde_json::to_string_pretty(&payload)?);
@@ -4844,16 +4846,22 @@ fn logs_hints(
48444846
object_ref: &str,
48454847
next_cursor: Option<&str>,
48464848
profile: Option<&str>,
4849+
limit: usize,
48474850
) -> Vec<String> {
48484851
let mut hints = vec![
48494852
"Rows are truncated by preview_length; fetch a single span for full content.".to_string(),
48504853
"Use --json to get machine-readable envelopes for agent workflows.".to_string(),
48514854
"Write large responses to a file to preserve full output context.".to_string(),
48524855
];
4856+
let limit_suffix = if limit != 50 {
4857+
format!(" --limit {limit}")
4858+
} else {
4859+
String::new()
4860+
};
48534861
if has_more {
48544862
if let Some(cursor) = next_cursor {
48554863
hints.push(format!(
4856-
"Next page: bt view logs{} --object-ref {object_ref} --cursor {cursor}",
4864+
"Next page: bt view logs{} --object-ref {object_ref} --cursor {cursor}{limit_suffix}",
48574865
profile_flag_suffix(profile)
48584866
));
48594867
} else {
@@ -4871,6 +4879,7 @@ fn trace_hints(
48714879
trace_id: &str,
48724880
next_cursor: Option<&str>,
48734881
profile: Option<&str>,
4882+
limit: usize,
48744883
) -> Vec<String> {
48754884
let mut hints = vec![
48764885
format!(
@@ -4879,10 +4888,15 @@ fn trace_hints(
48794888
),
48804889
"Write output to a file for long traces.".to_string(),
48814890
];
4891+
let limit_suffix = if limit != 50 {
4892+
format!(" --limit {limit}")
4893+
} else {
4894+
String::new()
4895+
};
48824896
if has_more {
48834897
if let Some(cursor) = next_cursor {
48844898
hints.push(format!(
4885-
"Next page: bt view trace{} --object-ref {object_ref} --trace-id {trace_id} --cursor {cursor}",
4899+
"Next page: bt view trace{} --object-ref {object_ref} --trace-id {trace_id} --cursor {cursor}{limit_suffix}",
48864900
profile_flag_suffix(profile)
48874901
));
48884902
} else {
@@ -4934,9 +4948,14 @@ fn print_logs_text(
49344948
}
49354949
println!("\nTruncated fields use preview_length={preview_length}.");
49364950
if let Some(cursor) = next_cursor {
4951+
let limit_suffix = if limit != 50 {
4952+
format!(" --limit {limit}")
4953+
} else {
4954+
String::new()
4955+
};
49374956
println!("next_cursor: {cursor}");
49384957
println!(
4939-
"next: bt view logs{} --object-ref {object_ref} --cursor {cursor} --non-interactive",
4958+
"next: bt view logs{} --object-ref {object_ref} --cursor {cursor} --non-interactive{limit_suffix}",
49404959
profile_flag_suffix(profile)
49414960
);
49424961
} else {
@@ -4980,9 +4999,14 @@ fn print_trace_text(
49804999
object_ref
49815000
);
49825001
if let Some(cursor) = next_cursor {
5002+
let limit_suffix = if limit != 50 {
5003+
format!(" --limit {limit}")
5004+
} else {
5005+
String::new()
5006+
};
49835007
println!("next_cursor: {cursor}");
49845008
println!(
4985-
"next: bt view trace{} --object-ref {} --trace-id {} --cursor {} --non-interactive",
5009+
"next: bt view trace{} --object-ref {} --trace-id {} --cursor {} --non-interactive{limit_suffix}",
49865010
profile_flag_suffix(profile),
49875011
object_ref,
49885012
trace_id,

0 commit comments

Comments
 (0)