Cloud Resource Context
Learn about the Cloud Resource Context integration and how it adds information about the Cloud environment the project runs in.
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:
pip install --upgrade 'sentry-sdk'
Add CloudResourceContextIntegration()
to your integrations
list:
import sentry_sdk
from sentry_sdk.integrations.cloud_resource_context import CloudResourceContextIntegration
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
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:
In Google Cloud Platform GCE the context looks like this:
- Python: 3.6+
- Cloud platforms: Amazon EC2, Google Compute Engine
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").