fix(telemetry): print analytics banners to stderr instead of stdout#1003
Conversation
Co-Authored-By: AJ Steers <aj@airbyte.io>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This PyAirbyte VersionYou can test this version of PyAirbyte using the following: # Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1774295894-fix-telemetry-stdout' pyairbyte --help
# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1774295894-fix-telemetry-stdout'PR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful ResourcesCommunity SupportQuestions? Join the #pyairbyte channel in our Slack workspace. |
Co-Authored-By: AJ Steers <aj@airbyte.io>
There was a problem hiding this comment.
Pull request overview
This PR ensures PyAirbyte’s informational telemetry/analytics banners don’t interfere with program output by redirecting _setup_analytics() diagnostics from stdout to stderr, which is important when PyAirbyte is a transitive dependency in CLI scripting contexts.
Changes:
- Added
sysimport to support stderr output routing. - Updated the first-run telemetry notice, analytics ID override notice, and DEBUG-mode issues summary to print to
sys.stderr.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c59d9a3
into
main
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe change redirects telemetry-related informational messages, warnings, and debug output from stdout to stderr in the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Redirects all
print()calls in_setup_analytics()from stdout to stderr by addingfile=sys.stderr.Why: These diagnostic messages ("Thank you for using PyAirbyte!", analytics ID overrides, tracking config issues) are informational banners, not program output. When PyAirbyte is imported as a transitive dependency by CLI tools (e.g.,
airbyte-ops), shell captures likeRESULT=$(airbyte-ops some-command)inadvertently pick up the banner text instead of the intended output. This caused a production failure where a connector docker image was taggedairbyte/source-bing-ads:Thank you for using PyAirbyte!instead of the expected version string.Three
print()calls are affected, all in_setup_analytics():Review & Testing Checklist for Human
_setup_analytics()— a quickgrep -r "Thank you for using PyAirbyte" tests/should confirmsysimport doesn't conflict with anything (it shouldn't —sysis stdlib and wasn't previously imported in this file)Notes
The complementary workaround (
DO_NOT_TRACK=1) is being added to the airbyte repo'spublish_connectors.ymlworkflow as a belt-and-suspenders fix. This PR is the proper root-cause fix; the workflow change is defensive.Link to Devin session: https://app.devin.ai/sessions/edf592e70e4e4cdf885d2428192500ac
Requested by: Aaron ("AJ") Steers (@aaronsteers)
Summary by CodeRabbit