You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@hamilton.apache.org by "Dev-iL (via GitHub)" <gi...@apache.org> on 2026/04/26 12:28:00 UTC

[PR] Upgrade Datadog plugin to ddtrace 4.x public API [hamilton]

Dev-iL opened a new pull request, #1563:
URL: https://github.com/apache/hamilton/pull/1563

   related: #1288 
   fixes: #1562 
   
   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.
   
   ### Summary
   - Migrate `h_ddog.py` imports from removed top-level `ddtrace.Span`/`ddtrace.context` to the canonical `ddtrace.trace` module (`ddtrace.trace.Span`, `ddtrace.trace.Context`)
   - Bump version constraint from `ddtrace<3.0` to `ddtrace>=4.0` in both the `datadog` optional dependency and the `docs` dependency group
   - Fix stale `sf-hamilton` package references to `apache-hamilton` in the ImportError message and DDOGTracer docstring
   - Remove the outdated TODO comment about ddtrace 3.0 deprecation
   - Add smoke tests for the plugin (`tests/plugins/test_h_ddog.py`)
   
   ### Motivation
   
   ddtrace 3.0 removed `Span` and `context` from the top-level `ddtrace` package ([DataDog/dd-trace-py#12186](https://github.com/DataDog/dd-trace-py/pull/12186)). The Hamilton plugin was pinned to `ddtrace<3.0` as a temporary workaround. This PR migrates to the stable public API at `ddtrace.trace`, which is the canonical location in ddtrace 4.x.
   
   ### Changes
   
   | File | What changed |
   |------|-------------|
   | `hamilton/plugins/h_ddog.py` | `from ddtrace import Span, context, tracer` split into `from ddtrace import tracer` + `from ddtrace.trace import Context, Span`; `context.Context` replaced with `Context` in type annotations and constructor calls; TODO comment removed; `sf-hamilton` references updated to `apache-hamilton` |
   | `pyproject.toml` | `ddtrace<3.0` changed to `ddtrace>=4.0` in `[project.optional-dependencies].datadog` and `docs` |
   | `tests/plugins/test_h_ddog.py` | New file with 7 tests covering span lifecycle (happy path, error path, task-based), AsyncDDOGTracer instantiation, and serialization/deserialization round-trip |
   
   ### No breaking changes
   
   The public API surface of `DDOGTracer` and `AsyncDDOGTracer` is unchanged: same constructor signatures, same methods, same base class hierarchy. Only internal import paths changed.
   
   ### Test plan
   - [x] `DDOGTracer` span lifecycle: `before_graph` -> `before_node` -> `after_node` -> `after_graph`
   - [x] Error propagation through span `__exit__`
   - [x] Task-based span lifecycle with `before_task`/`after_task`
   - [x] `AsyncDDOGTracer` instantiation with all parameter combinations
   - [x] `__getstate__`/`__setstate__` serialization round-trip
   - [x] `_serialize_span_dict`/`_deserialize_span_dict` round-trip
   - [x] Module imports successfully with ddtrace 4.4.0
   - [x] No stale `ddtrace<3.0` pins or `sf-hamilton` references remain
   
   ## Checklist
   
   - [x] PR has an informative and human-readable title (this will be pulled into the release notes)
   - [x] Changes are limited to a single goal (no scope creep)
   - [x] Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
   - [x] Any _change_ in functionality is tested
   - [x] New functions are documented (with a description, list of inputs, and expected output)
   - [x] Placeholder code is flagged / future TODOs are captured in comments
   - [x] Project documentation has been updated if adding/changing functionality.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@hamilton.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Upgrade Datadog plugin to ddtrace 4.x public API [hamilton]

Posted by "skrawcz (via GitHub)" <gi...@apache.org>.
skrawcz merged PR #1563:
URL: https://github.com/apache/hamilton/pull/1563


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@hamilton.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Upgrade Datadog plugin to ddtrace 4.x public API [hamilton]

Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on PR #1563:
URL: https://github.com/apache/hamilton/pull/1563#issuecomment-4366983420

   @skrawcz Feedback addressed + fixed some random CI issues.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@hamilton.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org