Documentation
¶
Overview ¶
Package openfeature provides a lightweight bridge between the tracer's early Remote Config subscription and the late-created OpenFeature DatadogProvider.
This package intentionally has minimal dependencies (only internal/remoteconfig) so the tracer can import it without pulling in the OpenFeature SDK or OTel.
Index ¶
- Constants
- func AttachCallback(cb Callback) bool
- func GetBufferedForTest() remoteconfig.ProductUpdate
- func ResetForTest()
- func SetBufferedForTest(u remoteconfig.ProductUpdate)
- func SetSubscribedForTest(v bool)
- func SubscribeProvider(cb remoteconfig.ProductCallback) (tracerOwnsSubscription bool, err error)
- func SubscribeRC() error
- type Callback
Constants ¶
const (
// FFEProductName is the RC product name for feature flag evaluation.
FFEProductName = "FFE_FLAGS"
)
Variables ¶
This section is empty.
Functions ¶
func AttachCallback ¶
AttachCallback wires the given callback to the global RC subscription. If SubscribeRC() was called (i.e. the tracer subscribed), it replays any buffered config and returns true. Otherwise returns false, meaning the caller should fall back to its own RC subscription.
func GetBufferedForTest ¶
func GetBufferedForTest() remoteconfig.ProductUpdate
GetBufferedForTest returns the current buffered update for testing.
func SetBufferedForTest ¶
func SetBufferedForTest(u remoteconfig.ProductUpdate)
SetBufferedForTest sets a buffered update for testing.
func SetSubscribedForTest ¶
func SetSubscribedForTest(v bool)
SetSubscribedForTest sets the subscribed flag without actually calling Subscribe.
func SubscribeProvider ¶
func SubscribeProvider(cb remoteconfig.ProductCallback) (tracerOwnsSubscription bool, err error)
SubscribeProvider attempts to subscribe a provider callback to RC. It holds the subscription mutex to prevent races with SubscribeRC.
func SubscribeRC ¶
func SubscribeRC() error
SubscribeRC subscribes to the FFE_FLAGS RC product using a forwarding callback. It is called by the tracer during startRemoteConfig() so that FFE_FLAGS is included in the first RC poll.
Types ¶
type Callback ¶
type Callback func(update remoteconfig.ProductUpdate) map[string]rc.ApplyStatus
Callback is a function that processes an RC product update and returns apply statuses. This matches the signature of DatadogProvider.rcCallback.