Skip to content

Conversation

@AbhiPrasad
Copy link
Member

In Relay we've moved toward an integration abstraction on endpoints to represent trace and log (and in the future metric) drain endpoints. For example, our current support for OTLP, or future support for Vercel/Netlify Log Drains.

https://github.com/getsentry/relay/blob/b97e972470adb15ac5a479375752b2ede6adfd63/relay-server/src/endpoints/mod.rs#L84-L91

This PR adds that integration endpoint to the project key serializer. This will look something like so: https://o4504765715316736.ingest.sentry.io/api/4505281256090153/integration/.

By default something like /api/4505281256090153/integration/ will actually do nothing, as you'll need to provide further parameters to specify the integration you're using. For example /api/4505281256090153/integration/vercel/logs for the vercel log drain endpoint, or /api/4505281256090153/integration/vercel/logs.

From the integration endpoint, we can construct the rest of the endpoints easily. This does mean that the ProjectKeySerializer becomes less of a source of truth, but I think the increased flexibility means this is a good change.

@AbhiPrasad AbhiPrasad self-assigned this Oct 23, 2025
@AbhiPrasad AbhiPrasad requested a review from a team as a code owner October 23, 2025 13:37
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 23, 2025
@AbhiPrasad AbhiPrasad requested a review from a team October 23, 2025 13:37
Comment on lines +268 to +272
def integration_endpoint(self):
endpoint = self.get_endpoint()

return f"{endpoint}/api/{self.project_id}/integration/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The integration_endpoint method is missing the @property decorator, causing it to return a method object instead of a string URL, which breaks API serialization.
(Severity: Critical 0.85 | Confidence: 1.00)

🔍 Detailed Analysis

The integration_endpoint method in the ProjectKey model is missing the @property decorator. Unlike other similar methods in the class, this causes it to return a bound method object instead of a string URL. When the ProjectKeySerializer serializes a ProjectKey instance, it attempts to include obj.integration_endpoint. This will raise a TypeError because a method object is not JSON serializable, causing the /api/0/projects/{organization}/{project}/keys/ endpoint to fail.

💡 Suggested Fix

Add the @property decorator to the integration_endpoint method in the ProjectKey model. This will ensure it returns a string URL, consistent with other endpoint properties in the class, and can be correctly serialized.

🤖 Prompt for AI Agent
Fix this bug. In src/sentry/models/projectkey.py at lines 268-271: The
`integration_endpoint` method in the `ProjectKey` model is missing the `@property`
decorator. Unlike other similar methods in the class, this causes it to return a bound
method object instead of a string URL. When the `ProjectKeySerializer` serializes a
`ProjectKey` instance, it attempts to include `obj.integration_endpoint`. This will
raise a `TypeError` because a method object is not JSON serializable, causing the
`/api/0/projects/{organization}/{project}/keys/` endpoint to fail.

Did we get this right? 👍 / 👎 to inform future reviews.

@cursor

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #101999      +/-   ##
===========================================
+ Coverage   80.97%    80.99%   +0.01%     
===========================================
  Files        8730      8730              
  Lines      388499    389176     +677     
  Branches    24632     24632              
===========================================
+ Hits       314593    315195     +602     
- Misses      73546     73621      +75     
  Partials      360       360              

@AbhiPrasad
Copy link
Member Author

Alright I decided I'm not going to go with this. Instead we'll expose every endpoint individually from the project key serializer. Given we have a tabbed approach here (#102010) I think this makes more sense.

If we need to refactor it, we can always easily do this in the future.

@AbhiPrasad AbhiPrasad closed this Oct 23, 2025
@AbhiPrasad AbhiPrasad deleted the abhi-integration-endpoint-project-key branch October 23, 2025 16:22
AbhiPrasad added a commit that referenced this pull request Oct 27, 2025
Alright final try at #102083 and
#101999.

We expose the integration endpoint in the project key serializer. API
consumers can build the integrations (similar to how the
`build_integration_endpoint` method works) for all the integration's
that we'll be exposing in Relay.

We might eventually remove the `otlp_traces_endpoint` and
`otlp_logs_endpoint`, but we can explore that afterwards.
priscilawebdev pushed a commit that referenced this pull request Oct 28, 2025
Alright final try at #102083 and
#101999.

We expose the integration endpoint in the project key serializer. API
consumers can build the integrations (similar to how the
`build_integration_endpoint` method works) for all the integration's
that we'll be exposing in Relay.

We might eventually remove the `otlp_traces_endpoint` and
`otlp_logs_endpoint`, but we can explore that afterwards.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants