Skip to content

feat: add the deployed region to every log record - #6896

Open
theomonnom wants to merge 1 commit into
mainfrom
theo/log-deployed-region
Open

feat: add the deployed region to every log record#6896
theomonnom wants to merge 1 commit into
mainfrom
theo/log-deployed-region

Conversation

@theomonnom

@theomonnom theomonnom commented Aug 18, 2026

Copy link
Copy Markdown
Member

Closes AP-1003.

LiveKit Cloud now injects LIVEKIT_REGION_NAME (the region display name, e.g. ca-central) into deployed agent pods — server side landed in cloud-agents#781.

This picks it up in the SDK and tags every log record with a region field:

{"message": "registered worker", "level": "INFO", "name": "livekit.agents", "job_id": "...", "region": "ca-central", "timestamp": "..."}

@theomonnom
theomonnom requested a review from a team as a code owner August 18, 2026 22:06

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

LiveKit Cloud injects LIVEKIT_REGION_NAME into deployed agents (cloud-agents
#781). When it is set, tag every log record with a `region` field so logs can be
filtered by the region the agent is running in. Nothing is added when the
variable is unset (self-hosted, local dev).

The env var is inherited by the child processes, so the field is installed on
the worker's stdout handler and on the job process' log-forwarding handler,
which covers both the worker and the job processes.

A logging.Filter is used rather than a log record factory: the factory runs
before Logger.makeRecord applies `extra`, so a user (or the worker's own
"registered worker" log, which reports the SFU region) passing
extra={"region": ...} would raise a KeyError. With a filter, an explicit
`region` always wins.
@theomonnom
theomonnom force-pushed the theo/log-deployed-region branch from e2d58e6 to 17cb53e Compare August 18, 2026 22:11
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.

3 participants