Upgrade Datadog plugin to ddtrace 4.x public API#1563
Open
Dev-iL wants to merge 1 commit intoapache:mainfrom
Open
Upgrade Datadog plugin to ddtrace 4.x public API#1563Dev-iL wants to merge 1 commit intoapache:mainfrom
Dev-iL wants to merge 1 commit intoapache:mainfrom
Conversation
ddtrace 3.0 removed `Span` and `context` from the top-level package. Migrate to the canonical `ddtrace.trace` module, bump the version constraint to `>=4.0`, fix stale `sf-hamilton` package references, and add smoke tests for the plugin. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
64b35ca to
1dcfe4a
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.
related: #1288
fixes: #1562
ddtrace 3.0 removed
Spanandcontextfrom the top-level package. Migrate to the canonicalddtrace.tracemodule, bump the version constraint to>=4.0, fix stalesf-hamiltonpackage references, and add smoke tests for the plugin.Summary
h_ddog.pyimports from removed top-levelddtrace.Span/ddtrace.contextto the canonicalddtrace.tracemodule (ddtrace.trace.Span,ddtrace.trace.Context)ddtrace<3.0toddtrace>=4.0in both thedatadogoptional dependency and thedocsdependency groupsf-hamiltonpackage references toapache-hamiltonin the ImportError message and DDOGTracer docstringtests/plugins/test_h_ddog.py)Motivation
ddtrace 3.0 removed
Spanandcontextfrom the top-levelddtracepackage (DataDog/dd-trace-py#12186). The Hamilton plugin was pinned toddtrace<3.0as a temporary workaround. This PR migrates to the stable public API atddtrace.trace, which is the canonical location in ddtrace 4.x.Changes
hamilton/plugins/h_ddog.pyfrom ddtrace import Span, context, tracersplit intofrom ddtrace import tracer+from ddtrace.trace import Context, Span;context.Contextreplaced withContextin type annotations and constructor calls; TODO comment removed;sf-hamiltonreferences updated toapache-hamiltonpyproject.tomlddtrace<3.0changed toddtrace>=4.0in[project.optional-dependencies].datadoganddocstests/plugins/test_h_ddog.pyNo breaking changes
The public API surface of
DDOGTracerandAsyncDDOGTraceris unchanged: same constructor signatures, same methods, same base class hierarchy. Only internal import paths changed.Test plan
DDOGTracerspan lifecycle:before_graph->before_node->after_node->after_graph__exit__before_task/after_taskAsyncDDOGTracerinstantiation with all parameter combinations__getstate__/__setstate__serialization round-trip_serialize_span_dict/_deserialize_span_dictround-tripddtrace<3.0pins orsf-hamiltonreferences remainChecklist