Skip to content

hand off log export to the hosted log sidecar if env var is set - #8097

Draft
andrewnitu wants to merge 3 commits into
mainfrom
andrewnitu/hosted-logs-sidecar-handoff
Draft

andrewnitu wants to merge 3 commits into
mainfrom
andrewnitu/hosted-logs-sidecar-handoff

Conversation

@andrewnitu

Copy link
Copy Markdown
Contributor

Summary

When LIVEKIT_HOSTED_LOGS=sidecar is 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 the LIVEKIT_HOSTED_LOGS env 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 with lk.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.

This branch has not been deployed

No deployments
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