feat: Refactor Quality of Experience (QoE) aggregate metrics along with it's configuration#119
Merged
skatti97 merged 12 commits intostable-betafrom Mar 18, 2026
Merged
feat: Refactor Quality of Experience (QoE) aggregate metrics along with it's configuration#119skatti97 merged 12 commits intostable-betafrom
skatti97 merged 12 commits intostable-betafrom
Conversation
ametku
reviewed
Mar 16, 2026
|
|
||
| private final CrashSafeHarvestFactory factory; | ||
| private final CopyOnWriteArrayList<QoeProvider> qoeProviders = new CopyOnWriteArrayList<>(); | ||
| private int harvestCycleNumber = 0; |
Contributor
There was a problem hiding this comment.
should harvestCycleNumber be atomic int ?
Contributor
Author
There was a problem hiding this comment.
I am manually updating the value so it's fine
Contributor
There was a problem hiding this comment.
I didn't understand. could you eloborate?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a
QOE_AGGREGATEaction underVideoActionthat periodically reports Quality of Experience KPIs during video playback. QoE events are generated at harvest time and injected directly into the harvest batch, operating independently from the regular event buffer.KPIs Tracked
startupTimeCONTENT_REQUESTtoCONTENT_START, minus ad time and pause time, cached atCONTENT_STARTpeakBitratecontentBitrateduring the sessionaverageBitratecontentBitrateduring active playback only; non-play time (pause, buffer, seek) is excludedtotalPlaytimetotalRebufferingTimeCONTENT_BUFFER_ENDevents except initial buffers (bufferType == "initial")rebufferingRatio(totalRebufferingTime / totalPlaytime) * 100, recomputed at harvest with real-time totalPlaytimehadStartupFailuretrueif aCONTENT_ERRORoccurred beforeCONTENT_STARThadPlaybackFailuretrueif aCONTENT_ERRORoccurred afterCONTENT_STARTHow It Works
Architecture Overview:
CONTENT_REQUEST, the tracker registers a QoE provider with the harvest manager, ensuring QoE metrics (especiallyhadStartupFailure) are captured even ifCONTENT_STARTnever happensCONTENT_END, the final QoE event is built eagerly while tracker state is still valid and enqueued for the next harvest, avoiding race conditions and ensuring no data loss at session endKey Implementation Details:
QoE Provider Pattern - Introduced
QoeProviderinterface thatNRVideoTrackerimplements. Providers register withHarvestManagerand are invoked during harvest cycles.Startup Time Calculation - Calculated once at
CONTENT_STARTand cached for all subsequent QoE reports. Formula:startupTime = timeSinceRequested - adTime - pauseTime.Time-Weighted Bitrate - Maintains cumulative tracking:
Σ(bitrate × duration) / Σ(duration). Segments are captured on rendition changes and timer pause events.Snapshot-Based Dirty Check - Stores a copy of the last sent QoE KPIs. Before generating QoE, compares current KPIs to the snapshot. Only sends if values have changed.
Direct Injection - QoE events are injected directly into the harvest batch, bypassing the crash-safe event buffer, as they're computed on-demand.
Context Attributes - QoE events include all standard VideoAction attributes (content metadata, player info, session data) by reusing the existing
getAttributes()pipeline.Configuration
enableQoeAggregatefalseqoeAggregateIntervalMultiplier1Harvest Cycle Formula:
(harvestCycleNumber - 1) % intervalMultiplier == 0Examples:
multiplier=1: cycles 1, 2, 3, 4... (every harvest)multiplier=2: cycles 1, 3, 5, 7... (every other)multiplier=3: cycles 1, 4, 7, 10... (every third)Usage Example:
Breaking Changes
None. QoE is disabled by default (
enableQoeAggregate = false), so existing integrations are not affected.