Skip to content

fix(python): preserve real tracing target in pylance log passthrough - #8

Merged
dpruijt merged 1 commit into
mainfrom
devin/cleanup-logfix-build
Jun 1, 2026
Merged

fix(python): preserve real tracing target in pylance log passthrough#8
dpruijt merged 1 commit into
mainfrom
devin/cleanup-logfix-build

Conversation

@dpruijt

@dpruijt dpruijt commented Jun 1, 2026

Copy link
Copy Markdown

Summary

The pylance tracinglog passthrough hard-coded the log record target to "lance::events" for every event, so the env_logger backend (filtered via LANCE_LOG) could only see one target. This made it impossible to filter individual event families by target — e.g. the high-volume per-file lance::file_audit delete 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:

// before: every event collapses to one target
log::log!(target: "lance::events", state.level, "target=\"{}\" {}", event.metadata().target(), fields.str);

// after: preserve the originating target
let event_target = event.metadata().target();   // e.g. "lance::file_audit", "lance::dataset::cleanup"
log::log!(target: event_target, state.level, "target=\"{}\" {}", event_target, fields.str);

env_logger filters by the log record's target, so preserving it makes per-target LANCE_LOG directives work as expected.

Motivating use case (Databricks Lance cleanup jobs): suppress the one-line-per-file lance::file_audit spam while keeping the bulk lance::dataset::cleanup progress 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

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-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions github-actions Bot added bug Something isn't working python labels Jun 1, 2026
@dpruijt
dpruijt merged commit fb6ea92 into main Jun 1, 2026
5 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant