Apply a Flag
Timestamps
Each apply requires two timestamps using the client’s local clock:appliedTime: When the flag value was actually used in the applicationsentTime: When the client reports the apply to Confidence
- Network latency
- Batching delays
- Offline operation
Batch Requests
It’s recommended to batch apply operations:- Reduces network overhead
- Saves battery life on mobile devices
- More efficient for the service
Mobile and Offline Scenarios
For mobile apps and offline scenarios:- Queue applies locally while offline
- Send all queued applies when network is available
- Piggyback applies on other API calls
- Preserve the original
appliedTimeeven if sent later
Handle Errors
Apply operations should be fire-and-forget:- Log errors for debugging but don’t block application flow
- Don’t retry immediately to avoid overwhelming the service
- Consider queuing for later retry
- Applying is not critical to UX—the flag has already been resolved
Monitoring
Track apply metrics to ensure data quality:- Apply rate: How often flags are being applied
- Apply delay: Time between
appliedTimeandsentTime - Apply failures: How many applies are failing
- Missing applies: Flags that were resolved but never applied
Best Practices
- Apply only when the flag value is actually used
- Batch applies together when possible
- Use accurate timestamps (set
appliedTimewhen flag is actually used) - Handle failures gracefully without breaking application flow
- Queue applies when offline and send when connected
- Monitor apply rates to ensure experiment data is complete

