question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve documentation for configure_scope()

See original GitHub issue

The current documentation does not make it clear whether this code is permanent or if it is reverted as soon as the with block is exited:

from sentry_sdk import configure_scope

with configure_scope() as scope:
    scope.set_tag("my-tag", "my value")
    scope.user = {'id': 42, 'email': 'john.doe@example.com'}

I assume it is permanent, because if it is not then there would be no difference from push_scope, but it should be made explicit with an example (the opposite of the example given for push_scope would make it clear).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
untitakercommented, Jun 18, 2019

@aviv-ebates nothing. it will be gone or at least superseded soon. configure_scope is a concept that didn’t translate well to python from other languages

5reactions
beaugundersoncommented, Nov 30, 2018

This is the one that contains the counter-example:

https://docs.sentry.io/enriching-error-data/scopes/?platform=python

from sentry_sdk import push_scope, capture_exception

with push_scope() as scope:
    scope.set_tag("my-tag", "my value")
    scope.level = 'warning'
    # will be tagged with my-tag="my value"
    capture_exception(Exception("my error"))

# will not be tagged with my-tag
capture_exception(Exception("my other error"))

Inverting that example would give something like this:

from sentry_sdk import configure_scope, capture_exception

with configure_scope() as scope:
    scope.set_tag("my-tag", "my value")
    scope.level = 'warning'
    # will be tagged with my-tag="my value"
    capture_exception(Exception("my error"))

# will also be tagged with my-tag
capture_exception(Exception("my other error"))
Read more comments on GitHub >

github_iconTop Results From Across the Web

Scopes and Hubs for JavaScript | Sentry Documentation
The most useful operation when working with scopes is the configure-scope function. It can be used to reconfigure the current scope. You'll first...
Read more >
Sentry.configureScope, do not execute callback if there is no ...
Using expressjs im creating scope using given code (similar to it). Sentry.configureScope((scope: Scope) => { // some code scope.setUser(req.
Read more >
Unified API - Sentry Developer Documentation
This documentation explains what the unified API is and why it exists. ... Hub::pop_scope() (optional): Only exists in languages without better resource ...
Read more >
Manual | Sentry .NET
You can create new scopes, which will clone the previous but will be totally isolated from it. The scope can be configured through:...
Read more >
Can we send additional data to Sentry? [#3254091] | Drupal.org
We may need to improve the documentation a bit here :) Log in or register to post comments. mfb's picture. Comment #3.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found