-
Notifications
You must be signed in to change notification settings - Fork 2k
Should we pass go context.Context to all the components? #2716
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
Comments
In service invacation, the context is passthrough the process and finally used for tracing:
I think we should do similar in other components such state / bindings. |
@yaron2 How about this ? |
Yes, that would be a good thing to do. With gRPC at least, we will be able to cancel ongoing calls. There is a PR in place to add a context to Pub Sub. |
OK, I will PR for bindings and state. |
@yaron2 @artursouza Is this still open. If it is can you help me with what all areas should I look into? |
@ShaileshSurya Look at the interfaces for the building blocks in dapr/components-contrib repo. |
@artursouza I see that the component-contrib/state is being consumed by the Dapr repository. We might need to open two different PR's on component-contrib and dapr. This can cause both the repo's going out of sync for a while. How can we go around this? |
This is common. You work on both repos at the same time and submit the PR for both. After we merge the PR for contrib, the PR for dapr/dapr is updated with the latest contrib version in master and we merge that one too. |
@skyao @artursouza I'd like to contribute to the bindings part. |
@pigletfly I reviewed your PR. I left instructions on your PR for next steps you must complete once the contrib PR is merged:
|
@berndverst as for the pubsub component, should be change the interface into
|
Uh oh!
There was an error while loading. Please reload this page.
In golang, context.Context is widely used and it's always be the first argument of go method and passed everywhere.
In dapr current implementation, for example,
pkg/grpc/api.go
, all the public method called by gRPC have the context object, and some them (service incation, actor ) pass context in the next step (always calling the component):And some of them (pub-sub / binding / state ) don't pass context:
So, there are big difference between components.
For example, actor api, all the method start with context argument :
But state api, no context at all:
I suggest to pass the context to all the components in golang style.
In fact, now I'm working to add tracting support in our state and bindings component, and I find that I can't get the context from the public API method of dapr gRPC service, I have to find other way (using metadata, again, we use metadata to do almost everything that dapr don't support) to pass the tracing information like traceid.
The text was updated successfully, but these errors were encountered: