Cloud Resource Context

The Cloud Resource Context integration adds information about the cloud platform your app runs to errors and performance events. Currently Amazon EC2 and Google Compute Engine are supported.

To install it, run:

Copied
pip install --upgrade 'sentry-sdk'

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",
    enable_tracing=True,
    integrations=[
        CloudResourceContextIntegration(),
    ],
)

Trigger an error in the code running in your cloud and see the error and performance data show up in sentry.io. It takes a couple of moments for the performance data to show up in sentry.io.

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

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