feat: opt-in tracing for periodic log uploads - #3373
Open
Shriprasad-P wants to merge 2 commits into
Open
Shriprasad-P wants to merge 2 commits into
Shriprasad-P wants to merge 2 commits into
Conversation
Contributor
Greptile SummaryAdds opt-in tracing around periodic log uploads while preserving no-op behavior when tracing is disabled.
Confidence Score: 5/5The PR appears safe to merge; the previously reported span-lifetime issue is fully fixed and no new actionable failures remain. The upload now executes inside the traced context, completion attributes are attached before the span closes, disabled tracing remains a no-op, and upload exceptions remain non-fatal.
|
| Filename | Overview |
|---|---|
| metaflow/mflog/save_logs_periodically.py | Wraps periodic uploads in an active trace and records outcome attributes without changing their non-fatal behavior. |
| metaflow/tracing/init.py | Makes the disabled tracing context explicitly yield None for compatibility with span-aware callers. |
| metaflow/tracing/tracing_modules.py | Exposes the active span from the tracing context manager so callers can add completion attributes. |
| test/unit/test_save_logs_periodically.py | Covers disabled tracing, span lifetime, successful and failed return codes, and upload exceptions. |
Reviews (3): Last reviewed commit: "Fix periodic log upload span lifetime" | Re-trigger Greptile
Shriprasad-P
force-pushed
the
cursor/add-opt-in-tracing-for-log-uploads-844c
branch
from
September 12, 2026 19:28
895e11a to
9aad30c
Compare
This commit adds optional tracing instrumentation to the SaveLogsPeriodicallySidecar to help diagnose issues where logs stop updating while the sidecar is still running. Changes: - Import traced context manager from metaflow.tracing - Wrap periodic upload invocations in traced() spans - Capture key observability attributes: elapsed_seconds, total_bytes, files_changed, returncode, success status, and exception type (if any) - Add unit tests verifying tracing is opt-in and doesn't interfere with normal operation The tracing is completely opt-in via existing Metaflow tracing configuration (OTEL_ENDPOINT, ZIPKIN_ENDPOINT, or CONSOLE_TRACE_ENABLED). When tracing is disabled (the default), the traced() context manager is a no-op. Fixes Netflix#3307
Keep the periodic upload attempt inside the traced context and expose the active span so upload outcome attributes are recorded before it closes. Preserve the sidecar's existing non-fatal upload exception handling.
Shriprasad-P
force-pushed
the
cursor/add-opt-in-tracing-for-log-uploads-844c
branch
from
September 14, 2026 02:45
9aad30c to
6881d01
Compare
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.
Fixes
Fixes #3307
Summary
Wraps periodic log upload work in Metaflow's existing
traced()helper so uploads emit spans only when tracing is already enabled. Default behavior stays a no-op.Test plan