Unleash / unleash-client-rust

Unleash client SDK for Rust language projects
Apache License 2.0
23 stars 18 forks source link

"413 Content Too Large" when submitting metrics #75

Closed kujeger closed 8 months ago

kujeger commented 8 months ago

Describe the bug

Hi!

Testing out this Rust sdk and it works well for getting feature toggle status, but it always fails when submitting metrics, with this in the log:

WARN unleash_api_client::client > poll: error uploading feature metrics

after adding some debug lines in the library, it turns out that the actual error (that unfortunately gets swallowed in post_json) is along the lines of

413 Content Too Large
Error
Payload Too Large

Our unleash installation (at FINN.no) has a large amount of features, and digging through the code, it looks like the rust client tries to upload metrics for every single feature that exists -- even if I've only configured a UserFeatures enum with a single variant -- resulting in over 150KB of data.

Is this intentional and required? Naively I'd have guessed that it only made sens to upload metrics for the features defined in the enum passed to the client builder.

Steps to reproduce the bug

No response

Expected behavior

No response

Logs, error output, etc.

No response

Screenshots

No response

Additional context

No response

Unleash version

3.17

Subscription type

Open source

Hosting type

Self-hosted

SDK information (language and version)

No response

kujeger commented 8 months ago

fwiw deleting these lines fixed the issues when testing: https://github.com/kujeger/unleash-client-rust/commit/11fdff7766165d52fff42237dee6d732bd038244

assuming it isn't too horrible a hack I'd be happy to make a PR out of it

edit: ah yeah, that breaks metrics for features checked with client.is_enabled_str(), so not exactly a proper fix.