Skip to content

Commit

Permalink
Transcode success rate metric fixes (#2684)
Browse files Browse the repository at this point in the history
* additonal monitoring to include these failure scenarios in success metric

* add todo

* Revert "add todo"

This reverts commit abd1334.

* pending changelog
  • Loading branch information
mjh1 committed Jan 13, 2023
1 parent 11af0a6 commit 5e96382
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Expand Up @@ -23,6 +23,7 @@

#### Broadcaster
- \#2709 Add logging for high keyframe interval, reduce log level for discovery loop
- \#2684 Fix transcode success rate metric

#### Orchestrator

Expand Down
3 changes: 3 additions & 0 deletions monitor/census.go
Expand Up @@ -48,6 +48,9 @@ const (
SegmentTranscodeErrorSaveData SegmentTranscodeError = "SaveData"
SegmentTranscodeErrorSessionEnded SegmentTranscodeError = "SessionEnded"
SegmentTranscodeErrorDuplicateSegment SegmentTranscodeError = "DuplicateSegment"
SegmentTranscodeErrorMaxAttempts SegmentTranscodeError = "MaxAttempts"
SegmentTranscodeErrorNonRetryable SegmentTranscodeError = "NonRetryable"
SegmentTranscodeErrorCtxCancelled SegmentTranscodeError = "CtxCancelled"

numberOfSegmentsToCalcAverage = 30
gweiConversionFactor = 1000000000
Expand Down
9 changes: 9 additions & 0 deletions server/broadcast.go
Expand Up @@ -923,11 +923,17 @@ func processSegment(ctx context.Context, cxn *rtmpConnection, seg *stream.HLSSeg
}
if isNonRetryableError(err) {
clog.Warningf(ctx, "Not retrying current segment due to non-retryable error err=%q", err)
if monitor.Enabled {
monitor.SegmentTranscodeFailed(ctx, monitor.SegmentTranscodeErrorNonRetryable, nonce, seg.SeqNo, err, true)
}
break
}
if ctxErr := ctx.Err(); ctxErr != nil {
err = ctxErr
clog.Warningf(ctx, "Not retrying current segment due to context cancellation err=%q", err)
if monitor.Enabled {
monitor.SegmentTranscodeFailed(ctx, monitor.SegmentTranscodeErrorCtxCancelled, nonce, seg.SeqNo, err, true)
}
break
}
// recoverable error, retry
Expand All @@ -950,6 +956,9 @@ func processSegment(ctx context.Context, cxn *rtmpConnection, seg *stream.HLSSeg
}
if len(attempts) == MaxAttempts && err != nil {
err = fmt.Errorf("Hit max transcode attempts: %w", err)
if monitor.Enabled {
monitor.SegmentTranscodeFailed(ctx, monitor.SegmentTranscodeErrorMaxAttempts, nonce, seg.SeqNo, err, true)
}
}
return urls, err
}
Expand Down

0 comments on commit 5e96382

Please sign in to comment.