AtharvUrunkar opened a new pull request, #38246:
URL: https://github.com/apache/beam/pull/38246

   Closes #38214
   
   ## Summary
   
   Fix: Correct `portability_worker_id` for child process logs in Python SDK 
harness.
   
   ## Problem
   
   Child process logs are captured via `boot.go` using a shared `tools.Logger`. 
Since the Fn logging stream is initialized on the first log call, all 
subsequent logs reuse the same stream, causing incorrect 
`portability_worker_id` (e.g., `sdk-0-0` instead of `sdk-0-0_sibling_X`).
   
   ## Root Cause
   
   A shared logger instance is used across multiple workers. The Fn logging 
client initializes a single stream with metadata from the first worker, which 
is then reused for all workers.
   
   ## Fix
   
   * Create a separate `tools.Logger` per worker
   * Initialize `BufferedLogger` with worker-specific context using 
`grpcx.WriteWorkerID`
   * Ensure each worker establishes its own logging stream with correct metadata
   
   ## Validation
   
   * Verified successful build targeting Linux (`GOOS=linux`)
   * Ensured each worker initializes an independent logger with worker-specific 
context
   * Prevents reuse of a shared Fn logging stream, ensuring correct 
`portability_worker_id` attribution for child process logs
   
   ## Notes
   
   This change is limited to worker logging initialization and does not modify 
existing logging behavior for Python SDK logs.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to