-
Notifications
You must be signed in to change notification settings - Fork 0
Feature Toggle Types
This guide explains the different types of feature toggles available in the Flux Gate system and when to use each type.
The Flux Gate supports two main types of feature toggles: Simple Features and Contextual Features. Each type serves different use cases and provides different levels of control over feature rollout.
| Aspect | Simple Features | Contextual Features |
|---|---|---|
| Complexity | Basic on/off toggle | Advanced targeting system |
| Targeting | Binary enable/disable | Context-based user targeting |
| Rollout Control | All or nothing | Percentage-based gradual rollout |
| Configuration | Minimal setup | Detailed criteria configuration |
| Use Cases | Basic feature gating | A/B testing, gradual rollouts |
| Pipeline Support | Full pipeline support | Full pipeline support |
| Team Scope | Team-based | Team-based with context access |
Simple Features are basic on/off toggles that provide binary feature control without user targeting capabilities.
- Binary State: Features are either fully enabled or disabled
- No Targeting: All users see the same feature state
- Simple Configuration: Minimal setup required
- Fast Evaluation: Quick feature state evaluation
- Clear Semantics: Easy to understand and manage
- Kill Switches: Emergency feature disabling
- Maintenance Modes: Temporary feature disabling for maintenance
- Feature Releases: Complete feature enable/disable
- System Toggles: Infrastructure or system-level feature control
- Binary Decisions: Features that don't require user targeting
β
Good for Simple Features:
- Maintenance mode toggle
- New API endpoint enable/disable
- Debug logging on/off
- Feature complete replacement
- Emergency kill switch
β Not suitable for Simple Features:
- Gradual user rollout
- A/B testing
- User segment targeting
- Percentage-based rollout
- Context-dependent features
| Setting | Description |
|---|---|
| Feature Key | Unique identifier for the feature |
| Description | Purpose and details of the feature |
| Enabled Status | Current on/off state |
| Pipeline Stages | Deployment stages across environments |
Simple features use standard pipeline workflows:
Development β Staging β Production
β β β
Feature Feature Feature
Disabled Enabled Enabled
Each stage can have different enabled/disabled states.
- Create Feature: Set up simple feature with pipeline
- Stage Configuration: Configure enable/disable per stage
- Request Deployment: Request stage deployment through approval workflow
- Approval: Approvers review and approve deployment
- Activation: Feature becomes active in target environment
Stage 1 (Development): Enabled for testing
Stage 2 (Staging): Enabled for QA validation
Stage 3 (Production): Disabled until ready
Stage 4 (Production): Enabled for all users
Contextual Features provide sophisticated user targeting based on user attributes, device characteristics, and custom criteria.
- Context-Based Targeting: Target users based on attributes
- Percentage Rollout: Gradual rollout with percentage control
- Multiple Criteria: Combine different targeting criteria
- Complex Configuration: Detailed setup with context definitions
- Flexible Evaluation: Dynamic feature evaluation based on user context
- Gradual Rollouts: Slowly roll out features to increasing user percentages
- A/B Testing: Test different feature variants with different user groups
- User Segmentation: Target specific user segments or demographics
- Device Targeting: Target based on device type, OS, or browser
- Geographic Rollouts: Deploy features by geographic region
- Beta Programs: Limit features to beta users or specific user groups
β
Perfect for Contextual Features:
- Roll out to 25% of premium users
- A/B testing new checkout flow
- Mobile-only feature rollout
- Geographic rollout (US first, then Europe)
- Beta user exclusive access
β
Also good for:
- Canary deployments
- User tier-based features
- Performance-sensitive rollouts
- Risk-managed deployments
| Context Type | Examples | Use Cases |
|---|---|---|
| User Attributes | user_id, email_domain, subscription_tier | User-specific targeting |
| Device Properties | device_type, operating_system, browser | Device-based features |
| Geographic Data | country, region, timezone | Location-based rollouts |
| Custom Criteria | customer_segment, experiment_group | Business-specific targeting |
For each pipeline stage, you can configure multiple targeting criteria:
| Field | Description | Example |
|---|---|---|
| Context | The targeting context | "device_type" |
| Context Key | Specific value to match | "mobile" |
| Rollout Percentage | Percentage of matching users | 50% |
Each pipeline stage can have multiple targeting criteria:
Stage 1: Beta Testing
- Context: user_role
- Key: beta_tester
- Rollout: 100% (all beta testers)
Stage 2: Premium Rollout
- Context: subscription_tier
- Key: premium
- Rollout: 25% (25% of premium users)
Stage 3: Mobile Users
- Context: device_type
- Key: mobile
- Rollout: 50% (50% of mobile users)
Stage 4: General Availability
- Context: user_id
- Key: all_users
- Rollout: 100% (everyone)
You can configure multiple targeting criteria for a single stage:
Stage: Regional Premium Rollout
Criteria 1:
- Context: geographic_region
- Key: north_america
- Rollout: 75%
Criteria 2:
- Context: subscription_tier
- Key: premium
- Rollout: 50%
Result: Users matching BOTH criteria get feature
Use this matrix to choose the appropriate feature type:
| Question | Simple | Contextual |
|---|---|---|
| Do you need user targeting? | No | Yes |
| Do you need gradual rollout? | No | Yes |
| Is this for A/B testing? | No | Yes |
| Do you need percentage control? | No | Yes |
| Is this a kill switch? | Yes | No |
| Do you need context evaluation? | No | Yes |
| Is quick deployment important? | Yes | Depends |
Start: Need feature toggle?
β
Do you need user targeting or gradual rollout?
β β
No Yes
β β
Simple Feature Contextual Feature
β β
Binary on/off Context-based targeting
You can migrate simple features to contextual features:
- Edit Feature: Access feature editing interface
- Change Type: Update feature type to "CONTEXTUAL"
- Configure Contexts: Set up context-based targeting criteria
- Update Stages: Configure stage criteria for each pipeline stage
- Test Configuration: Validate targeting works as expected
- Deploy Changes: Update feature configuration
- Application Integration: Ensure your application can handle contextual evaluation
- Context Data: Verify context data is available in your application
- Testing: Thoroughly test feature evaluation with different contexts
- Rollback Plan: Have a plan to revert if issues occur
You can also simplify contextual features to simple features:
- Remove Criteria: Delete all context-based targeting criteria
- Change Type: Update feature type to "SIMPLE"
- Configure Stages: Set binary enable/disable for each stage
- Update Application: Remove context evaluation logic
- Deploy Changes: Update feature configuration
- Clear Purpose: Use for clear binary decisions
- Emergency Readiness: Ideal for kill switches
- Simple Naming: Use descriptive names for simple features
- Documentation: Document the binary behavior clearly
- Context Planning: Plan context types before implementation
- Gradual Rollout: Start with small percentages and increase gradually
- Monitoring: Monitor feature performance during rollout
- Fallback Strategy: Have fallback behavior when context unavailable
- Type Consistency: Use consistent feature types within related features
- Documentation: Document feature type rationale
- Team Training: Ensure team understands both feature types
- Regular Review: Periodically review feature type choices
// Simple feature evaluation
const isNewUIEnabled = featureToggle.isEnabled('new-ui-feature');
if (isNewUIEnabled) {
renderNewUI();
} else {
renderOldUI();
}// Contextual feature evaluation
const userContext = {
user_id: getCurrentUserId(),
device_type: getDeviceType(),
subscription_tier: getUserTier()
};
const isNewUIEnabled = featureToggle.isEnabledForContext(
'new-ui-feature',
userContext
);
if (isNewUIEnabled) {
renderNewUI();
} else {
renderOldUI();
}- β Fast evaluation (simple boolean check)
- β Low overhead
- β Cacheable results
- β Minimal network requests
β οΈ More complex evaluationβ οΈ Requires context dataβ οΈ More network requests- β Flexible targeting
- Feature Toggle Management - Creating and managing features
- Context Management - Setting up contexts for targeting
- Pipeline Management - Configuring deployment pipelines
- Stage Approval Workflow - Deployment approval process
Need help? Check the Troubleshooting guide or create an issue in the project repository.