Superposition OpenFeature Providers
OpenFeature provider implementations for Superposition, enabling feature flag management, context-aware configuration, and experimentation in multiple programming languages.
Featuresโ
- ๐ฉ Feature Flag Management โ Full OpenFeature compatibility for boolean, string, integer, float, and object flags
- ๐ฏ Context-Aware Configuration โ Dynamic configuration based on user context and dimensions
- โก Multiple Refresh Strategies โ Polling and on-demand configuration fetching
- ๐ Real-time Updates โ Automatic configuration refresh with configurable polling
- ๐ก๏ธ Error Handling โ Graceful fallbacks and stale data usage on errors
- ๐งช Experimentation โ Built-in support for A/B testing and feature experiments
- ๐ Pluggable Data Sources โ HTTP server, local files, or custom data sources
Supported Languagesโ
Prerequisitesโ
Before using any provider, ensure that:
- Superposition server is running โ See Quick Start
- Valid credentials are configured โ
token,org_id,workspace_id - Feature flags / default configs are set up in your Superposition workspace
Common Conceptsโ
Provider Architectureโ
All providers offer two approaches to flag evaluation:
| Variant | Description | When to Use |
|---|---|---|
LocalResolutionProvider | Fetches config from a data source (HTTP server or local file), caches locally, and evaluates flags in-process. Recommended for most use cases. | Production applications โ low latency, supports offline fallback, supports all refresh strategies |
SuperpositionAPIProvider | A stateless remote provider that calls the Superposition server on every evaluation. No local caching. | Serverless, low-traffic, or always-latest requirements |
The LocalResolutionProvider uses pluggable data sources (e.g. HttpDataSource, FileDataSource) and supports an optional fallback data source for resilient initialization.
Evaluation Contextโ
All providers use an evaluation context โ a set of key-value pairs (dimensions) used to resolve the correct configuration:
targeting_keyโ Used for experiment variant bucketing (typically a user ID)- Custom attributes โ Map to your Superposition dimensions (e.g.
city,os,customers)
Refresh Strategiesโ
Providers support multiple refresh strategies for keeping configuration up to date:
| Strategy | Description | Availability |
|---|---|---|
| Polling | Periodically fetches config updates at a fixed interval | All languages |
| On-Demand | Fetches on first access, then caches with a configurable TTL | All languages |
| Watch | Uses file-system notifications to reload on file changes | Rust only |
| Manual | No automatic refresh; user triggers refresh explicitly | Rust only |
Experimentationโ
When experimentation options are configured, the provider will:
- Fetch running experiments from the server
- Use the
targeting_keyto determine which variant a user belongs to - Apply experiment overrides to the resolved configuration
All providers support configurable ExperimentationOptions including refresh strategy, evaluation cache, and a default toss value.