Skip to content

feat(processing): Resolve client IP and enrich errors and spans with ASN - #6760

Draft
vjeranc wants to merge 44 commits into
feat/geoip-asn-readersfrom
feat/enrich-client-asn
Draft

vjeranc wants to merge 44 commits into
feat/geoip-asn-readersfrom
feat/enrich-client-asn

Conversation

@vjeranc

@vjeranc vjeranc commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Stacked on #6759.

Use the original client IP for City lookup and, when projects:relay-client-asn-lookup is enabled, for client.as.number and client.as.organization. Write ASN tags on errors and attributes on spans. Preserve SDK-supplied ASN fields and apply destination scrubbing rules.

Scrub the request environment before using REMOTE_ADDR to fill a missing user IP. Resolve the user's identity under the project rules before span tag extraction, filtering, and sampling. This ordering also applies with ASN lookup disabled.

Builds on getsentry/sentry#132320 and #6751. Refs INGEST-1396, INGEST-1398.

vjeranc and others added 2 commits November 25, 2026 12:16
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@linear-code

linear-code Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

INGEST-1398

INGEST-1396

vjeranc and others added 15 commits November 25, 2026 12:39
Carry the address source across filtering only through the scrubbing entry point. Accept project PII rules there so standalone normalization cannot accidentally defer span user tags to a scrubber it never runs.

Co-authored-by: Codex <noreply@openai.com>
Use the original IP for City and ASN lookup, then apply request rules before a remote address can backfill the user. Complete user scrubbing and the ID fallback before deriving span tags. Filters and sampling consume the resulting identity on each Relay.

Co-authored-by: Codex <noreply@openai.com>
Keep address selection, City and ASN lookup, and scrubbing in a single event flow. Carry redaction remarks and original lengths to embedded span tags so the indexed attributes retain their scrubbing history.

Co-authored-by: Codex <noreply@openai.com>
Apply the user field rules at their event paths and select the fallback ID after both project rule sets have run. Keep the scrubbed replacement local to that decision so PII traversal no longer carries identity state.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Resolve the input addresses once. A request address can supply the database lookup even when its scrubbing rule blocks backfill. Only create a user for a backfill or City result that will actually be written.

Co-authored-by: Codex <noreply@openai.com>
Use the ParsedIp parser directly on the wire text when resolving an address or checking whether scrubbing replaced it.

Co-authored-by: Codex <noreply@openai.com>
Share user IP resolution and City lookup through borrowed request and user fields. Events use the resolved address for ASN enrichment. Replays can skip constructing an Event and moving their fields out and back.

Co-authored-by: Codex <noreply@openai.com>
Write ASN fields directly when no span rules apply and reuse the attribute map across a transaction when they do. Share copied field metadata until a writer changes it, and move the final IP hash into the user ID when possible.

Avoid cloning current attribute names and lowercasing the same span operation twice during span tag extraction.

Co-authored-by: Codex <noreply@openai.com>
Resolve the request address once before source scrubbing and use the surviving value for backfill. Carry IP validity across project rule sets and evaluate competing identifiers after the last pass. Reuse the same trace data for ASN checks and insertion.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Reuse the SDK user or create one when there is an IP or City result to write. Carry that user through backfill and the initial identity check, then inspect the field again after PII can remove it.

Co-authored-by: Codex <noreply@openai.com>
vjeranc and others added 8 commits November 25, 2026 15:29
Co-authored-by: Codex <noreply@openai.com>
Keep the resolved user borrowed while scrubbing its fields. The event schema protects the user container itself. Match the two configured rule sets explicitly and retain an intermediate IP replacement only when both run.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Use distinct project IDs for the processing matrix and run hash cases with the same scrubbing policy through one pair of forwarders.

Co-authored-by: Codex <noreply@openai.com>
Carry the transport address through normalization in its native type. Preserve the original protocol spelling for PII and serialization, and reuse its parsed classification until a text processor changes it.

Co-authored-by: Codex <noreply@openai.com>
Keep the existing metadata representation for the ASN rollout. Evaluate copy-on-write storage independently on protocol and normalization workloads.

Co-authored-by: Codex <noreply@openai.com>
vjeranc and others added 19 commits November 25, 2026 16:50
Apply destination rules directly to the annotated ID after identity fallback. This avoids constructing and visiting an otherwise empty User.

Co-authored-by: Codex <noreply@openai.com>
Decide whether each scrubber produced a fallback ID at the point it processes the IP. Preserve an intermediate replacement only when a later scrubber can still change the final identity.

Co-authored-by: Codex <noreply@openai.com>
Propagate upstream redactions when traversing annotated fields. Select the client IP from the classified inputs and use the same visibility check when reading span attributes and tags.

Co-authored-by: Codex <noreply@openai.com>
Handle existing and missing users at the City lookup site, and determine transport-only hashing alongside IP selection. Reuse the selected IP when formatting transaction span user tags.

Co-authored-by: Codex <noreply@openai.com>
Resolve the user IP marker into an inference policy and return the hash-only decision with the selected address. Preserve an advanced replacement only across a configured legacy pass.

Co-authored-by: Codex <noreply@openai.com>
Resolve explicit user addresses and previous redactions before considering request and connection fallbacks. Keep the request address available for enrichment and copy it to the user only after request scrubbing allows it.

Co-authored-by: Codex <noreply@openai.com>
…er ID

Let each PII pass report whether it replaced the user IP. Once both passes have run, select an eligible fallback ID and discard the transient connection address while preserving its scrubbing remarks.

Co-authored-by: Codex <noreply@openai.com>
…SN enrichment

Keep the generic attribute-name optimization independently reviewable on master.

Co-authored-by: Codex <noreply@openai.com>
Share the auto marker spelling with the protocol parser. Keep the parsed connection address when expanding a request marker and parse a literal only if the request supplies the user IP.

Co-authored-by: Codex <noreply@openai.com>
Keep address selection in a private function so a settled source returns directly and the caller continues with scrubbing and identity derivation.

Co-authored-by: Codex <noreply@openai.com>
Reject an ineligible mask before cloning the advanced result across legacy scrubbing. Check identity precedence after both passes and take the final replacement only when it will supply the user ID.

Co-authored-by: Codex <noreply@openai.com>
Select the lookup source before request scrubbing, then apply the permitted IP and City data together. Keep the resulting user reference through identity scrubbing.

Co-authored-by: Codex <noreply@openai.com>
Resolve request markers and literals from the same environment field before scrubbing. Share the parsed standalone span address across City and ASN lookups while preserving their distinct source and destination rules.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Keep source selection beside request scrubbing and identity derivation. Exercise the stored request address when an explicit user IP supplies the ASN.

Co-authored-by: Codex <noreply@openai.com>
Read the request candidate before scrubbing, then use its surviving field to decide whether the raw address can be copied. Resolve lookup and storage together without an intermediate source enum.

Co-authored-by: Codex <noreply@openai.com>
Match the supplied user IP and request candidate in precedence order. Keep the explicit marker and missing-user connection fallbacks separate so their eligibility is visible. Show when the advanced IP replacement must survive a second scrubbing pass.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>

This branch has not been deployed

No deployments
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.

1 participant