Skip to content

ref(http): migrate to context scope API - #1398

Open
giortzisg wants to merge 1 commit into
scopes/logging-integrations-contextfrom
scopes/http-integration
Open

giortzisg wants to merge 1 commit into
scopes/logging-integrations-contextfrom
scopes/http-integration

Conversation

@giortzisg

@giortzisg giortzisg commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description

This migrates the http integration to scopes.

Issues

Changelog Entry Instructions

To add a custom changelog entry, uncomment the section above. Supports:

  • Single entry: just write text
  • Multiple entries: use bullet points
  • Nested bullets: indent 4+ spaces

For more details: custom changelog entries

Reminders

@giortzisg
giortzisg force-pushed the scopes/http-integration branch from dcb9bbb to b7e8a83 Compare August 31, 2026 10:50
@giortzisg
giortzisg marked this pull request as ready for review August 31, 2026 10:51
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from b7e8a83 to aa34125 Compare September 1, 2026 09:13
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from aa34125 to 0c7f2a6 Compare September 1, 2026 12:57
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from 0c7f2a6 to a5c324b Compare September 2, 2026 07:59

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a5c324b. Configure here.

Comment thread http/sentryhttp.go
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from a5c324b to fc11ac3 Compare September 4, 2026 13:12
@giortzisg
giortzisg changed the base branch from scopes/capture-panic to scopes/logging-integrations-context September 4, 2026 13:12
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from fc11ac3 to 20d058f Compare September 4, 2026 13:26
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from 20d058f to 766cdf6 Compare September 7, 2026 11:40
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from 766cdf6 to 84d0b5c Compare September 7, 2026 11:49

@szokeasaurusrex szokeasaurusrex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, but left a couple questions

I am a bit unclear about the mechanism by which the client gets into the request context

Comment thread http/sentryhttp.go
Comment on lines -126 to +122
hub.Scope().SetRequest(r)
r = r.WithContext(transaction.Context())
defer h.recoverWithSentry(hub, r)
scope.SetRequest(r)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[question] does the reordering of the WithContext and SetRequest lines change behavior at all, and if so, how?

Comment thread http/sentryhttp.go Outdated
ctx, scope := sentry.WithIsolationScope(r.Context())

if client := hub.Client(); client.IsEnabled() {
if client := sentry.ClientFromContext(ctx); client.IsEnabled() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[question] I am struggling to find where the client ever gets set on the http.Request context.

Does this happen automatically somehow?

@giortzisg
giortzisg force-pushed the scopes/http-integration branch from 84d0b5c to 29129a3 Compare September 16, 2026 09:14
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from 29129a3 to cfca6cc Compare September 17, 2026 08:38
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from cfca6cc to 664e178 Compare September 17, 2026 09:09
Create an isolated context scope for each request and route capture and flushing through the contextual client. Continue incoming traces from all baggage header values.

When middleware reuses an active transaction, preserve the caller context and child span. Only middleware that creates the transaction updates its metadata and finishes it, so nested instrumentation cannot close an outer request early.
@giortzisg
giortzisg removed this pull request from stack #1420 September 18, 2026 11:17
@giortzisg
giortzisg force-pushed the scopes/http-integration branch from 664e178 to 49144c4 Compare September 18, 2026 11:18
@giortzisg
giortzisg added this pull request to stack #1433 September 18, 2026 11:22
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.

2 participants