feat: add opt-in structured HTTP request logging via tracing#478
feat: add opt-in structured HTTP request logging via tracing#478
Conversation
Add PII-free structured logging controlled by two environment variables: - GOOGLE_WORKSPACE_CLI_LOG: stderr log filter (e.g., gws=debug) - GOOGLE_WORKSPACE_CLI_LOG_FILE: directory for JSON log files (daily rotation) Logging is silent by default (zero overhead). Instrumented sites: - executor.rs: API request/response (method, status, latency) - client.rs: 429 retry events - discovery.rs: cache hit vs network fetch
🦋 Changeset detectedLatest commit: 65e6bf9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the observability of the CLI by integrating a structured, opt-in logging system. It allows users to gain insights into HTTP request flows, rate-limiting events, and API discovery mechanisms without exposing sensitive information. The design prioritizes performance, ensuring that logging incurs no overhead unless explicitly enabled, and provides flexible output options for both human-readable and machine-parseable formats. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #478 +/- ##
==========================================
- Coverage 67.81% 67.67% -0.14%
==========================================
Files 38 39 +1
Lines 17136 17193 +57
==========================================
+ Hits 11621 11636 +15
- Misses 5515 5557 +42 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces an opt-in structured logging feature using the tracing ecosystem, which is a great addition for observability. The implementation is well-structured, with logging configuration neatly encapsulated in a new logging module. Logging is instrumented at key points for HTTP requests, rate-limit retries, and discovery cache events. Overall, this is a solid feature addition.
…orkspace#478) Add PII-free structured logging controlled by two environment variables: - GOOGLE_WORKSPACE_CLI_LOG: stderr log filter (e.g., gws=debug) - GOOGLE_WORKSPACE_CLI_LOG_FILE: directory for JSON log files (daily rotation) Logging is silent by default (zero overhead). Instrumented sites: - executor.rs: API request/response (method, status, latency) - client.rs: 429 retry events - discovery.rs: cache hit vs network fetch Co-authored-by: jpoehnelt-bot <jpoehnelt-bot@users.noreply.github.com>
Summary
Add PII-free structured logging for all HTTP requests using
tracing. Logging is completely silent by default (zero overhead) and controlled by two environment variables:GOOGLE_WORKSPACE_CLI_LOGGOOGLE_WORKSPACE_CLI_LOG_FILEWhat's logged
Only non-PII metadata: API method ID, HTTP method, status code, latency, content-type. No query parameters, tokens, bodies, or project IDs.
Instrumented sites
executor.rs— API request/response with latencyclient.rs— 429 rate-limit retry eventsdiscovery.rs— cache hit vs network fetchExample
Dependencies added
tracing(MIT) — instrumentationtracing-subscriber(MIT) — stderr + file layerstracing-appender(MIT) — daily rotating file writerAll maintained by the Tokio team, MIT-licensed (compatible with Apache-2.0).