Cloud Resource Context

The Cloud Resource Context integration adds information about the cloud platform your app runs to errors and performance events.

Install

To install it, run:

Copied
pip install --upgrade 'sentry-sdk'

Configure

Add CloudResourceContextIntegration() to your integrations list:

Copied
import sentry_sdk
from sentry_sdk.integrations.cloud_resource_context import CloudResourceContextIntegration

sentry_sdk.init(
    dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
    integrations=[
        CloudResourceContextIntegration(),
    ],
)

Behavior

When the SDK starts up, information from the cloud provider the app is running in is retrieved and added to all error and performance events sent to Sentry. The developer documentation lists all the information that's being added.

In AWS EC2 the context looks like this:

AWS EC2 Cloud Resource Context in Sentry event

In Google Cloud Platform GCE the context looks like this:

Google GCE Cloud Resource Context in Sentry event

Supported Versions

  • Python: 3.6+
  • Cloud platforms: AWS EC2, Google Cloud Engine
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").