Skip to content

Conversation

salaboy
Copy link
Collaborator

@salaboy salaboy commented Nov 23, 2023

Description

This PR adds the interceptor to inject the Dapr API Token to the Durable Tasks Worker, which is needed to make sure that the token gets sent by the workflows SDK.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #962

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

@salaboy salaboy requested review from a team as code owners November 23, 2023 08:44
}

private static ClientInterceptor WORKFLOW_INTERCEPTOR = new ClientInterceptor() {
public static ClientInterceptor WORKFLOW_INTERCEPTOR = new ClientInterceptor() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to avoid making this public? This makes this part of the SDK user facing surface with this change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is an interceptor, I believe it is ok to make it public and part of the interface, as this functionality can apply to other application code where the Dapr Token might want to be added.. does that make sense @artursouza ?

Copy link
Contributor

@artursouza artursouza Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose we create a new class, called WorkflowGrpcInterceptor (or something similar) in a packaged called io.dapr.workflows.internal because that communicate that anything in that package is for internal use and is not part of our interface with the application.

So, we can use the same class in both places here but just will not be a shared instance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@salaboy salaboy requested a review from artursouza December 11, 2023 18:50
@codecov
Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (da395f8) 76.54% compared to head (05a94f0) 76.64%.
Report is 1 commits behind head on master.

Files Patch % Lines
.../workflows/internal/ApiTokenClientInterceptor.java 12.50% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #963      +/-   ##
============================================
+ Coverage     76.54%   76.64%   +0.10%     
- Complexity     1467     1470       +3     
============================================
  Files           137      138       +1     
  Lines          4472     4475       +3     
  Branches        527      527              
============================================
+ Hits           3423     3430       +7     
+ Misses          763      760       -3     
+ Partials        286      285       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@artursouza artursouza merged commit 0c7828e into dapr:master Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dapr API Token not added for Durable Task Worker in Workflows SDK

2 participants