Add OTel Hook
toddbaert opened this issue · 0 comments
toddbaert commented
Now that OTel 2529 is merged, we should implement an Open Telemetry hook.
Basically, this would entail creating a hook which:
- in the
after
stage: gets the current span and adds an appropriately named event (feature_flag
), with the attributes (feature_flag.key
,feature_flag.provider_name
, andfeature_flag.variant
) - in the
error
stage, records the exception
In pseudocode, this looks something like:
class OTelHook implements Hook {
after(context, details) {
var currentTrace = trace.getActiveSpan();
currentTrace.addEvent("feature_flag", { "feature_flag.key": details.key, /* other props */ } );
}
error(err) {
var currentTrace = trace.getActiveSpan();
currentTrace.recordException(err);
}
}