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

Added option to override GrpcChannelOptions when adding DaprWorkflow (#7218) #1244

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

humandigital-ruud
Copy link

@humandigital-ruud humandigital-ruud commented Feb 23, 2024

Description

You can now use custom GrpcChannelOptions when using DaprWorkflow, in the same manner as was already the case when creating the DaprClient:

builder.Services.AddDaprWorkflow(options =>
{
    options.UseGrpcChannelOptions(new GrpcChannelOptions
    {
        MaxReceiveMessageSize = 32 * 1024 * 1024,
        MaxSendMessageSize = 32 * 1024 * 1024
    });
});

Issue reference

See issue: GRPC data receive limits (#7218)

return GrpcChannel.ForAddress(daprEndpoint, options);
}
GrpcChannelOptions options = grpcChannelOptions ?? new();
options.HttpClient ??= client;
Copy link
Collaborator

Choose a reason for hiding this comment

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

A nit: if the caller provides gRPC options with a HttpClient, they won't get the Dapr API token behavior. If the caller does not provide a HttpClient, they'll only get access to "Dapr's" default HttpClient (after the fact, by virtue of it being attached to the options object). Neither is great if the caller needs a more customized HttpClient.

While this is changed is patterned after the options handling in the DaprClient (for which I have the same nit), I wonder if it might be good to try to use a pattern that allows callers to change options but not at the risk of overriding customized behavior needed by Dapr. A pattern that can then be replicated in DaprClient. Is there any reason to not just expose a public GrpcChannelOptions property from WorkflowRuntimeOptions? This property can be initialized to those settings typically used by Dapr (including the HttpClient). The caller then has the ability to add/change settings as needed with less risk of stomping on Dapr-needed settings.

Choose a reason for hiding this comment

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

please review again, changed the way the parameters are used.

@@ -153,31 +149,33 @@ static bool TryGetGrpcAddress(out string address)
return false;
}

static GrpcChannel CreateChannel(string address, HttpClient client)
static GrpcChannel CreateChannel(string address, HttpClient client, GrpcChannelOptions? grpcChannelOptions = null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also used by workflow clients, right? Would they not have similar needs to customize gRPC options as well?

Choose a reason for hiding this comment

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

Hey @philliphoff this has been addressed couple of weeks ago, could you take a look? Many thanks!

Copy link
Collaborator

@philliphoff philliphoff left a comment

Choose a reason for hiding this comment

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

A couple of comments about how gRPC options are exposed to both workflow runtime and client callers. Also, it'd be good to have some unit/integration tests built around at least the main scenario this is intended to solve (i.e. increasing the max. message size).

@philliphoff
Copy link
Collaborator

@humandigital-ruud Are you still interested in pursuing this PR?

@humandigital-ruud
Copy link
Author

@humandigital-ruud Are you still interested in pursuing this PR?

I will discuss this with my co-worker to see if he can take this over from me and spend some more time on it to get it right

@humandigital-michiel
Copy link

@humandigital-ruud Are you still interested in pursuing this PR?

I will discuss this with my co-worker to see if he can take this over from me and spend some more time on it to get it right

Hi!

@humandigital-michiel
Copy link

humandigital-michiel commented Jul 18, 2024

hi @philliphoff i made some adjustments based on your feedback. One of my first contributions to dapr.

@philliphoff gentle reminder for this one.

humandigital-ruud and others added 2 commits August 26, 2024 09:13
…(#7218)

Signed-off-by: Ruud van Falier <ruud.vanfalier@humandigital.nl>
Signed-off-by: Michiel van Praat <michiel.vanpraat@humandigital.nl>
Signed-off-by: Michiel van Praat <michiel.vanpraat@humandigital.nl>
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.

3 participants