Repository navigation
hand off log export to the hosted log sidecar if env var is set - #8097
Draft
andrewnitu wants to merge 3 commits into
Draft
andrewnitu wants to merge 3 commits into
andrewnitu wants to merge 3 commits into
Conversation
This branch has not been deployed
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.
Summary
When
LIVEKIT_HOSTED_LOGS=sidecaris set, the SDK does not send logs to LiveKit Cloud. The hosted log sidecar sends them instead. This prevents duplicate logs.Changes
telemetry/hosted_logs.py: a new module that reads theLIVEKIT_HOSTED_LOGSenv var.job.py,telemetry/traces.py: when the flag is set, the SDK skips the early buffering handler and the cloud log handler.worker.py: at startup, the worker writes one JSON marker line to stdout withlk.hosted_logs: "sidecar", the SDK name and the SDK version. The collector uses this line to know that the sidecar owns log export for this agent.If the env var is not set, nothing changes.
Tests
tests/test_hosted_logs.py: tests for the env var check and the marker line.tests/test_recording.py: a test that the cloud tracer does not attach a log handler to the root logger when the flag is set.