A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.sentry.io/platforms/python/ below:

Python | Sentry for Python

Prerequisites Features

Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.

Error Monitoring Logs Tracing Profiling

Install

Install the Sentry SDK using pip :

Configure

Configuration should happen as early as possible in your application's lifecycle.

Copied

import sentry_sdk

sentry_sdk.init(
    dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
    
    
    send_default_pii=True,
    
    
    
    traces_sample_rate=1.0,
    
    
    
    
    profile_session_sample_rate=1.0,
    
    
    profile_lifecycle="trace",
    
    

    
    _experiments={"enable_logs": True},
    
)

However, in async applications, you need to call sentry_sdk.init() inside an async function to ensure async code is instrumented properly. We recommend calling sentry_sdk.init() at the beginning of the first async function you call, as demonstrated in the example below.

Copied

import asyncio
import sentry_sdk

async def main():
    sentry_sdk.init(
        ...  
    )

asyncio.run(main())
Verify

Add this intentional error to your application to test that everything is working right away.

To view and resolve the recorded error, log into sentry.io and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.

Not seeing your error in Sentry? Make sure you're running the above example from a file and not from a Python shell like IPython.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4