-
Notifications
You must be signed in to change notification settings - Fork 134
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
added initial telemetry work #386
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @pawelsz-rb. I think this is a good start, but a lot of the Telemetry's functionality is missing or not working correctly.
I left some inline comments. Here's also a quick summary of what at first glance is missing:
- Architecture and API for Telemetry must be well designed.
- Telemetry doesn't work with most supported web frameworks. I was able to log telemetry while using Starlette or FastAPI, but e.g. Flask or Django has a cold start (no Telemetry data in the first occurrence). Other frameworks also don't work well.
- The Telemetry events history should be local for each HTTP request.
report_message()
includes global Telemetry history for each call.- Network telemetry should fully support the
urllib
,requests
, andhttpx
packages. - Network telemetry should support non-HTTP network events (like DNS errors).
- Telemetry should support User Inputs events by extracting the request object
- Missing tests for provided functionality and supported frameworks.
to enable telemetry, put that in init:
logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s")
rollbar.init('access_token', log_telemetry=True, log_telemetry_formatter=logFormatter,
network_telemetry=True, enable_response_headers=True, enable_req_headers=True)
It's overcomplicated. The default formatter and other flags should be SDK-initialized defaults.
I would expect to enable telemetry with something more user-friendly like:
rollbar.init('access_token', telemetry=True)
.
Other options should be optional.
- FLASK_VERSION=0.10.1 Werkzeug\>=0.7,\<1.0 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- FLASK_VERSION=0.11.1 Werkzeug\>=0.7,\<1.0 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- FLASK_VERSION=0.12.4 Werkzeug\>=0.7,\<1.0 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- FLASK_VERSION=1.0.2 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- TWISTED_VERSION=15.5.0 treq==15.1.0 zope.interface==4.1.3 mock==2.0.0 | ||
- TWISTED_VERSION=16.1.0 treq==16.12.0 zope.interface==4.1.3 mock==2.0.0 | ||
- TWISTED_VERSION=16.2.0 treq==16.12.0 zope.interface==4.1.3 mock==2.0.0 | ||
- TWISTED_VERSION=16.3.0 treq==16.12.0 zope.interface==4.2.0 mock==2.0.0 | ||
- TWISTED_VERSION=16.4.0 treq==16.12.0 zope.interface==4.5.0 mock==2.0.0 | ||
- TWISTED_VERSION=16.5.0 treq==16.12.0 zope.interface==4.5.0 mock==2.0.0 | ||
- TWISTED_VERSION=16.6.0 treq==16.12.0 zope.interface==4.5.0 mock==2.0.0 | ||
- TWISTED_VERSION=17.1.0 treq==16.12.0 zope.interface==4.5.0 mock==2.0.0 | ||
- DJANGO_VERSION=1.11.20 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- DJANGO_VERSION=2.0.13 mock==2.0.0 | ||
- DJANGO_VERSION=2.1.7 mock==2.0.0 | ||
- DJANGO_VERSION=2.1.15 mock==2.0.0 | ||
- PYRAMID_VERSION=1.9.2 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- PYRAMID_VERSION=1.10.4 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- STARLETTE_VERSION=0.12.12 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- STARLETTE_VERSION=0.12.13 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- STARLETTE_VERSION=0.14.2 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- FASTAPI_VERSION=0.40.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- FASTAPI_VERSION=0.63.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All Python versions from the matrix except 2.7 have the mock
module included in the standard library. We don't need to install it manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but it does not hurt to install it, and just for that I would need to pull 2.7 out of this matrix and have a different definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO requiring the installation of unnecessary packages hurts quality.
Our other test suites solve it in this way:
pyrollbar/rollbar/test/test_rollbar.py
Lines 14 to 17 in f67253a
try: | |
from unittest import mock | |
except ImportError: | |
import mock |
You should follow the pattern. In my opinion, this PR does not require any changes in the CI builds. The builds failed for a good reason.
The installation of the mock
package for Python <3.3 is already implemented:
Lines 20 to 24 in f67253a
tests_require = [ | |
'webob', | |
'blinker', | |
'unittest2', | |
'mock<=3.0.5; python_version < "3.3"', |
framework: DJANGO_VERSION=2.0.13 | ||
framework: DJANGO_VERSION=2.0.13 mock==2.0.0 | ||
- python-version: 2.7 | ||
framework: DJANGO_VERSION=2.1.7 | ||
framework: DJANGO_VERSION=2.1.7 mock==2.0.0 | ||
- python-version: 2.7 | ||
framework: DJANGO_VERSION=2.1.15 | ||
framework: DJANGO_VERSION=2.1.15 mock==2.0.0 | ||
- python-version: 3.4 | ||
framework: DJANGO_VERSION=2.1.7 | ||
framework: DJANGO_VERSION=2.0.13 mock==2.0.0 | ||
- python-version: 3.4 | ||
framework: DJANGO_VERSION=2.1.15 | ||
framework: DJANGO_VERSION=2.1.7 mock==2.0.0 | ||
- python-version: 3.4 | ||
framework: DJANGO_VERSION=2.1.15 mock==2.0.0 | ||
- python-version: 3.5 | ||
framework: DJANGO_VERSION=2.1.15 mock==2.0.0 | ||
- python-version: 3.5 | ||
framework: DJANGO_VERSION=2.0.13 mock==2.0.0 | ||
- python-version: 3.5 | ||
framework: DJANGO_VERSION=2.1.15 | ||
framework: DJANGO_VERSION=2.1.7 mock==2.0.0 | ||
- python-version: 3.6 | ||
framework: DJANGO_VERSION=2.1.15 | ||
framework: DJANGO_VERSION=2.1.15 mock==2.0.0 | ||
- python-version: 3.7 | ||
framework: DJANGO_VERSION=2.1.15 | ||
framework: DJANGO_VERSION=2.1.15 mock==2.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a result of the comment above these changes are also not required.
framework: STARLETTE_VERSION=0.12.12 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.12.12 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 2.7 | ||
framework: STARLETTE_VERSION=0.12.13 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.12.13 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 2.7 | ||
framework: STARLETTE_VERSION=0.14.2 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.14.2 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: STARLETTE_VERSION=0.12.12 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.12.12 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: STARLETTE_VERSION=0.12.13 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.12.13 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: STARLETTE_VERSION=0.14.2 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.14.2 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: STARLETTE_VERSION=0.12.12 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.12.12 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: STARLETTE_VERSION=0.12.13 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.12.13 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: STARLETTE_VERSION=0.14.2 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: STARLETTE_VERSION=0.14.2 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
|
||
- python-version: 2.7 | ||
framework: FASTAPI_VERSION=0.40.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.40.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 2.7 | ||
framework: FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 2.7 | ||
framework: FASTAPI_VERSION=0.63.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.63.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: FASTAPI_VERSION=0.40.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.40.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: FASTAPI_VERSION=0.63.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.63.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: FASTAPI_VERSION=0.40.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.40.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: FASTAPI_VERSION=0.63.0 httpx==0.18.1 python-multipart==0.0.5 | ||
framework: FASTAPI_VERSION=0.63.0 httpx==0.18.1 python-multipart==0.0.5 mock==3.0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
framework: FLASK_VERSION=0.10.1 | ||
framework: FLASK_VERSION=0.10.1 mock==2.0.0 | ||
- python-version: 3.3 | ||
framework: FLASK_VERSION=0.11.1 | ||
framework: FLASK_VERSION=0.11.1 mock==2.0.0 | ||
- python-version: 3.3 | ||
framework: FLASK_VERSION=0.12.4 | ||
framework: FLASK_VERSION=0.12.4 mock==2.0.0 | ||
- python-version: 3.3 | ||
framework: FLASK_VERSION=1.0.2 | ||
framework: FLASK_VERSION=1.0.2 mock==2.0.0 | ||
- python-version: 3.3 | ||
framework: DJANGO_VERSION=1.6.11 | ||
framework: DJANGO_VERSION=1.6.11 mock==2.0.0 | ||
- python-version: 3.3 | ||
framework: DJANGO_VERSION=1.8.19 | ||
framework: DJANGO_VERSION=1.8.19 mock==2.0.0 | ||
- python-version: 3.4 | ||
framework: DJANGO_VERSION=1.7.11 | ||
framework: DJANGO_VERSION=1.7.11 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: DJANGO_VERSION=1.8.19 | ||
framework: DJANGO_VERSION=1.8.19 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: DJANGO_VERSION=1.9.13 | ||
framework: DJANGO_VERSION=1.9.13 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: DJANGO_VERSION=1.10.8 | ||
framework: DJANGO_VERSION=1.10.8 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- python-version: 3.4 | ||
framework: DJANGO_VERSION=2.0.13 chardet==3.0.4 idna==2.7 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: DJANGO_VERSION=1.8.19 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: DJANGO_VERSION=1.9.13 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: DJANGO_VERSION=1.8.19 | ||
framework: DJANGO_VERSION=1.10.8 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: DJANGO_VERSION=1.9.13 | ||
framework: DJANGO_VERSION=2.0.13 mock==3.0.5 | ||
- python-version: 3.5 | ||
framework: DJANGO_VERSION=1.10.8 | ||
framework: DJANGO_VERSION=2.1.7 mock==3.0.5 | ||
- python-version: 3.7 | ||
framework: TWISTED_VERSION=18.9.0 treq==20.4.1 zope.interface==4.5.0 | ||
framework: TWISTED_VERSION=18.9.0 treq==20.4.1 zope.interface==4.5.0 mock==3.0.5 | ||
- python-version: 3.7 | ||
framework: TWISTED_VERSION=19.10.0 treq==20.4.1 zope.interface==4.6.0 | ||
framework: TWISTED_VERSION=19.10.0 treq==20.4.1 zope.interface==4.6.0 mock==3.0.5 | ||
- python-version: 3.7 | ||
framework: TWISTED_VERSION=20.3.0 treq==20.4.1 zope.interface==4.7.0 | ||
framework: TWISTED_VERSION=20.3.0 treq==20.4.1 zope.interface==4.7.0 mock==3.0.5 | ||
- python-version: 3.8 | ||
framework: TWISTED_VERSION=18.9.0 treq==20.4.1 zope.interface==4.5.0 | ||
framework: TWISTED_VERSION=18.9.0 treq==20.4.1 zope.interface==4.5.0 mock==3.0.5 | ||
- python-version: 3.8 | ||
framework: TWISTED_VERSION=19.10.0 treq==20.4.1 zope.interface==4.6.0 | ||
framework: TWISTED_VERSION=19.10.0 treq==20.4.1 zope.interface==4.6.0 mock==3.0.5 | ||
- python-version: 3.8 | ||
framework: TWISTED_VERSION=20.3.0 treq==20.4.1 zope.interface==4.7.0 | ||
framework: TWISTED_VERSION=20.3.0 treq==20.4.1 zope.interface==4.7.0 mock==3.0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python 3.3+ includes the mock
module. I don't think it is necessary.
def test_telemetry_request(self, timestamp): | ||
timestamp.return_value = 1000000 | ||
|
||
requests.get("http://example.com") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can stub the actual HTTP connection since you don't return the response object.
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Co-authored-by: Bart Skowron <[email protected]>
Description of the change
to enable telemetry, put that in init:
Type of change
Related issues
Checklists
Development
Code review