Now that OTel 2529 is merged, we should implement the 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, and feature_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);
}
}
Now that OTel 2529 is merged, we should implement the Open Telemetry hook.
Basically, this would entail creating a hook which:
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
)error
stage, records the exceptionIn pseudocode, this looks something like:
See: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/feature-flags.md