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

context.Context and/or evaluation hooks #63

Open
nelzkiddom opened this issue Oct 26, 2021 · 2 comments
Open

context.Context and/or evaluation hooks #63

nelzkiddom opened this issue Oct 26, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@nelzkiddom
Copy link

Is your feature request related to a problem? Please describe.
I would like my feature flag evaluations to participate in my telemetry collection

Describe the solution you'd like
I'd like to see new XXXVariation and XXXVariationDetails functions that take a context.Context as a first parameter.
Then, also the ability to configure a hook/"observable" style function that takes the context.Context and the ldreason.EvaluationDetail so that I can emit this information to my telemetry system.

Describe alternatives you've considered
I've thought about writing an extension of the SDK to provide context-aware extensions, but that just seems like I'd always be chasing the current implementation, and it is probably in LD's interests to provide flexible post-evaluation hooks, possibly with provided default hook implementations that work with OpenTelemetry.

@bwoskow-ld
Copy link
Member

Hi @nelzkiddom,

Thanks for the suggestion! We've actually already had internal discussions about the idea of adding evaluation hooks to our suite of SDKs. The main use case we've considered is to be able to accumulate flag metrics for observability purposes. Unfortunately we haven't yet made progress on implementing this feature in our SDKs.

In the meantime, one thing you could consider doing is implementing a wrapper layer around the LaunchDarkly SDK. The wrapper would accept a context and would just decorate the LaunchDarkly SDK while also accumulating data into the context. As long as you keep the wrapper lightweight and minimal then I don't expect it to cause much extra lift to your team, but that's up to you.

@bwoskow-ld bwoskow-ld added the enhancement New feature or request label Oct 28, 2021
@nelzkiddom
Copy link
Author

FYI, I tried my hand at a first pass, will probably serve us for now: https://github.com/nelz9999/goldhook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants