Repository navigation
chore: Update quickstart sample - #484
haiyuan-eng-google merged 5 commits into
Conversation
|
thanks @sararob for the contribution, can you help star the repo first and would take a look for the PR soon |
caohy1988
left a comment
There was a problem hiding this comment.
Thanks for replacing the made-up trace id with a runnable sample. I ran the new snippet's pure-Python parts against the SDK: every call is API-correct (Client(project_id, dataset_id, table_id, location), TraceFilter(limit=1), list_traces(), Trace.render()). Three inline suggestions on the placeholder values, plus one follow-up outside the diff:
The package docstring's Quick start:: block in src/bigquery_agent_analytics/__init__.py (around line 30) still shows the old client.get_trace("trace-123") sample this PR replaces, so help(bigquery_agent_analytics) and the README now disagree. Worth mirroring the new list_traces snippet there in this PR or a follow-up.
- Drop table_id="my_table" and location="my-location": the SDK defaults
to agent_events, which is what the Prerequisites and the LangSmith
example assume, and "my-location" is not a BigQuery location. Both
placeholders failed on the first query when left as-is; comments now
say when to set each.
- Add an else branch so an empty table prints "No traces found" instead
of exiting silently.
- Mirror the new list_traces sample in the package docstring, which still
showed the retired get_trace("trace-123") example.
|
Pushed |
caohy1988
left a comment
There was a problem hiding this comment.
Reviewed both changed quickstarts at fb75a4f. The README example works for both empty and populated results using the real SDK with cloud boundaries mocked, and the earlier table/location/empty-result suggestions are addressed.
One fix is needed before this is ready: update the two documentation regression tests that still require the removed get_trace("trace-...") examples. I also left an optional cleanup for an existing invalid insights call in the adjacent module example.
Validation: targeted documentation tests 2 failed / 4 passed; Client initialization/list tests 4 passed. The Python 3.11 CI job independently reports 2 failed / 5,176 passed / 80 skipped with those same two assertions; all five Python matrix jobs are currently red. No live BigQuery calls were made.
The two documentation regression tests still required the retired
get_trace("trace-...") sample in README and the package docstring,
which failed every Python job once this PR replaced it. They now assert
the new list_traces(TraceFilter(limit=1)) sample, that no fabricated
trace or session id remains, and that the docstring does not pass
max_sessions to Client.insights(). SDK.md still documents get_trace, so
its trace-id-vs-session-id checks are unchanged.
A new TestQuickStartSnippetsRun extracts both snippets from the files
and executes them as written with cloud I/O mocked at the SDK boundary,
on an empty table (README prints "No traces found") and a populated one
(the first trace is rendered), and checks the filter asks for one trace.
The docstring's insights(max_sessions=50) raised TypeError; max_sessions
belongs to InsightsConfig and already defaults to 50, so the call is now
client.insights() with a comment on how to change it.
caohy1988
left a comment
There was a problem hiding this comment.
Fresh review of the complete diff at 25e515c: the earlier documentation-test failures and invalid insights call are fixed. Both current quickstarts execute successfully with the real public SDK methods and mocked cloud I/O.
I found one remaining, nonblocking test issue: the new smoke tests accept unsupported API arguments because the public methods are replaced with unrestricted mocks. The inline comment includes a reproduced example and a small fix.
Validation: 127 passed across tests/test_pr16_fixes.py and tests/test_sdk_client.py; the current Python 3.10–3.14 CI matrix, formatting, browser smoke test, and package build are green. The Python 3.11 CI job reports 5,183 passed / 80 skipped. No live BigQuery or model calls were made.
Without autospec the patched list_traces and insights accepted any arguments, so a snippet that drifted to an unsupported keyword still passed. Both patches now keep the public signatures, the listing assertion accounts for the bound instance autospec passes through, and a negative test rewrites the docstring snippet to insights(max_sessions = 50), a spacing the literal docs guard would miss, and requires TypeError.
caohy1988
left a comment
There was a problem hiding this comment.
LGTM at a72234d. The latest commit closes the remaining test-fidelity finding: both public method mocks now preserve their signatures, the assertions handle the bound instance, and the negative regression rejects the unsupported max_sessions keyword. Earlier review findings are also addressed.
Validation: 128 passed across tests/test_pr16_fixes.py and tests/test_sdk_client.py on this exact head, including the new negative regression. Current CI is green. No blocking findings remain. No live cloud or model calls were made.
71c6ea3
into
GoogleCloudPlatform:main
…ap, dashboards extras Version bump 0.5.2 -> 0.5.3 and the changelog cut for everything merged since v0.5.2 (2026-09-05), 6 commits. No public API is removed or renamed. In the wheel: EventsTableNotFoundError, a NotFound subclass raised by get_trace() / list_traces() reads against a missing events table, naming the table, the location and the Client() arguments to check (#485, #486); the extractor-compilation smoke gate applies memory_limit_mb as headroom above the child's post-import address space instead of an absolute RLIMIT_AS (#480); new streamlit / dashboards extras, with all now including dashboards (#480); the package quick-start docstring (#484). Repo side: the Streamlit agent analytics dashboard (#480), grafana/ moved to dashboards/grafana/ (#481), ANALYST_TIMEOUT_S and the removal of the pre-#395 engine compat scaffolding in the skill-evolution job (#483), the OKF Attested Computation receipt spike (#479), and the README onboarding fixes (#484, #485). Entries the Unreleased section lacked are added in this cut: #479, #480, Deploy section, since deploy/ and scripts/ are not in the wheel. The #486 bullet is carried verbatim.
…ap, dashboards extras (#487) Version bump 0.5.2 -> 0.5.3 and the changelog cut for everything merged since v0.5.2 (2026-09-05), 6 commits. No public API is removed or renamed. In the wheel: EventsTableNotFoundError, a NotFound subclass raised by get_trace() / list_traces() reads against a missing events table, naming the table, the location and the Client() arguments to check (#485, #486); the extractor-compilation smoke gate applies memory_limit_mb as headroom above the child's post-import address space instead of an absolute RLIMIT_AS (#480); new streamlit / dashboards extras, with all now including dashboards (#480); the package quick-start docstring (#484). Repo side: the Streamlit agent analytics dashboard (#480), grafana/ moved to dashboards/grafana/ (#481), ANALYST_TIMEOUT_S and the removal of the pre-#395 engine compat scaffolding in the skill-evolution job (#483), the OKF Attested Computation receipt spike (#479), and the README onboarding fixes (#484, #485). Entries the Unreleased section lacked are added in this cut: #479, #480, Deploy section, since deploy/ and scripts/ are not in the wheel. The #486 bullet is carried verbatim.
No description provided.