Skip to content

fix: Contextual logging import to use absolute path#92

Open
morgan-wowk wants to merge 1 commit intomasterfrom
fix-contextual-logging-import
Open

fix: Contextual logging import to use absolute path#92
morgan-wowk wants to merge 1 commit intomasterfrom
fix-contextual-logging-import

Conversation

@morgan-wowk
Copy link
Collaborator

@morgan-wowk morgan-wowk commented Feb 13, 2026

Changed the import in structured_logging.py from relative to absolute to ensure that the same contextual_logging module instance is used across all imports. This fixes an issue where context metadata set in one module was not visible in another due to separate module instances having separate ContextVar objects.

This ensures LoggingContextFilter and contextual_logging.logging_context share the same _context_metadata ContextVar, allowing contextual data like container_execution_id and execution_node_ids to appear in logs.

Changed the import in structured_logging.py from relative to absolute
to ensure that the same contextual_logging module instance is used
across all imports. This fixes an issue where context metadata set in
one module was not visible in another due to separate module instances
having separate ContextVar objects.

This ensures LoggingContextFilter and contextual_logging.logging_context
share the same _context_metadata ContextVar, allowing contextual data
like container_execution_id and execution_node_ids to appear in logs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@morgan-wowk morgan-wowk self-assigned this Feb 13, 2026
@morgan-wowk morgan-wowk requested a review from Ark-kun as a code owner February 13, 2026 22:50
import logging

from . import contextual_logging
from cloud_pipelines_backend.instrumentation import contextual_logging
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can look into preventing this type of import in the future with a PR check

Copy link
Contributor

Ark-kun commented Feb 14, 2026

Hmm. The module should still be imported only once. If relative imports always caused such issues, then isinstance checks won't have worked.

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.

2 participants