diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index d161e43c70..3762c4aa00 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -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 diff --git a/monitor/census.go b/monitor/census.go index afebcf18d0..d6d0a7390b 100644 --- a/monitor/census.go +++ b/monitor/census.go @@ -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 diff --git a/server/broadcast.go b/server/broadcast.go index f3f976a578..6207a03f10 100755 --- a/server/broadcast.go +++ b/server/broadcast.go @@ -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 @@ -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 }