Skip to content

Commit 6d2f7eb

Browse files
fix(di): use enum value for evaluate_at property [backport 2.15] (#11152)
Backport c2ebba1 from #11100 to 2.15. We make sure that we get the value from the enum for the evaluate_at property so that proper validation and comparison can be performed. Currently, the timing value is stored as a plain string, whereas the logic that handles them expects one of the possible enum values, thus making the check fail always. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: Gabriele N. Tornetta <[email protected]>
1 parent 530a964 commit 6d2f7eb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ddtrace/debugging/_probe/remoteconfig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from ddtrace.debugging._probe.model import MetricFunctionProbe
2525
from ddtrace.debugging._probe.model import MetricLineProbe
2626
from ddtrace.debugging._probe.model import Probe
27+
from ddtrace.debugging._probe.model import ProbeEvaluateTimingForMethod
2728
from ddtrace.debugging._probe.model import ProbeType
2829
from ddtrace.debugging._probe.model import SpanDecoration
2930
from ddtrace.debugging._probe.model import SpanDecorationFunctionProbe
@@ -102,7 +103,7 @@ def build(cls, args: Dict[str, Any], attribs: Dict[str, Any]) -> Any:
102103

103104
args["module"] = where.get("type") or where["typeName"]
104105
args["func_qname"] = where.get("method") or where["methodName"]
105-
args["evaluate_at"] = attribs.get("evaluateAt")
106+
args["evaluate_at"] = ProbeEvaluateTimingForMethod[attribs.get("evaluateAt", "DEFAULT")]
106107

107108
return cls.__function_class__(**args)
108109

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
dynamic instrumentation: Fixes an issue that prevented dynamic span tags
5+
probes from adding the requested tags to the requested span.

0 commit comments

Comments
 (0)