Skip to content

fix(telemetry): print analytics banners to stderr instead of stdout#1003

Merged
Aaron ("AJ") Steers (aaronsteers) merged 2 commits intomainfrom
devin/1774295894-fix-telemetry-stdout
Mar 23, 2026
Merged

fix(telemetry): print analytics banners to stderr instead of stdout#1003
Aaron ("AJ") Steers (aaronsteers) merged 2 commits intomainfrom
devin/1774295894-fix-telemetry-stdout

Conversation

@aaronsteers
Copy link
Copy Markdown
Member

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Mar 23, 2026

Summary

Redirects all print() calls in _setup_analytics() from stdout to stderr by adding file=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 like RESULT=$(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 tagged airbyte/source-bing-ads:Thank you for using PyAirbyte! instead of the expected version string.

Three print() calls are affected, all in _setup_analytics():

  1. The first-run telemetry notice (line 105)
  2. The analytics ID override notice (line 131)
  3. The DEBUG-mode issues summary (line 153)

Review & Testing Checklist for Human

  • Verify no tests assert against stdout content from _setup_analytics() — a quick grep -r "Thank you for using PyAirbyte" tests/ should confirm
  • Confirm the sys import doesn't conflict with anything (it shouldn't — sys is stdlib and wasn't previously imported in this file)

Notes

The complementary workaround (DO_NOT_TRACK=1) is being added to the airbyte repo's publish_connectors.yml workflow 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

  • Chores
    • Updated message output handling to direct informational messages, warnings, and debug information to the error stream for improved log organization and scripting compatibility.

Open with Devin

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This PyAirbyte Version

You 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 Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /uv-lock - Updates uv.lock file
  • /test-pr - Runs tests with the updated PyAirbyte
  • /prerelease - Builds and publishes a prerelease version to PyPI
📚 Show Repo Guidance

Helpful Resources

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

Co-Authored-By: AJ Steers <aj@airbyte.io>
@aaronsteers Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review March 23, 2026 20:08
Copilot AI review requested due to automatic review settings March 23, 2026 20:08
@github-actions
Copy link
Copy Markdown

PyTest Results (Fast Tests Only, No Creds)

343 tests  ±0   343 ✅ ±0   5m 20s ⏱️ -14s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit c5f8095. ± Comparison against base commit 9d9e91b.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sys import 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.

@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit c59d9a3 into main Mar 23, 2026
26 of 27 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the devin/1774295894-fix-telemetry-stdout branch March 23, 2026 20:09
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The change redirects telemetry-related informational messages, warnings, and debug output from stdout to stderr in the _setup_analytics() function by importing sys and specifying sys.stderr as the output destination for three existing messages.

Changes

Cohort / File(s) Summary
Telemetry Output Redirection
airbyte/_util/telemetry.py
Imported sys and redirected three user-facing messages in _setup_analytics() to sys.stderr: the anonymous usage reporting notice, analytics ID mismatch warning, and debug-mode issue report. No changes to telemetry logic or behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: redirecting telemetry/analytics messages from stdout to stderr in the _setup_analytics() function.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch devin/1774295894-fix-telemetry-stdout

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants