Closed
Labels
Component: SDK CoreDealing with the core of the SDK
Description
Problem Statement
When a user gets an error or transacation (performance event) in Sentry they may not know the specific of where that particular service is hosted. Where possible it would be great to know some contextual information about where that service is hosted to speed up problem solving and eventually deploying a fix
example data
cloud:
provider: aws|gcp|azure
region: ...
[account|project]_id: ...
service: ec2, cloud-functions, ...
resource: <ARN>
Solution Brainstorm
Add this data using the Contexts Interface of the event payload
- Define a standard set of contextual data:
- example above
- determine how to fetch that data from top hosting platforms
- AWS
- GCP
- Azure
- Vercel
- Netlify
- others?
- Python SDK should check for this context and populate it in the event when possible
- relay changes needed prior to
Future considerations:
- contexts should be searchable in product, changes will be needed in sentry backend so this data can be used to filter issues
Reacted by Michael Warkentin
Reacted by Michael Warkentin and Bruno Garcia
Metadata
Metadata
Assignees
Labels
Component: SDK CoreDealing with the core of the SDK
Activity
mwarkentin commentedon Jan 4, 2023
Netlify Functions doesn't support Python so we can remove that from the list:
Some other platforms to consider:
sl0thentr0py commentedon Jan 5, 2023
Resources (will update as I find more):
mwarkentin commentedon Jan 5, 2023
AWS has similar: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
AbhiPrasad commentedon Jan 10, 2023
In OpenTelemetry they have the
resourceentity, which represent the env that produces a set of telemetry data: https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/We can model our solution after this.
antonpirker commentedon Jan 31, 2023
Here the PR for develop docs of cloud hosting context: getsentry/develop#825
antonpirker commentedon Feb 6, 2023
For AWS stuff to keep in mind:
When we have this, I think we covered AWS.
Note: maybe some documentation changes for AWS Lambda setup without our layer are needed.
antonpirker commentedon Feb 6, 2023
Open question: how to auto detect if the cloud context should be added?
mwarkentin commentedon Feb 6, 2023
Default lambda env vars: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
antonpirker commentedon Feb 7, 2023
This is now the data we get from AWS EC2:

And this is the data we get from GCE:

antonpirker commentedon Feb 8, 2023
Just fyi @mwarkentin : We will start with "only" ECS and GCE to be supported. The implementation is a
CloudContextIntegrationthe users have to add to thesentry_sdk.init(integrations=[...])list by hand for the cloud context to be added.antonpirker commentedon Feb 8, 2023
Documentation updates for this new integration:
[-]Add cloud hosting context[/-][+]Add cloud resource context[/+]AbhiPrasad commentedon Feb 10, 2023
@antonpirker we'll also have to add this to relay now: https://github.com/getsentry/relay/tree/master/relay-general/src/protocol/contexts
antonpirker commentedon Feb 10, 2023
Oh cool, did not know that. I thought relay can ingest all the contexts
AbhiPrasad commentedon Feb 10, 2023
It does - but this allows it to be well defined, which opens the door for product to do stuff with it!
antonpirker commentedon Feb 16, 2023
Context definition in relay PR: getsentry/relay#1854