feat(traces): add --fields projection flag to traces get and export#58
Open
dark-sorceror wants to merge 3 commits into
Open
feat(traces): add --fields projection flag to traces get and export#58dark-sorceror wants to merge 3 commits into
dark-sorceror wants to merge 3 commits into
Conversation
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
Fixes #51
traceroot traces getnever sent thefieldsquery parameter, so every span came back from the server's defaultskeletonprojection withinput: null,output: null,metadata: null— silently, with no error. That's the exact payload someone debugging a trace needs. Meanwhiletraces exportbundles already contained full I/O (the export endpoint defaults tofullserver-side), sogetandexportdisagreed about the same trace with nothing in--helpor the README explaining why. This PR wires thefieldsprojection parameter (already documented in the vendoredopenapi.json) through both commands so callers can ask forfullor a specific group likeio,metadata, and documents the default in--helpand the README.How it works
traces getkeeps the server'sskeletondefault (no per-span input/output/metadata) since it's the fast, common-case view.traces exportkeeps the server'sfulldefault since a bundle written to disk is expected to be complete.--fieldsoverrides either default without changing anything else about the request.What's included
API client
src/api/client.ts— newTraceFieldsParamstype;getTrace/exportTracenow take an optionalparamsand append?fields=...to the request URL only when a value is providedCommands
src/commands/traces/get.ts—--fields <groups>option (reusesonceOptionfromtraces/list.ts), threaded fromRunGetDepsintoclient.getTracesrc/commands/traces/export.ts—--fields <groups>option, threaded fromExportDepsintoclient.exportTraceDocs
README.md— documents thattraces getdefaults to the lightweightskeletonprojection andtraces exportdefaults tofull, with a--fields fullexampleTest plan
597/597vitest tests pass; typecheck and lint/format cleanfieldsappears in the outgoing URL forgetTrace/exportTrace, and is absent when omitted (tests/api/client.test.ts)--fieldsthreads fromrunGet/runExportthrough to the client call, and that omitting it passesfields: undefined(tests/commands/traces-get.test.ts,tests/commands/traces.export.test.ts)app.traceroot.aion a 123-span trace:traces get --jsonwith no flag → 0/123 spans with input (confirms the bug and the documented default)--fields full→ 120/123 spans with input--fields io,metadata→ same result asfull--fields bogus→ clean CLI error listing the valid groups (no stack trace)traces export --fields skeleton→spans.jsonwritten without I/Otraces exportwith no flag (default) →spans.jsonwritten with I/O--helpoutput for bothtraces getandtraces exportdocuments the default projection and how to override itSummary by cubic
Adds a
--fieldsprojection flag totraces getandtraces export, wiring it through the API client so you can requestfullor specific groups likeio,metadata. This also fixes missing span I/O intraces getand makesget/exportconsistent.New Features
--fields <groups>fortraces getandtraces export; forwarded to the server as?fields=....getTrace(traceId, { fields })andexportTrace(traceId, { fields }); only send the query when provided.traces getkeepsskeleton;traces exportkeepsfull. The flag overrides either.Bug Fixes
traces getnow sendsfieldswhen requested, fixing silentinput/output/metadata: nullresponses and aligning withexport.Written for commit 199ce67. Summary will update on new commits.