flush.
OpenFeature and the wire still say flagKey. The capture body uses type: "exposure". fw-server may map that to a vendor $feature_flag_called — SDKs never emit that name on the public FireWeave wire.
This is not OpenFeature Tracking (spec §6). provider.track is not implemented.
Why it exists
Evaluation is side-effect-free by default so a read does not imply “we showed this variant.” You opt in when you need assignment proof — analytics, holdouts, or correlating a Decision to a release.When to use it
- Pass
sendExposure: true(or language equivalent) on evaluate when this call is the serve - Call
exposures.recordwhen you evaluated once and served many users, or you need extra correlation (rolloutId) - Always
flushbefore you care that the queue left the process — especially on Java
How it relates
When an exposure happens
Dedup, batching, flush
Dedup key (Node, Python, Go, and the extensions contract):(targetingKey, flagKey, variant, value).
- Duplicates return
okwithdeduped: trueand are not re-queued. - The seen-set clears on flush so it cannot grow for the process lifetime. The same tuple can queue again after a flush.
flush drains the queue to the adapter sink (POST /v1/capture on the remote adapter). Return shape is typically { ok, flushed, queued } (Go returns a count + error).
Web also flushes on visibilitychange → hidden and pagehide, using keepalive fetch and sendBeacon as a fallback. sendBeacon cannot set Authorization; keepalive fetch is preferred.
Shutdown
Default shutdown timeout is 10_000 ms where the runtime exposes one.
Failure behavior
- Evaluate still never throws if exposure emission fails. A failed sink does not change the Decision.
record/flushdegrade with result objects (Go:error) —NotReady/UnsupportedCapabilitybefore READY,AlreadyClosedafter shutdown.- Node
flushmaps adapter flush exceptions to aNetwork(or existingFireweaveError) result. - Python flush swallows sink exceptions so telemetry loss cannot break callers.
- Empty
targetingKeyorflagKeyon Noderecord→InvalidContext. - Evaluate-path emission with an empty
targetingKeyis skipped (Node).
API
- Node
- Python
- Go
- Java
- Web
Related
- Control points — evaluate options
- Targeting —
targetingKeyjoin - Signals — different envelope (
type: "signal") - Lifecycle — flush-on-shutdown exceptions