Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ protobuf policies remain supported. See [ID reuse](docs/features.md#orchestratio

FIXED

- Python SDK spans now use the `Microsoft.DurableTask` OpenTelemetry instrumentation
scope. Update queries, dashboards, and collector filters that use the previous
`durabletask` scope.
Comment on lines +19 to +21
- Activity and sub-orchestration `retry_timeout` decisions now use replay-safe
orchestration time, preventing retries from expiring solely because history is
replayed later. Retry calculations also accept timezone-aware timestamps.
Expand Down
3 changes: 3 additions & 0 deletions durabletask-azuremanaged/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Core release and dependency minimum updates are coordinated in the dedicated rel

FIXED

- With the corresponding core `durabletask` SDK update, Azure Managed spans use
the `Microsoft.DurableTask` OpenTelemetry instrumentation scope. Update queries,
dashboards, and collector filters that match the previous `durabletask` scope.
- With the corresponding core SDK update, activity and sub-orchestration
`retry_timeout` decisions use replay-safe orchestration time rather than
wall-clock time. See the [core upgrade guidance](../CHANGELOG.md#unreleased)
Expand Down
2 changes: 1 addition & 1 deletion durabletask/internal/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class _StatusCodeStub:
OTEL_AVAILABLE = _OTEL_AVAILABLE

# The instrumentation scope name used when creating spans.
_TRACER_NAME = "durabletask"
_TRACER_NAME = "Microsoft.DurableTask"
_SPAN_EMISSION_SUPPRESSED: ContextVar[bool] = ContextVar(
"durabletask_span_emission_suppressed",
default=False,
Expand Down
3 changes: 2 additions & 1 deletion tests/azure-functions-durable/e2e/_harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,11 @@ def get_spans(self) -> list[dict[str, Any]]:
continue
payload = json.loads(line)
for resource_spans in payload.get("resourceSpans", []):
resource = resource_spans.get("resource", {})
for scope_spans in resource_spans.get("scopeSpans", []):
scope_name = scope_spans.get("scope", {}).get("name", "")
for span in scope_spans.get("spans", []):
spans.append({**span, "scopeName": scope_name})
spans.append({**span, "scopeName": scope_name, "resource": resource})
return spans

def get_logs(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def test_user_span_correlates_to_host_without_worker_lifecycle_duplicates(
(
span.get("name"),
span.get("scopeName"),
_attribute_value(span["resource"], "service.name"),
span.get("traceId"),
span.get("spanId"),
span.get("parentSpanId"),
Expand All @@ -70,12 +71,16 @@ def test_user_span_correlates_to_host_without_worker_lifecycle_duplicates(
assert len(starter_spans) == 1, summary
assert starter_spans[0].get("traceId") == user_span.get("traceId"), summary
assert len(parent_spans) == 1, summary
assert parent_spans[0].get("scopeName") != "durabletask"
worker_service = _attribute_value(user_span["resource"], "service.name")
assert worker_service == "durable-functions-python-worker", summary
parent_service = _attribute_value(parent_spans[0]["resource"], "service.name")
assert parent_service != worker_service, summary
assert parent_spans[0].get("spanId") != starter_spans[0].get("spanId"), summary

python_lifecycle_spans = [
span for span in spans
if span.get("traceId") == user_span.get("traceId")
if span.get("scopeName") == "durabletask"
if span.get("scopeName") == "Microsoft.DurableTask"
if _attribute_value(span["resource"], "service.name") == worker_service
]
assert python_lifecycle_spans == []
assert python_lifecycle_spans == [], summary
4 changes: 4 additions & 0 deletions tests/durabletask/test_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def test_creates_span_without_parent(self, otel_setup: InMemorySpanExporter):
spans = otel_setup.get_finished_spans()
assert len(spans) == 1
assert spans[0].name == "test-span"
assert spans[0].instrumentation_scope is not None
assert spans[0].instrumentation_scope.name == "Microsoft.DurableTask"

def test_creates_span_with_attributes(self, otel_setup: InMemorySpanExporter):
"""Should create a span with custom attributes."""
Expand Down Expand Up @@ -1719,6 +1721,8 @@ def test_emits_span_with_correct_attributes(self, otel_setup: InMemorySpanExport
s = spans[0]
assert s.name == "activity:SayHello"
assert s.kind == trace.SpanKind.CLIENT
assert s.instrumentation_scope is not None
assert s.instrumentation_scope.name == "Microsoft.DurableTask"
assert s.attributes is not None
assert s.attributes[tracing.ATTR_TASK_TYPE] == "activity"
assert s.attributes[tracing.ATTR_TASK_NAME] == "SayHello"
Expand Down