Skip to content

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Oct 3, 2025

ref https://linear.app/getsentry/issue/LOGS-389/add-vercel-log-drain-endpoint-to-relay

This PR updates the relay-ourlogs create to add a VercelLog struct and a vercel_log_to_sentry_log transform method. vercel_log_to_sentry_log turns an incoming VercelLog json payload structure into an instance of Sentry's OurLog.

I haven't hooked up the vercel_log_to_sentry_log function to an endpoint and the rest of the processing pipeline on purpose, I want to take our time to make sure we are all good with the transform taking place.

Many of these attributes are new, I've opened a PR in the conventions repo to document them accordingly: getsentry/sentry-conventions#163. See this notion doc for details about the schema and the transform: https://www.notion.so/sentry/Vercel-Log-Drain-2808b10e4b5d808c95f3ebcfe2b8828a. The attribute keys here align in naming as per https://vercel.com/docs/drains/reference/logs.

After this PR merges in, I'll work on exposing this in a new integrations endpoint, gated behind the feature flag introduced in #5208

@AbhiPrasad AbhiPrasad self-assigned this Oct 3, 2025
Copy link

linear bot commented Oct 3, 2025

Comment on lines 142 to 150
/// Span identifier for distributed tracing.
#[serde(rename = "spanId")]
pub span_id: Option<String>,
/// Trace identifier for distributed tracing.
#[serde(rename = "trace.id")]
pub trace_dot_id: Option<String>,
/// Span identifier for distributed tracing.
#[serde(rename = "span.id")]
pub span_dot_id: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

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

You can use serde alias to prevent having multiple fields here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately this can't work because the schema allows traceId and trace.id to be sent together, and we still want serialization to work here. Is there a way we can get around that with serde?

add_attribute!(HTTP_RESPONSE_STATUS_CODE, code);
}

add_optional_attribute!(HTTP_RESPONSE_STATUS_CODE, status_code);
Copy link
Member

Choose a reason for hiding this comment

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

You're already adding this above, I think we should probably restate this as add_optional_attribute!('vercel.status_code',) to include information about -1 where it doesn't conflict with our status code conventions

@AbhiPrasad AbhiPrasad marked this pull request as ready for review October 3, 2025 16:09
@AbhiPrasad AbhiPrasad requested a review from a team as a code owner October 3, 2025 16:09
cursor[bot]

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants