-
Notifications
You must be signed in to change notification settings - Fork 609
docs: Build docs on Travis #63
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,5 +3,6 @@ github: | |
| owner: getsentry | ||
| repo: sentry-python | ||
| targets: | ||
| - name: github | ||
| - name: pypi | ||
| - name: github | ||
| - name: gh-pages | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ pip-log.txt | |
| .idea | ||
| .eggs | ||
| venv | ||
| .venv | ||
| .vscode/tags | ||
| .pytest_cache | ||
| .hypothesis | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,14 +28,20 @@ matrix: | |
| - python: "3.8-dev" | ||
| dist: xenial | ||
| sudo: true | ||
| - python: "3.6" | ||
|
|
||
| - name: Linting | ||
| python: "3.6" | ||
| install: | ||
| - pip install tox | ||
| script: tox -e linters | ||
| - python: "3.6" | ||
| env: DIST=1 | ||
| script: make dist | ||
| after_success: | ||
| - npm install -g @zeus-ci/cli | ||
| - zeus upload -t "application/zip+wheel" dist/* | ||
| name: Distribution packages | ||
| install: false | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit of optimization: I don't think we need Rust and tox for this job.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| script: make travis-upload-dist | ||
| - python: "3.6" | ||
| name: Build documentation | ||
| install: false | ||
| script: make travis-upload-docs | ||
|
|
||
| install: | ||
| - curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,38 +15,46 @@ | |
|
|
||
| Install this package with ``pip install sentry-sdk``. Then, in your code: | ||
|
|
||
| import sentry_sdk | ||
| sentry_sdk.init(dsn="https://[email protected]/123") | ||
| ```python | ||
| import sentry_sdk | ||
| sentry_sdk.init(dsn="https://[email protected]/123") | ||
| ``` | ||
|
|
||
| After initialization, you can capture exceptions like this: | ||
|
|
||
| sentry_sdk.capture_exception(ValueError()) | ||
| ```python | ||
| sentry_sdk.capture_exception(ValueError()) | ||
|
|
||
| try: | ||
| raise ValueError() | ||
| except Exception: | ||
| sentry_sdk.capture_exception() | ||
| try: | ||
| raise ValueError() | ||
| except Exception: | ||
| sentry_sdk.capture_exception() | ||
| ``` | ||
|
|
||
| ...or send messages: | ||
|
|
||
| sentry_sdk.capture_message("Hi Sentry!") | ||
| ```python | ||
| sentry_sdk.capture_message("Hi Sentry!") | ||
| ``` | ||
|
|
||
| ## Scopes (contexts, tags) | ||
|
|
||
| You can create a scope to attach data to all events happening inside of it: | ||
|
|
||
| with sentry_sdk.Hub.current.push_scope(): | ||
| with sentry_sdk.configure_scope() as scope: | ||
| scope.transaction = "my_view_name" | ||
| scope.set_tag("key", "value") | ||
| scope.user = {"id": 123} | ||
|
|
||
| # ValueError event will have all that data attached | ||
| capture_exception(ValueError()) | ||
| ```python | ||
| with sentry_sdk.Hub.current.push_scope(): | ||
| with sentry_sdk.configure_scope() as scope: | ||
| scope.transaction = "my_view_name" | ||
| scope.set_tag("key", "value") | ||
| scope.user = {"id": 123} | ||
|
|
||
| # This one not since it is outside of the context manager | ||
| # ValueError event will have all that data attached | ||
| capture_exception(ValueError()) | ||
|
|
||
| # This one not since it is outside of the context manager | ||
| capture_exception(ValueError()) | ||
| ``` | ||
|
|
||
| Scopes can be nested. If you call ``push_scope`` inside of the | ||
| ``with``-statement again, that scope will be pushed onto a stack. It will also | ||
| inherit all data from the outer scope. | ||
|
|
@@ -56,23 +64,29 @@ inherit all data from the outer scope. | |
| If you never call ``init``, no data will ever get sent to any server. In such | ||
| situations, code like this is essentially deadweight: | ||
|
|
||
| with sentry_sdk.configure_scope() as scope: | ||
| scope.user = _get_user_data() | ||
| ```python | ||
| with sentry_sdk.configure_scope() as scope: | ||
| scope.user = _get_user_data() | ||
| ``` | ||
|
|
||
| Sentry-Python supports an alternative syntax for configuring a scope that | ||
| solves this problem: | ||
|
|
||
| @sentry_sdk.configure_scope | ||
| def _(scope): | ||
| scope.user = _get_user_data() | ||
| ```python | ||
| @sentry_sdk.configure_scope | ||
| def _(scope): | ||
| scope.user = _get_user_data() | ||
| ``` | ||
|
|
||
| Your function will just not be executed if there is no client configured. | ||
|
|
||
| In your testing and development environment you still might want to run that | ||
| code without sending any events. In that case, simply call ``init`` without a | ||
| DSN: | ||
|
|
||
| sentry_sdk.init() | ||
| ```python | ||
| sentry_sdk.init() | ||
| ``` | ||
|
|
||
| ### Breadcrumbs | ||
|
|
||
|
|
@@ -81,23 +95,27 @@ anywhere in your system ends up as a breadcrumb, see [the logging | |
| docs](./docs/logging.md) for more information. You can, however, also create | ||
| breadcrumbs manually: | ||
|
|
||
| sentry_sdk.add_breadcrumb( | ||
| timestamp=datetime.datetime.now(), | ||
| type="log", | ||
| level="debug", | ||
| # message="hi", | ||
| # category="myapp.models", | ||
| }) | ||
| ```python | ||
| sentry_sdk.add_breadcrumb( | ||
| timestamp=datetime.datetime.now(), | ||
| type="log", | ||
| level="debug", | ||
| # message="hi", | ||
| # category="myapp.models", | ||
| }) | ||
| ``` | ||
|
|
||
| You can also pass a callback to `add_breadcrumb` like so: | ||
|
|
||
| sentry_sdk.add_breadcrumb(lambda: { | ||
| "timestamp": datetime.datetime.now(), | ||
| "type": "log", | ||
| "level": "debug", | ||
| # "message": "hi", | ||
| # "category": "myapp.models", | ||
| }) | ||
| ```python | ||
| sentry_sdk.add_breadcrumb(lambda: { | ||
| "timestamp": datetime.datetime.now(), | ||
| "type": "log", | ||
| "level": "debug", | ||
| # "message": "hi", | ||
| # "category": "myapp.models", | ||
| }) | ||
| ``` | ||
|
|
||
| The callback will only be called if a sentry client is configured. | ||
|
|
||
|
|
@@ -118,7 +136,9 @@ Currently Sentry-Python does not send any personally-identifiable user data | |
| with events by default. You need to explicitly enable this behavior with the | ||
| ``send_default_pii`` option passed to ``init``: | ||
|
|
||
| init(..., send_default_pii=True) | ||
| ```python | ||
| init(..., send_default_pii=True) | ||
| ``` | ||
|
|
||
| ## Integrations | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.