Skip to content

feat(logging): Stamp artifact, project, and org ids onto every log record - #670

Open
NicoHinderling wants to merge 1 commit into
mainfrom
feat/log-context-artifact-fields
Open

feat(logging): Stamp artifact, project, and org ids onto every log record#670
NicoHinderling wants to merge 1 commit into
mainfrom
feat/log-context-artifact-fields

Conversation

@NicoHinderling

Copy link
Copy Markdown
Contributor

Stacked on #663.

Finding a build's logs today means locating the "Processing artifact (project: ..., org: ...)" line, reading its request_id, and filtering on that. The artifact id itself is only in message text, never a structured field.

This adds a small log_context(**fields) context manager in tracing.py backed by a contextvar. The existing RequestLogFilter copies whatever fields are set onto each record, the same way it already stamps request_id. process_message enters it with artifact_id, project_id, and organization_id right where it enters request_context(), so every line for the rest of the task carries them. The binary-analysis worker relay from #663 captures the same fields at creation and stamps them onto relayed worker records, so the per-binary lines carry them too.

Since Sentry's logging integration forwards every non-standard record attribute as a log attribute, artifact_id:758251 in the Sentry Logs search returns the whole build, parent and workers, and the same field is present in the JSON lines GCP and Datadog ingest.

Covered by unit tests for the contextvar and filter (stamping, scoping, nesting, coexistence with request_id), an assertion on the process_message log line, and the existing forkserver relay test now also checking artifact_id on worker records.

@sentry

sentry Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Size Analysis

1 component analyzed, 1 component processing

iOS Builds

Name Configuration Version Download Size Install Size
HackerNews (iOS)
com.emergetools.hackernews
Release 3.8 (1) 6.5 MB (0 B) 9.7 MB (0 B)

Android Builds

Name Configuration Version Download Size Uncompressed Size
Hacker News (Android)
com.emergetools.hackernews
Release 1.0.2 (13) Processing... (-) Processing... (-)

Configure launchpad-test-ios status check rules

@sentry

sentry Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
HackerNews com.emergetools.hackernews 3.8 (1) Release

Android

🔗 App Name App ID Version Configuration
Hacker News com.emergetools.hackernews 1.0.2 (13) Release

⚙️ launchpad-test-android Build Distribution Settings

@NicoHinderling
NicoHinderling force-pushed the perf/parallel-binary-analysis branch from 8462c22 to f3e6354 Compare September 3, 2026 22:18
Base automatically changed from perf/parallel-binary-analysis to main September 3, 2026 22:31
…cord

Finding a build's logs meant locating the "Processing artifact <id>" line
and pivoting on its request_id. Add a log_context contextvar that the
existing RequestLogFilter copies onto each record, and enter it in
process_message with the artifact, project, and organization ids. Propagate
the fields into the binary-analysis pool through _WorkerContext so worker
records carry them too. Every line for a build, parent and workers, now
carries artifact_id as a structured field in Sentry Logs, GCP, and Datadog.
@NicoHinderling
NicoHinderling force-pushed the feat/log-context-artifact-fields branch from 5742ed6 to 735dea7 Compare September 3, 2026 22:57
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