Add GIGL_DISABLE_CLOUD_LOGGING to opt out of GCP JSON log lines - #727
Draft
kmontemayor2-sc wants to merge 8 commits into
Draft
Add GIGL_DISABLE_CLOUD_LOGGING to opt out of GCP JSON log lines#727kmontemayor2-sc wants to merge 8 commits into
kmontemayor2-sc wants to merge 8 commits into
Conversation
On App Engine and Kubernetes, Logger routes records through google.cloud.logging, which on GKE installs StructuredLogHandler -- a handler that renders every record as a single-line GCP JSON envelope and hardcodes that format, so setFormatter cannot change it. Under Ray that envelope is a pure loss. Ray relays worker output to the driver behind a "(RayTrainWorker pid=...)" prefix, which makes the line invalid JSON, so Cloud Logging stores it as a plain textPayload and drops severity, sourceLocation, and trace correlation anyway. The reader is left with an unreadable line and none of the structured fields it paid for. It bites hardest in mp.spawn children. Ray Train configures the worker root logger with a message-only handler, so the parent process is already readable, but a spawned child starts a fresh interpreter with no handlers -- Logger's setup runs there and installs the JSON handler. The knob is read from the environment rather than passed as an argument so that spawned children, which inherit os.environ but not logging config, pick it up without every spawn entrypoint having to opt in. Also renames test_logger.py to logger_test.py: the unit-test runner's default pattern is *_test.py, so these tests were never running. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…logging_knob # Conflicts: # gigl/env/constants.py
Reuse is_env_flag_enabled for the GIGL_DISABLE_CLOUD_LOGGING gate rather than carrying a second env-var parser, and drop the local falsy-value test now that the helper owns that parsing. Narrows the accepted spellings to "1" and "true", which the setup guide now states.
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.
Add opt out of cloud logging. We've found that not all envs work nicely with structured logging