getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
38.49k stars 4.11k forks source link

Allow direct creation of environments in Sentry before sending an event to that environment #69546

Open cstavitsky opened 4 months ago

cstavitsky commented 4 months ago

Problem Statement

Asking on behalf of a customer.

The context for usage is with Terraform, but this is a problem that isn't limited to Terraform IMO, so I'm putting this issue in the main Sentry repo.

For issue alerts we are creating a baseline of alerts for each project in each environment. However at that moment the environments are not created yet for all projects, which seem to block us from creating the alerts. Is there a way to create the alert for an environment that has not received data yet ?

Error message received is: "This environment has not been created."(I believe this comes from here although I don't see where this function is called.)

It's currently possible to work around this by sending a test event to Sentry with the CLI tool in a given environment... or initializing the SDK (Docs)... because now the environment will exist, so the error quoted above won't happen anymore. However, this workaround step feels clunky. Can we offer the ability to create environments more directly, without needing to send an event?

The customer's reason for asking for this:

We realized that if we sent data to the failing environment in ANY project, then the issue would go away for ALL alerts on ALL the other projects. So we sent a test event in the various envs that were failing and it seems to have fixed the issue for now. Note that we are planning to leverage more dynamic environments in the near future so this may become a blocker again at some point though. This really is in a context of infrastructure as code where the provisioning of the projects (and alerts) is done by a different team than the one actually sending the events. In that case we want to reduce the back and forth between the teams and offer a “battery included” solution to our developers.

So to restate overall:

Solution Brainstorm

Maybe we could offer the ability to create an environment for the org directly via a public API endpoint?

This could then also be leveraged by Sentry's Terraform integration.

Product Area

APIs

getsantry[bot] commented 4 months ago

Routing to @getsentry/product-owners-apis for triage ⏲️

getsantry[bot] commented 4 months ago

Assigning to @getsentry/support for routing ⏲️

Dhrumil-Sentry commented 4 months ago

This is a valid request, Adding this to our backlog but we don't plan to work on this in the next couple of months. We will comment here as we have any updates