-
Notifications
You must be signed in to change notification settings - Fork 32
Add custom FailureDetails properties #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
61f1196
242afd6
fc7897a
25d060b
ddaa948
cc0cd89
4e8e6ff
1fcdd38
e61a922
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,34 @@ pip install durabletask[azure-blob-payloads] | |
| See the [feature documentation](./docs/features.md#large-payload-externalization) and the | ||
| [example](./examples/large_payload/) for usage details. | ||
|
|
||
| ### Failure Details Properties | ||
|
|
||
| Configure an `ExceptionPropertiesProvider` to attach portable diagnostic | ||
| properties to activity, entity, and orchestration failures: | ||
|
|
||
| ```python | ||
| from durabletask import ExceptionPropertiesProvider | ||
| from durabletask.worker import TaskHubGrpcWorker | ||
|
|
||
|
|
||
| class FailureProperties(ExceptionPropertiesProvider): | ||
| def get_exception_properties(self, exception: Exception): | ||
| return {"error_code": getattr(exception, "error_code", None)} | ||
|
|
||
|
|
||
| worker = TaskHubGrpcWorker(exception_properties_provider=FailureProperties()) | ||
| ``` | ||
|
|
||
| Properties support `None`, booleans, numbers, strings, nested mappings, and | ||
| lists. They are available from `TaskFailedError.details`, orchestration state, | ||
| and history as `FailureDetails.properties`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Post-merge follow-up: this guarantee does not currently hold across failed sub-orchestrations in |
||
|
|
||
| > [!NOTE] | ||
| > Python intentionally treats `.NET`'s `dt:` and `dto:` property strings as | ||
| > ordinary strings, matching the Java SDK. Consequently, `datetime` values do | ||
| > not retain their type across Python/.NET failure-details property round trips; | ||
| > this is a .NET SDK parity gap. | ||
|
|
||
| ## Trademarks | ||
|
|
||
| This project may contain trademarks or logos for projects, products, or services. Authorized use of | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| """Types for enriching task failure details.""" | ||
|
|
||
| from collections.abc import Mapping | ||
| from typing import Any, Protocol | ||
|
|
||
|
|
||
| class ExceptionPropertiesProvider(Protocol): | ||
| """Extract portable custom properties from an exception.""" | ||
|
|
||
| def get_exception_properties(self, exception: Exception) -> Mapping[str, Any] | None: | ||
| """Return properties to include in the exception's failure details.""" | ||
| ... | ||
|
andystaples marked this conversation as resolved.
Dismissed
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: repository changelog policy keeps wrapped entry text unindented. Please align these continuation lines with the existing entry below and make the same adjustment in durabletask-azuremanaged/CHANGELOG.md.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed while resolving the current main merge in 1fcdd38. Both changelog entries now use unindented continuation lines, matching repository policy.