feat(logging): Stamp artifact, project, and org ids onto every log record - #670
Open
NicoHinderling wants to merge 1 commit into
Open
feat(logging): Stamp artifact, project, and org ids onto every log record#670NicoHinderling wants to merge 1 commit into
NicoHinderling wants to merge 1 commit into
Conversation
Contributor
Size Analysis1 component analyzed, 1 component processing iOS Builds
Android Builds
|
Contributor
📲 Install BuildsiOS
Android
|
NicoHinderling
force-pushed
the
perf/parallel-binary-analysis
branch
from
September 3, 2026 22:18
8462c22 to
f3e6354
Compare
…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
force-pushed
the
feat/log-context-artifact-fields
branch
from
September 3, 2026 22:57
5742ed6 to
735dea7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 intracing.pybacked by a contextvar. The existingRequestLogFiltercopies whatever fields are set onto each record, the same way it already stampsrequest_id.process_messageenters it withartifact_id,project_id, andorganization_idright where it entersrequest_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:758251in 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 theprocess_messagelog line, and the existing forkserver relay test now also checkingartifact_idon worker records.