temporalio / sdk-core

Core Temporal SDK that can be used as a base for language specific Temporal SDKs
MIT License
262 stars 70 forks source link

[Feature Request] Managing dependencies for the Rust SDK #687

Open djc opened 6 months ago

djc commented 6 months ago

Is your feature request related to a problem? Please describe.

It would be great if the Rust SDK dragged in as few dependencies as possible. Dependencies increase build times throughout downstream projects. While some dependencies provide invaluable functionalities, other times there might be a way to do the same work without taking on an additional dependency.

Our monorepo contains about 90k lines of Rust code and pulls in some 800 crates. Adding the temporal-sdk stack of crates added a bunch more. It would be nice to minimize the impact on build times for our repo (and I assume it might also help for your build times in lang SDKs).

Describe the solution you'd like

Make good trade-offs about which dependencies provide enough value vs being a net drag on compile time.

Additional context

Here are indirect dependencies that were added to our workspace Cargo.lock when adding temporal-sdk:

From this, things that I'd like to see improved:

I am open to putting some time into this as we really prefer to limit build times in our work environment.

Sushisource commented 6 months ago

@djc I'm happy to accept pulls for removing mockall (can definitely be done, not necessarily easy) and otel (probably pretty easy to make optional).

The separate hasher crate is used for because the one in stdlib is deprecated.

The convenience macros I find pretty useful. The savings would have to be quite significant for me to want to remove them, and I have no idea what those savings would be without seeing. I can't imagine they're causing a huge amount of bloat.

And yes the tonic bump is just waiting on otel.

djc commented 6 months ago

mockall (can definitely be done, not necessarily easy)

Can you briefly explain what the goal/use case of the MockManualWorkerClient is?

Sushisource commented 6 months ago

mockall (can definitely be done, not necessarily easy)

Can you briefly explain what the goal/use case of the MockManualWorkerClient is?

For testing of course. But, in production it's used to enable replay workers: https://github.com/temporalio/sdk-core/blob/a7644056a651e5c3e828ff2537df1e42d9cfd904/core/src/replay/mod.rs#L74

This could be un-done and replaced with something else, but it's not trivial.