Unleash / unleash-client-go

Unleash client SDK for Go
https://docs.getunleash.io
Apache License 2.0
138 stars 55 forks source link

Is there a way to get all the feature flags for a project, not just one at a time? #101

Closed ozzieperez closed 2 years ago

ozzieperez commented 2 years ago

Thanks so much for making this client available. Been using it on a project and we're running into an issue where calls to "IsEnabled" start to hang after our server has been running for a few days. We've got about 20 feature flags and loop through an array to fetch each of them every time a user signs into the web app. Restarting the server fixes the issue until it happens again.

I was reading over the feature-toggle docs and it says that querying for a specific feature toggle is not the intended way to use Unleash. Under the "Get specific feature toggle" section on that page it says:

Get specific feature toggle Used to fetch details about a specific feature toggle. This is mainly provided to make it easy to debug the API and should not be used by the client implementations.

Does this client currently support the recommended way from this section of the same page, where it says:

This endpoint is the one all clients should use to fetch all available feature toggles from the unleash-server. The response returns all active feature toggles and their current strategy configuration.

It allows for certain filters:

tag - filters for features tagged with tag project - filters for features belonging to project namePrefix - filters for features beginning with prefix

Thanks for your all you do and in advance for any guidance!

kjvalencik commented 2 years ago

It uses that endpoint.

This sounds like maybe there is a deadlock? IsEnabled does take a read lock.

It could also potentially be metrics failing to flush if the channel buffer fills. Do you have metrics enabled? If you disable them, does it still happen?

ozzieperez commented 2 years ago

@kjvalencik thanks for your feedback. I just realized the version we have installed is v2, which is why I was wondering why ListFeatures wasn't showing up as an option.

image

Yes, we have metrics disabled. We'll update and hopefully that fixes our issue.

Thanks again! ✌️✊