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
@linear
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?

Copy link
Member

Choose a reason for hiding this comment

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

In that case having two fields makes sense. But what's the point in keeping both versions on serialization? Shouldn't we normalize the field into the more common name?

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't get this to work without a macro - ec8cfbf. Let me know what you think!

The nice refactor here is that the struct only support deriving Deserialize, which I think communicates intent way better.

define_fallback_field_deserializer!(deserialize_trace_id, "traceId", "trace.id");

Copy link
Member

Choose a reason for hiding this comment

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

Yep only supporting Deserialize makes sense here 👍 . I understand the problem with serde alias now, wasn't even aware that it fails parsing when both fields are present in the input.

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.

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.

In that case having two fields makes sense. But what's the point in keeping both versions on serialization? Shouldn't we normalize the field into the more common name?

@AbhiPrasad AbhiPrasad force-pushed the abhi-vercel-log-drain-integration branch from 58d7af5 to 3810607 Compare October 6, 2025 23:20
@AbhiPrasad AbhiPrasad force-pushed the abhi-vercel-log-drain-integration branch from 3810607 to ec8cfbf Compare October 6, 2025 23:24
cursor[bot]

This comment was marked as outdated.

@AbhiPrasad AbhiPrasad enabled auto-merge October 8, 2025 17:30
@AbhiPrasad AbhiPrasad added this pull request to the merge queue Oct 8, 2025
Merged via the queue into master with commit 87e02b0 Oct 8, 2025
28 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-vercel-log-drain-integration branch October 8, 2025 18:02
github-merge-queue bot pushed a commit that referenced this pull request Oct 15, 2025
resolves
https://linear.app/getsentry/issue/LOGS-389/add-vercel-log-drain-endpoint-to-relay

Building on top of the vercel log transform added in
#5209, this PR adds an endpoint
for the vercel log drain.

This endpoint is featured flagged, you can see the options automator PR
here: getsentry/sentry-options-automator#5367
github-merge-queue bot pushed a commit that referenced this pull request Oct 22, 2025
When implementing the vercel log drain transform in
#5209, I initially used
`url.path` to represent the path property.

<img width="819" height="136" alt="image"
src="https://github.com/user-attachments/assets/37ddda0d-2d8d-47fc-b125-a47701c44385"
/>

Unfortunately it seems like this also includes some non path like
values, like 404, which breaks the semantic convention of `url.path`.

<img width="1526" height="301" alt="image"
src="https://github.com/user-attachments/assets/5f9c5175-d753-45bf-bb59-2baa2a3db0f7"
/>

This PR changes the attribute to be `vercel.path` instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants