PostHog / posthog-go

Official PostHog Go library
MIT License
21 stars 19 forks source link

Possible improvements? #23

Open craigpastro opened 1 year ago

craigpastro commented 1 year ago

👋 Hello!

I am trying out PostHog, and I wanted to use PostHog feature flags via OpenFeature, so I wrote a PostHog provider for OpenFeature. (You can find it https://github.com/craigpastro/posthog-openfeature-provider-go if you are interested 🙂 )

Basically, the provider simply wraps IsFeatureEnabled. During the writing of the provider there were a few things I noticed that I think could be improved and wanted to ask what you thought.

So, these mostly relate to the IsFeatureEnabled method.

  1. The call doesn't error out if the API key is incorrect. It does log "posthog 2023/09/07 15:43:34 ERROR: Error calling /decide/" which is not that useful.
  2. It would be nice if this method returned a boolean.
  3. If the flag doesn't exist we have no way of knowing this and we just get back false. It would be nice to somehow know that the flag doesn't exist.
  4. Every request logs "posthog 2023/09/07 15:04:36 ERROR: Unable to fetch feature flags%!(EXTRA )", but I am not sure why.
  5. Not exactly related to IsFeatureEnabled, but if I simply specify a non-empty personal API key when constructing the client, this request succeeds. So is the personal API key actually required?

Thank you for your time! If there are some things you think we can improve I would be happy to try to create a PR.

lita commented 11 months ago

I also been having the same issues as above ^^^ also find it frustrating that i cannot get the payload of the feature flag.