Closed nelzkiddom closed 4 months ago
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.
FYI, I tried my hand at a first pass, will probably serve us for now: https://github.com/nelz9999/goldhook
Hi @nelzkiddom , this is actually supported now using the new ldotel
package in this repo.
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
andXXXVariationDetails
functions that take acontext.Context
as a first parameter. Then, also the ability to configure a hook/"observable" style function that takes thecontext.Context
and theldreason.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.