ploomber / ploomber-engine

A toolbox 🧰 for Jupyter notebooks 📙: testing, experiment tracking, debugging, profiling, and more!
https://engine.ploomber.io
BSD 3-Clause "New" or "Revised" License
59 stars 14 forks source link

optional posthog #98

Open vijayvammi opened 1 month ago

vijayvammi commented 1 month ago

Hi Eduardo,

Noticing that ploomber-core depends on posthog for telemetry, may be?

The worrying thing is its attempt to log into an external end point, us-api.i.posthog.com

Traceback (most recent call last): File "/Users/kxvn318/.pyenv/versions/3.9.16/lib/python3.9/logging/init.py", line 1086, in emit stream.write(msg + self.terminator) ValueError: I/O operation on closed file. Call stack: File "/Users/kxvn318/.pyenv/versions/3.9.16/lib/python3.9/threading.py", line 937, in _bootstrap self._bootstrap_inner() File "/Users/kxvn318/.pyenv/versions/3.9.16/lib/python3.9/threading.py", line 980, in _bootstrap_inner self.run() File "/Users/kxvn318/Library/Caches/pypoetry/virtualenvs/runnable-QaOCn3sv-py3.9/lib/python3.9/site-packages/posthog/consumer.py", line 65, in run self.upload() File "/Users/kxvn318/Library/Caches/pypoetry/virtualenvs/runnable-QaOCn3sv-py3.9/lib/python3.9/site-packages/posthog/consumer.py", line 81, in upload self.request(batch) File "/Users/kxvn318/Library/Caches/pypoetry/virtualenvs/runnable-QaOCn3sv-py3.9/lib/python3.9/site-packages/posthog/consumer.py", line 148, in request send_request() File "/Users/kxvn318/Library/Caches/pypoetry/virtualenvs/runnable-QaOCn3sv-py3.9/lib/python3.9/site-packages/backoff/_sync.py", line 105, in retry ret = target(*args, *kwargs) File "/Users/kxvn318/Library/Caches/pypoetry/virtualenvs/runnable-QaOCn3sv-py3.9/lib/python3.9/site-packages/backoff/_sync.py", line 20, in _call_handlers hdlr(details) File "/Users/kxvn318/Library/Caches/pypoetry/virtualenvs/runnable-QaOCn3sv-py3.9/lib/python3.9/site-packages/backoff/_common.py", line 120, in _log_giveup logger.log(log_level, msg, log_args) Message: 'Giving up %s(...) after %d tries (%s)' Arguments: ('send_request', 4, "requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='us-api.i.posthog.com', port=443): Max retries exceeded with url: /batch/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x11c10c730>, 'Connection to us-api.i.posthog.com timed out. (connect timeout=15)'))")

1). Could we make it optional install? I set up the _PLOOMBER_TELEMETRY_DEBUG to but I still see an attempt to do telemetry.

Cheers, Vijay

edublancas commented 1 month ago

hi, you can disable telemetry with:

export PLOOMBER_STATS_ENABLED=false

I think you'll still need to have posthog installed, otherwise importing the package will break, but this will disable external API calls. let me know if you still have issues after disabling it