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

Adding dapr api token interceptor for durable task #963

Merged
merged 5 commits into from
Dec 12, 2023

Conversation

salaboy
Copy link
Contributor

@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
@@ -262,7 +262,7 @@ public void close() throws InterruptedException {
}
}

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

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
Contributor 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
Member

@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
Contributor Author

Choose a reason for hiding this comment

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

done

@salaboy salaboy force-pushed the intercep-token-durabletask branch 2 times, most recently from b51aa47 to 2ea0df7 Compare December 11, 2023 08:16
@salaboy salaboy requested a review from artursouza December 11, 2023 18:50
@salaboy salaboy force-pushed the intercep-token-durabletask branch from 31e470a to 9c534bb Compare December 12, 2023 09:19
@salaboy salaboy force-pushed the intercep-token-durabletask branch from 57c7b6b to 1645203 Compare December 12, 2023 13:39
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