Skip to content

feat(seer-infra-telemetry): Implement monitoring provider connection API endpoints#117854

Merged
shashjar merged 12 commits into
masterfrom
shashjar/add-monitoring-provider-connection-API-endpoints
Jun 16, 2026
Merged

feat(seer-infra-telemetry): Implement monitoring provider connection API endpoints#117854
shashjar merged 12 commits into
masterfrom
shashjar/add-monitoring-provider-connection-API-endpoints

Conversation

@shashjar

@shashjar shashjar commented Jun 16, 2026

Copy link
Copy Markdown
Member

Recreated after reverting #117478.

Depends on #117851.

Resolves https://linear.app/getsentry/issue/CW-1499/monitoring-provider-connection-api-endpoints.

Adds API endpoints for listing, connecting, and disconnecting monitoring providers (currently Datadog & GCP). These endpoints wrap the existing identity pipeline to let users initiate the per-user OAuth flow for connecting their monitoring provider accounts to Sentry. The identity providers for Datadog & GCP were previously implemented in #117035 & #117279, respectively.

All endpoints are gated behind the organizations:seer-infra-telemetry feature flag, which is enabled only internally in the Sentry org for now. Note that monitoring provider connections are per-user (each user links their own account via OAuth), not per-organization.

There is some provider-specific config baked into this implementation: Datadog requires a site parameter in the POST body (e.g. datadoghq.com) for site resolution, while GCP needs no extra config. For Datadog, the IdentityProvider is not created in the POST endpoint; it is auto-created by IdentityPipeline.finish_pipeline() using the Datadog org UUID from the MCP whoami response as the external ID (see #117491 & #117705). For GCP, the IdentityProvider is created upfront by the endpoint.

GET /api/0/organizations/{org}/monitoring-providers/ lists the available providers and the current user's connection status. This will be used to inform the monitoring provider settings UI tracked in https://linear.app/getsentry/issue/CW-1500/monitoring-providers-settings-page.

POST /api/0/organizations/{org}/monitoring-providers/{provider}/ represents a request to connect a given monitoring provider for a given user. It initiates the OAuth flow and returns a redirect URL to the provider's authorize page, based on the identity pipeline for that provider.

DELETE /api/0/organizations/{org}/monitoring-providers/{provider}/ represents a request to disconnect/delete a given monitoring provider for a given user. It deletes the current user's linked identity for that provider, if one exists.

Note on support for a single user connecting multiple Datadog orgs:

  • For v0, we're mainly considering the case where a user has a single Datadog org connected, but in the future we will support multiple
  • The GET endpoint currently collapses to one entry per provider type (shows connected: true if any exist
  • The POST endpoint currently allows multiple connections to be created
  • The DELETE endpoint currently deletes all identities for the provider (idp__type=provider_key)

@linear-code

linear-code Bot commented Jun 16, 2026

Copy link
Copy Markdown

CW-1499

@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Jun 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@shashjar shashjar marked this pull request as ready for review June 16, 2026 20:55
@shashjar shashjar requested review from a team as code owners June 16, 2026 20:55
@shashjar shashjar requested review from srest2021 and wedamija and removed request for a team June 16, 2026 20:55
shashjar added a commit that referenced this pull request Jun 16, 2026
Comment thread src/sentry/identity/base.py
Comment thread src/sentry/identity/base.py
@shashjar shashjar merged commit afe75f3 into master Jun 16, 2026
67 checks passed
@shashjar shashjar deleted the shashjar/add-monitoring-provider-connection-API-endpoints branch June 16, 2026 21:11
vgrozdanic pushed a commit that referenced this pull request Jun 16, 2026
vgrozdanic pushed a commit that referenced this pull request Jun 16, 2026
…API endpoints (#117854)

Recreated after reverting
#117478.

Depends on #117851.

Resolves
https://linear.app/getsentry/issue/CW-1499/monitoring-provider-connection-api-endpoints.

Adds API endpoints for listing, connecting, and disconnecting monitoring
providers (currently Datadog & GCP). These endpoints wrap the existing
identity pipeline to let users initiate the per-user OAuth flow for
connecting their monitoring provider accounts to Sentry. The identity
providers for Datadog & GCP were previously implemented in
#117035 &
#117279, respectively.

All endpoints are gated behind the `organizations:seer-infra-telemetry`
feature flag, which is enabled only internally in the Sentry org for
now. Note that monitoring provider connections are per-user (each user
links their own account via OAuth), not per-organization.

There is some provider-specific config baked into this implementation:
Datadog requires a `site` parameter in the POST body (e.g.
`datadoghq.com`) for site resolution, while GCP needs no extra config.
For Datadog, the `IdentityProvider` is not created in the POST endpoint;
it is auto-created by `IdentityPipeline.finish_pipeline()` using the
Datadog org UUID from the MCP whoami response as the external ID (see
#117491 &
#117705). For GCP, the
`IdentityProvider` is created upfront by the endpoint.

`GET /api/0/organizations/{org}/monitoring-providers/` lists the
available providers and the current user's connection status. This will
be used to inform the monitoring provider settings UI tracked in
https://linear.app/getsentry/issue/CW-1500/monitoring-providers-settings-page.

`POST /api/0/organizations/{org}/monitoring-providers/{provider}/`
represents a request to connect a given monitoring provider for a given
user. It initiates the OAuth flow and returns a redirect URL to the
provider's authorize page, based on the identity pipeline for that
provider.

`DELETE /api/0/organizations/{org}/monitoring-providers/{provider}/`
represents a request to disconnect/delete a given monitoring provider
for a given user. It deletes the current user's linked identity for that
provider, if one exists.

**Note on support for a single user connecting multiple Datadog orgs:**
- For v0, we're mainly considering the case where a user has a single
Datadog org connected, but in the future we will support multiple
- The GET endpoint currently collapses to one entry per provider type
(shows `connected: true` if _any_ exist
- The POST endpoint currently allows multiple connections to be created
- The DELETE endpoint currently deletes all identities for the provider
(`idp__type=provider_key`)

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
billyvg pushed a commit that referenced this pull request Jun 17, 2026
billyvg pushed a commit that referenced this pull request Jun 17, 2026
…API endpoints (#117854)

Recreated after reverting
#117478.

Depends on #117851.

Resolves
https://linear.app/getsentry/issue/CW-1499/monitoring-provider-connection-api-endpoints.

Adds API endpoints for listing, connecting, and disconnecting monitoring
providers (currently Datadog & GCP). These endpoints wrap the existing
identity pipeline to let users initiate the per-user OAuth flow for
connecting their monitoring provider accounts to Sentry. The identity
providers for Datadog & GCP were previously implemented in
#117035 &
#117279, respectively.

All endpoints are gated behind the `organizations:seer-infra-telemetry`
feature flag, which is enabled only internally in the Sentry org for
now. Note that monitoring provider connections are per-user (each user
links their own account via OAuth), not per-organization.

There is some provider-specific config baked into this implementation:
Datadog requires a `site` parameter in the POST body (e.g.
`datadoghq.com`) for site resolution, while GCP needs no extra config.
For Datadog, the `IdentityProvider` is not created in the POST endpoint;
it is auto-created by `IdentityPipeline.finish_pipeline()` using the
Datadog org UUID from the MCP whoami response as the external ID (see
#117491 &
#117705). For GCP, the
`IdentityProvider` is created upfront by the endpoint.

`GET /api/0/organizations/{org}/monitoring-providers/` lists the
available providers and the current user's connection status. This will
be used to inform the monitoring provider settings UI tracked in
https://linear.app/getsentry/issue/CW-1500/monitoring-providers-settings-page.

`POST /api/0/organizations/{org}/monitoring-providers/{provider}/`
represents a request to connect a given monitoring provider for a given
user. It initiates the OAuth flow and returns a redirect URL to the
provider's authorize page, based on the identity pipeline for that
provider.

`DELETE /api/0/organizations/{org}/monitoring-providers/{provider}/`
represents a request to disconnect/delete a given monitoring provider
for a given user. It deletes the current user's linked identity for that
provider, if one exists.

**Note on support for a single user connecting multiple Datadog orgs:**
- For v0, we're mainly considering the case where a user has a single
Datadog org connected, but in the future we will support multiple
- The GET endpoint currently collapses to one entry per provider type
(shows `connected: true` if _any_ exist
- The POST endpoint currently allows multiple connections to be created
- The DELETE endpoint currently deletes all identities for the provider
(`idp__type=provider_key`)

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
shashjar added a commit that referenced this pull request Jun 17, 2026
…Advanced Settings page (#117758)

Resolves
https://linear.app/getsentry/issue/CW-1500/monitoring-providers-settings-page.

Adds a (temporary, for testing) monitoring providers UI section to the
Seer Advanced Settings page, gated behind the
`organizations:seer-infra-telemetry` feature flag. This lets users
connect and disconnect infrastructure monitoring providers (Datadog,
GCP) via the API endpoints previously added in
#117854.

<img width="1512" height="828" alt="image"
src="https://github.com/user-attachments/assets/6caba0ba-0a7d-4404-a2f0-d785a1c3c210"
/>

- Lists available providers with connection status from `GET
/monitoring-providers/`
- Connect button initiates the OAuth flow via `POST
/monitoring-providers/{provider}/` and redirects to the provider's
authorize page
- Disconnect button shows a confirmation modal, then calls `DELETE
/monitoring-providers/{provider}/` and refreshes the list

Note that the Datadog logic hardcodes `site: "datadoghq.com"` for v0
(https://linear.app/getsentry/issue/CW-1501/support-per-site-datadog-connections-in-monitoring-provider-endpoints
tracks per-site support for multiple connected Datadog orgs for a single
user).

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants