Skip to content

Commit

Permalink
[ENG-2343] Stream attempts metric (AI Gateway side)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwilczynskiclearcode committed Jan 13, 2025
1 parent 4d09ba7 commit 06eba68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions server/ai_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ func aiHttpHandle[I any](h *lphttp, decoderFunc func(*I, *http.Request) error) h

func (h *lphttp) StartLiveVideoToVideo() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if monitor.Enabled {
monitor.AILiveVideoAttempt()
}

remoteAddr := getRemoteAddr(r)
ctx := clog.AddVal(r.Context(), clog.ClientIP, remoteAddr)
requestID := string(core.RandomManifestID())
Expand Down
7 changes: 7 additions & 0 deletions server/ai_mediaserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func (ls *LivepeerServer) StartLiveVideo() http.Handler {
return
}
}

mediaMTXClient := media.NewMediaMTXClient(remoteHost, ls.mediaMTXApiPassword, sourceID, sourceType)

if LiveAIAuthWebhookURL != nil {
Expand Down Expand Up @@ -488,6 +489,12 @@ func (ls *LivepeerServer) StartLiveVideo() http.Handler {
ctx = clog.AddVal(ctx, "stream_id", streamID)
clog.Infof(ctx, "Received live video AI request for %s. pipelineParams=%v", streamName, pipelineParams)

// Count `ai_live_attempts` after successful parameters validation
clog.V(common.VERBOSE).Infof(ctx, "AI Live video attempt")
if monitor.Enabled {
monitor.AILiveVideoAttempt()
}

Check warning on line 496 in server/ai_mediaserver.go

View check run for this annotation

Codecov / codecov/patch

server/ai_mediaserver.go#L492-L496

Added lines #L492 - L496 were not covered by tests

// Kick off the RTMP pull and segmentation as soon as possible
ssr := media.NewSwitchableSegmentReader()
go func() {
Expand Down

0 comments on commit 06eba68

Please sign in to comment.