-
Notifications
You must be signed in to change notification settings - Fork 34
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
Proposal for actor metadata. #70
Open
artursouza
wants to merge
1
commit into
dapr:main
Choose a base branch
from
artursouza:actor_metadata
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Actor Metadata in Dapr SDKs | ||
|
||
* Author(s): Artur Souza (@artursouza) | ||
* State: Draft | ||
* Updated: 11/21/2024 | ||
|
||
## Overview | ||
|
||
Actor invocations are done by Dapr SDKs and also handled by Dapr SDKs at the server side, unless the app decides to implement the HTTP or gRPC handles directly. This proposal is to allow Actor SDKs to include custom HTTP headers or gRPC metadata to actor method invocations that the app can choose to handle via custom handlers or interceptors. | ||
|
||
## Background | ||
|
||
### Motivation | ||
- Applications might have custom logic to authorize calls on the server side of actor invocation, requiring calls from a client to include the app's identifier or token. | ||
|
||
### Goals | ||
- Dapr users can invoke Dapr actors with custom HTTP headers or gRPC metadata for custom logic on the server-side. | ||
|
||
### Non-goals | ||
- Handle custom HTTP headers or gRPC metadata in SDK's runtime. | ||
|
||
### Current Shortfalls | ||
- Applications need to wrap custom metadata as attributes of the input object of the actor method, for example: | ||
```java | ||
public class Order { | ||
private String orderId; | ||
private String customerName; | ||
private double orderTotal; | ||
private Map<String, String> headers; | ||
|
||
... | ||
} | ||
``` | ||
|
||
## Expectations and alternatives | ||
|
||
* What is in scope for this proposal? | ||
- SDKs to support a map of HTTP headers or gRPC metadata to be added in all actor method invocations. | ||
|
||
* What is deliberately *not* in scope? | ||
- Server-side handling of the metadata in SDKs - that is expected to be handled by app. | ||
|
||
* What alternatives have been considered, and why do they not solve the problem? | ||
1. Leave every SDK as-is: | ||
- Users need to include the custom headers or metadata as extra attributes in their business object models. | ||
2. Add headers per request | ||
- Need to change how actors are invoked by supporting more than 1 param in methods, also breaking the protocol agnostic nature of the actors API. | ||
|
||
* Are there any trade-offs being made? (space for time, for example) | ||
1. The HTTP headers or gRPC metadata will be per client, meaning all calls from that client will include the metadata from them. | ||
|
||
* What advantages / disadvantages does this proposal have? | ||
Pros: | ||
- Allows actor clients to include HTTP headers or gRPC metadata while keeping the protocol agnostic nature of the Actor SDK runtime. | ||
|
||
Cons: | ||
- Does not support metadata values per request. | ||
|
||
## Implementation Details | ||
|
||
### Design | ||
|
||
When instantiating an Actor client or Actor proxy on any of the SDKs, the user might optionally pass a map of string of strings with headers or metadata to be passed in every actor invocation coming from that actor client instance. | ||
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. I realized that this also needs runtime changes to propagate the HTTP headers or gRPC metadata. |
||
|
||
#### Example of implementation | ||
|
||
TBD | ||
|
||
### Feature lifecycle outline | ||
|
||
* Compatability guarantees | ||
This change does not require the Actor implementation to process custom HTTP headers or gRPC metadata as those are expected to be handled by the app's logic. | ||
|
||
* Deprecation / co-existence with existing functionality | ||
If not handles, the custom HTTP headers or gRPC metadata are simply ignored. | ||
|
||
* Feature flags | ||
Not needed. | ||
|
||
### Acceptance Criteria | ||
|
||
How will success be measured? | ||
|
||
* Performance targets | ||
N/A | ||
|
||
* Compabitility requirements | ||
Cross SDK calls work with or without custom HTTP headers or gRPC metadata. | ||
|
||
* Metrics | ||
N/A | ||
|
||
## Completion Checklist | ||
|
||
What changes or actions are required to make this proposal complete? | ||
|
||
* SDK changes | ||
* Add support for include HTTP headers or gRPC metadata in gRPC client. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
To confirm - this proposal allows for the actors API to include custom metadata and propagate it through to server side but is not proposing changing any of the SDKs to include a metadata param in the actor invocation calls, correct?