Skip to content

fix: reduce snowplow telemetry timeout from 5s to 1s#12741

Open
claygeo wants to merge 3 commits intodbt-labs:mainfrom
claygeo:fix/snowplow-quick-connection-timeout
Open

fix: reduce snowplow telemetry timeout from 5s to 1s#12741
claygeo wants to merge 3 commits intodbt-labs:mainfrom
claygeo:fix/snowplow-quick-connection-timeout

Conversation

@claygeo
Copy link
Copy Markdown
Contributor

@claygeo claygeo commented Mar 30, 2026

Summary

Fixes #9989

An unreachable snowplow collector previously stalled dbt for up to several seconds (or longer when the underlying TCP stack holds the connection open past the application timeout) at the end of every invocation.

Reduces both the POST and GET timeouts in TimeoutEmitter from 5.0 to 1.0 seconds so the failure is near-instant for users with no internet access or a firewalled collector endpoint.

Test plan

  • python -m pytest tests/unit/test_tracking.py -v — 7 tests pass
  • New tests in TestTimeoutEmitter verify both HTTP methods use a timeout ≤ 2s
  • Manual: disconnect from internet, run dbt run — should exit within ~1s of the last model finishing rather than hanging 5+ seconds

@claygeo claygeo requested a review from a team as a code owner March 30, 2026 01:23
@cla-bot cla-bot bot added the cla:yes label Mar 30, 2026
@github-actions github-actions bot added the community This PR is from a community member label Mar 30, 2026
claygeo added a commit to claygeo/dbt-core that referenced this pull request Mar 30, 2026
claygeo added a commit to claygeo/dbt-core that referenced this pull request Mar 30, 2026
@claygeo claygeo force-pushed the fix/snowplow-quick-connection-timeout branch from 84acb92 to 2871e9e Compare March 30, 2026 17:30
claygeo added a commit to claygeo/dbt-core that referenced this pull request Mar 30, 2026
@claygeo claygeo force-pushed the fix/snowplow-quick-connection-timeout branch from 2871e9e to 16bdeb8 Compare March 30, 2026 18:30
claygeo added a commit to claygeo/dbt-core that referenced this pull request Mar 30, 2026
@claygeo claygeo force-pushed the fix/snowplow-quick-connection-timeout branch from 16bdeb8 to 6905e64 Compare March 30, 2026 18:39
claygeo added 2 commits April 1, 2026 11:23
An unreachable snowplow collector previously stalled dbt for up to 5s
(or longer if the underlying TCP stack held the connection open) at the
end of every invocation. Reduce both the POST and GET timeouts in
TimeoutEmitter to 1s so the failure is near-instant for users with no
internet access or a firewalled collector endpoint.

Closes dbt-labs#9989
@claygeo claygeo force-pushed the fix/snowplow-quick-connection-timeout branch from 6905e64 to 5751f0e Compare April 1, 2026 15:23
assert dbt.tracking.active_user.do_not_track != send_anonymous_usage_stats


<<<<<<< HEAD
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks unintentional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This changelog looks extraneous given the one above that references #9989

timeout=5.0,
# Keep the timeout short so that a missing or unreachable collector
# does not noticeably delay the end of every dbt invocation.
# See https://github.com/dbt-labs/dbt-core/issues/9989
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.20%. Comparing base (27f64cf) to head (5751f0e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12741      +/-   ##
==========================================
- Coverage   91.39%   88.20%   -3.19%     
==========================================
  Files         203      203              
  Lines       25841    25841              
==========================================
- Hits        23617    22794     -823     
- Misses       2224     3047     +823     
Flag Coverage Δ
integration 88.20% <0.00%> (ø)
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 88.20% <0.00%> (-3.19%) ⬇️
Integration Tests 88.20% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Addresses review feedback:
- Remove leftover <<<<<<< HEAD conflict marker in test_tracking.py
- Remove duplicate changelog YAML (the original Fixes-20260329 entry
  already covers this change)
@claygeo
Copy link
Copy Markdown
Contributor Author

claygeo commented Apr 2, 2026

@MichelleArk Thanks for catching those — fixed both:

  1. Removed the stray <<<<<<< HEAD conflict marker in test_tracking.py (leftover from a rebase)
  2. Removed the duplicate changelog entry (Fixes-20260330-...yaml) since Fixes-20260329-190000.yaml already covers the change

All commits are GPG signed.

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

Labels

cla:yes community This PR is from a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Quick connection timeout for anonymous snowplow tracking

2 participants