Skip to content

feat(inbound-filters): Add custom inbound filters CRUD endpoint#117797

Draft
shellmayr wants to merge 11 commits into
masterfrom
shellmayr/feat/inbound-filters-v2-add-endpoint
Draft

feat(inbound-filters): Add custom inbound filters CRUD endpoint#117797
shellmayr wants to merge 11 commits into
masterfrom
shellmayr/feat/inbound-filters-v2-add-endpoint

Conversation

@shellmayr

Copy link
Copy Markdown
Member
  • Add CustomInboundFiltersEndpoint (GET list, POST create) and CustomInboundFilterDetailsEndpoint (GET, PUT, DELETE) at /projects/{org}/{project}/custom-inbound-filters/[{filter_id}/], backed by the CustomInboundFilter model
  • Request/response serializers with condition-type validation; LOG_MESSAGE and METRIC_NAME condition types gated behind their own feature flags
  • Feature-gated behind projects:custom-inbound-filters (returns 400 when not enabled)
  • Emits audit-log events on create/update/delete
  • Adds test factory + fixture and full endpoint test coverage (14 tests)
  • Merged latest master (picks up the now-merged model + migration 1116); net diff is backend-only

Contributes to TET-2379

@linear-code

linear-code Bot commented Jun 16, 2026

Copy link
Copy Markdown

TET-2379

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 16, 2026
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label 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.

shellmayr and others added 2 commits June 16, 2026 16:26
… log

Per review: the list endpoint now exposes only GET, and create (POST) moves to
the details endpoint alongside GET/PUT/DELETE. Collapse the three custom inbound
filter audit log events (add/edit/remove) into a single CUSTOM_INBOUND_FILTER
event that records the operation in its data. Rename get_feature_gate_response to
feature_access_denied for clarity.

Refs TET-2379
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…2-add-endpoint' into shellmayr/feat/inbound-filters-v2-add-endpoint
…hain

Refs TET-2379
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread src/sentry/api/endpoints/project_custom_inbound_filters.py Outdated
shellmayr and others added 5 commits June 16, 2026 16:38
POST create belongs on the collection (/custom-inbound-filters/), not the detail
route. Having it on the detail endpoint made a standard POST to the collection
return 405 and forced create requests through /custom-inbound-filters/<id>/ with a
meaningless, unused filter_id (also misdocumented in the OpenAPI schema). Move post
and its schema back to CustomInboundFiltersEndpoint without the filter_id param, and
drop POST from CustomInboundFilterDetailsEndpoint.

Refs TET-2379
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fold response serialization into CustomInboundFilterSerializer so a single
DRF serializer handles both request validation and response output, removing
the duplicate serialize_project_custom_inbound_filter helper.

Allow duplicate condition types (combined with AND) and document the behavior
instead of rejecting them. Set the owner to telemetry-experience and mark the
endpoints EXPERIMENTAL ahead of graduation.

Harden creation with a per-project filter cap (50) and a max conditions per
filter (10).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the SerializerMethodField timestamp helpers with plain DateTimeField
declarations. This drops boilerplate and emits the Z-suffixed format the rest
of the Sentry API uses, instead of isoformat's +00:00 offset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the per-endpoint feature_access_denied helper with a has_feature
method on a shared ProjectCustomInboundFilterEndpoint base, matching the
convention used elsewhere (e.g. project service hooks). Callers now return
the 400 response inline when the project feature is disabled.

This also fixes a latent bug: every call site invoked feature_access_denied
as a bare function, which only existed as a method on the list endpoint and
was undefined on the details endpoint.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.

1 participant