Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transcode success rate metric fixes #2684

Merged
merged 5 commits into from Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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