fix(python): preserve real tracing target in pylance log passthrough - #8
Merged
Conversation
The on_event logging passthrough was hard-coding the log target to 'lance::events' for every tracing event, which made it impossible to filter specific event families (e.g. high-volume 'lance::file_audit' per-file events) via env_logger's per-target LANCE_LOG directives. Preserve the original tracing event target (e.g. 'lance::file_audit', 'lance::dataset::cleanup') as the log record target. This lets LANCE_LOG='info,lance::file_audit=warn' silence file-audit spam while keeping other INFO logs such as cleanup progress. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
The pylance
tracing→logpassthrough hard-coded the log record target to"lance::events"for every event, so the env_logger backend (filtered viaLANCE_LOG) could only see one target. This made it impossible to filter individual event families by target — e.g. the high-volume per-filelance::file_auditdelete events could only be killed by dropping the level globally, which also silences useful INFO logs like cleanup progress.This change forwards each event under its real tracing target instead:
env_loggerfilters by the log record's target, so preserving it makes per-targetLANCE_LOGdirectives work as expected.Motivating use case (Databricks Lance cleanup jobs): suppress the one-line-per-file
lance::file_auditspam while keeping the bulklance::dataset::cleanupprogress summaries.Verified locally on a wheel built from this branch:
LANCE_LOG="info"→ file_audit lines present + progress present (baseline, both under their real targets now).LANCE_LOG="info,lance::file_audit=warn"→ file_audit lines = 0,Delete phase complete/ manifest-progress lines still present.The text field
target="..."in the formatted message is unchanged for backwards compatibility with any log scraping that keys off it.Link to Devin session: https://app.devin.ai/sessions/b43ab1ec117947eb88c1e77aa17215b9
Requested by: @dpruijt