Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tracking failure handling (#1063) #1445

Merged
merged 2 commits into from
May 9, 2019

Conversation

beckjake
Copy link
Contributor

@beckjake beckjake commented May 8, 2019

Fixes #1063

Add a 1s timeout to tracking http calls
Add an on-failure handler that disables tracking after the first failure

To test this, I added this to my /etc/hosts: 127.0.0.1 fishtownanalytics.sinter-collect.com

Then I ran this from a root python prompt:

import socket
s = socket.socket()
s.bind(('localhost', 443))
conns = []
while True:
  conns.append(s.accept()[0])

And ran dbt run with tracking enabled in my profile. Before this change, dbt hangs forever. After, it pauses for 1 second once and then disables tracking until the next dbt invocation.

I chose this model over a thread-based one because it makes process teardown and cancellation a whole lot easier.

The only actual change to http_get in the overridden TimeoutEmitter is the timeout=1.0 argument to requests.get, the rest is just pep8 formatting.

I experimented with various times but I found anything longer than a second felt pretty annoying.

Add a 1s timeout to tracking http calls
Add an on-failure handler that disables tracking after the first failure
@beckjake beckjake requested a review from drewbanin May 8, 2019 15:51
Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

One tiny config change, otherwise LGTM! Glad we fixed this one

core/dbt/tracking.py Outdated Show resolved Hide resolved
@beckjake beckjake merged commit 8c7763a into dev/wilt-chamberlain May 9, 2019
@beckjake beckjake deleted the fix/anonymous-tracking-no-hangs branch May 9, 2019 16:47
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.

anonymous event tracking slows down dbt runs when there is no internet connection
2 participants