Skip to content
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

Adds workflow replay-safe logger #1434

Merged
merged 19 commits into from
Dec 19, 2024
Merged

Conversation

WhitWaldo
Copy link
Contributor

@WhitWaldo WhitWaldo commented Dec 19, 2024

Description

By popular demand in Discord and after realizing that a lot of the plumbing was already available in the Durable Task SDK itself, I've implemented the version of the ReplaySafe logger used in that version (as opposed to the version in the Azure Functions Durable Task (https://github.com/Azure/azure-functions-durable-extension/tree/dev/src/WebJobs.Extensions.DurableTask). I made a few tweaks to the visibility on the context itself so conform to how Dapr implements the SDK, but nothing major.

As a result, there's a method available on the WorkflowContext for CreateReplaySafeLogger that will provision an ILogger using the category name or the provided type of the context (provided either as an argument or a generic type) from the ILoggerFactory provisioned within the Durable Task SDK itself and its various registrations.

I updated one of the Workflow examples to include the intended usage.

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
…o create the ReplaySafeLogger on the WorkflowContext

Signed-off-by: Whit Waldo <[email protected]>
…e in the context made visible to workflow developers

Signed-off-by: Whit Waldo <[email protected]>
# Conflicts:
#	src/Dapr.Workflow/WorkflowServiceCollectionExtensions.cs
@WhitWaldo WhitWaldo added this to the v1.15 milestone Dec 19, 2024
@WhitWaldo WhitWaldo self-assigned this Dec 19, 2024
@WhitWaldo WhitWaldo marked this pull request as ready for review December 19, 2024 07:05
@WhitWaldo WhitWaldo requested review from a team as code owners December 19, 2024 07:05
…to create it off the TaskOrchestrationContext (innerContext)

Signed-off-by: Whit Waldo <[email protected]>
@WhitWaldo WhitWaldo merged commit a61db8b into dapr:master Dec 19, 2024
12 checks passed
@WhitWaldo WhitWaldo deleted the workflow-logger branch December 19, 2024 22:23
jev-e pushed a commit to jev-e/jev-dotnet-sdk that referenced this pull request Dec 26, 2024
* Removed obsolete type

Signed-off-by: Whit Waldo <[email protected]>

* Added missing using

Signed-off-by: Whit Waldo <[email protected]>

* Adding interface for IWorkflowContext for replayability concerns

Signed-off-by: Whit Waldo <[email protected]>

* Removed unused IConfiguration

Signed-off-by: Whit Waldo <[email protected]>

* Added ReplaySafeLogger type

Signed-off-by: Whit Waldo <[email protected]>

* Building out functionality to expose ReplayLogger in workflow context

Signed-off-by: Whit Waldo <[email protected]>

* Added license information to file

Signed-off-by: Whit Waldo <[email protected]>

* Removed unnecessary file

Signed-off-by: Whit Waldo <[email protected]>

* Updated copyright header for different project, made some tweaks for nullability errors

Signed-off-by: Whit Waldo <[email protected]>

* Added virtual methods that use the already-available ILoggerFactory to create the ReplaySafeLogger on the WorkflowContext

Signed-off-by: Whit Waldo <[email protected]>

* Removed unnecessary registration

Signed-off-by: Whit Waldo <[email protected]>

* Updated example to demonstrate using ReplaySafeLogger in the orchestration context

Signed-off-by: Whit Waldo <[email protected]>

* Tweaks on visibility and abstraction so that the methods are available in the context made visible to workflow developers

Signed-off-by: Whit Waldo <[email protected]>

* Removed obsolete type registrations

Signed-off-by: Whit Waldo <[email protected]>

* Simplified argument null check

Signed-off-by: Whit Waldo <[email protected]>

* Removed since-removed code leftover from merge

Signed-off-by: Whit Waldo <[email protected]>

* Added documentation demonstrating how to access the replay-safe logger

Signed-off-by: Whit Waldo <[email protected]>

* Removed unnecessary and separate ReplaySafeLogger in favor of method to create it off the TaskOrchestrationContext (innerContext)

Signed-off-by: Whit Waldo <[email protected]>

---------

Signed-off-by: Whit Waldo <[email protected]>
jev-e pushed a commit to jev-e/jev-dotnet-sdk that referenced this pull request Dec 26, 2024
* Removed obsolete type

Signed-off-by: Whit Waldo <[email protected]>

* Added missing using

Signed-off-by: Whit Waldo <[email protected]>

* Adding interface for IWorkflowContext for replayability concerns

Signed-off-by: Whit Waldo <[email protected]>

* Removed unused IConfiguration

Signed-off-by: Whit Waldo <[email protected]>

* Added ReplaySafeLogger type

Signed-off-by: Whit Waldo <[email protected]>

* Building out functionality to expose ReplayLogger in workflow context

Signed-off-by: Whit Waldo <[email protected]>

* Added license information to file

Signed-off-by: Whit Waldo <[email protected]>

* Removed unnecessary file

Signed-off-by: Whit Waldo <[email protected]>

* Updated copyright header for different project, made some tweaks for nullability errors

Signed-off-by: Whit Waldo <[email protected]>

* Added virtual methods that use the already-available ILoggerFactory to create the ReplaySafeLogger on the WorkflowContext

Signed-off-by: Whit Waldo <[email protected]>

* Removed unnecessary registration

Signed-off-by: Whit Waldo <[email protected]>

* Updated example to demonstrate using ReplaySafeLogger in the orchestration context

Signed-off-by: Whit Waldo <[email protected]>

* Tweaks on visibility and abstraction so that the methods are available in the context made visible to workflow developers

Signed-off-by: Whit Waldo <[email protected]>

* Removed obsolete type registrations

Signed-off-by: Whit Waldo <[email protected]>

* Simplified argument null check

Signed-off-by: Whit Waldo <[email protected]>

* Removed since-removed code leftover from merge

Signed-off-by: Whit Waldo <[email protected]>

* Added documentation demonstrating how to access the replay-safe logger

Signed-off-by: Whit Waldo <[email protected]>

* Removed unnecessary and separate ReplaySafeLogger in favor of method to create it off the TaskOrchestrationContext (innerContext)

Signed-off-by: Whit Waldo <[email protected]>

---------

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: jev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants