feat(traces): add live search and cursor pagination to traces search - #712
Merged
platinummonkey merged 2 commits intoAug 10, 2026
Merged
Conversation
Adds --live and --cursor to `pup traces search` so recent, unsampled spans (Datadog's live trace buffer) can be pulled starting at now and paginated backwards through older results. - --live pins the query window's end to "now", landing the request in Datadog's live/unsampled buffer instead of the indexed store. - --cursor forwards a prior page's cursor into the request; the response's next cursor is surfaced via next_action in agent mode. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
gsvigruha
marked this pull request as ready for review
August 7, 2026 19:10
platinummonkey
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--livetopup traces search, which pins the query window's end to "now" so results are the freshest slice of matching spans available. Correction (2026-08-11): this does NOT confirm bypassing ingestion sampling. It calls the same public Spans Search API as any other query — no separate live endpoint or sampling-related parameter exists in the SDK. A returned span in testing hadretained_by: "retention_filter", which points to indexed/sampled retention, not an unsampled bypass. Functionally,--liveis equivalent to omitting--to(which already defaults to "now"); it mainly acts as a guardrail against an explicitly-passed stale--to. Whether the web UI's separate "Live" toggle hits a genuinely different (unsampled) backend path is still an open question.--cursorto page backwards through older spans; the response's next cursor (meta.page.after) is surfaced back vianext_actionin agent mode.Changes
src/commands/traces.rs—search()now takescursor: Option<String>andlive: bool, forcesto=nowwhen--liveis set, forwards the cursor intoSpansListRequestPage, and surfaces the next cursor in agent-mode metadata.src/main.rs— new--cursorand--liveflags onpup traces search, updated help/examples.Testing
cargo test --bin pup— addedtest_search_live_forces_to_now(asserts--tois overridden to a fresh millis timestamp) andtest_search_sends_cursor_and_surfaces_next_cursor(asserts the cursor is sent in the request body and the next cursor round-trips into response metadata); updated existing limit-validation tests for the new signature.cargo fmt --checkandcargo clippy -- -D warningspass.datad0g.com) with a release build:pup traces search --live --query="*" --limit=5returned real spans withstart_timestampessentially at request time — confirms freshness, not sampling bypass (see correction above).pup traces search --live --query="*" --limit=3 --agentreturnedtruncated: trueand anext_actionwith a ready-to-use--cursor="..."hint.--cursor="<from next_action>"and confirmed the second page returned distinct, strictly older span IDs than the first page's boundary — correct backward pagination, no duplicates.next_action/truncated.429 Too many pending querieson the very first staging call (org-level throttling, unrelated to this change); succeeded on retry.Follow-up: a fix for the shipped
--liveCLI help text (still claims an "unsampled" buffer) is coming in a separate PR.🤖 Generated with Claude Code