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

Add end reason to egress info #753

Merged
merged 1 commit into from
Aug 8, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions pkg/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ func (h *Handler) Run() {
}

func (h *Handler) Kill() {
// kill signal received
h.conf.Info.Details = "service terminated by deployment"

<-h.initialized.Watch()
h.controller.SendEOS(context.Background())
h.controller.SendEOS(context.Background(), "handler killed")
}
2 changes: 1 addition & 1 deletion pkg/handler/handler_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ func (h *Handler) StopEgress(ctx context.Context, _ *livekit.StopEgressRequest)
return nil, errors.ErrEgressNotFound
}

h.controller.SendEOS(ctx)
h.controller.SendEOS(ctx, "StopEgress API")
return (*livekit.EgressInfo)(h.controller.Info), nil
}
10 changes: 6 additions & 4 deletions pkg/pipeline/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package pipeline

import (
"context"
"fmt"
"sync"
"time"

Expand Down Expand Up @@ -205,7 +206,7 @@ func (c *Controller) Run(ctx context.Context) *info.EgressInfo {
// close when room ends
go func() {
<-c.src.EndRecording()
c.SendEOS(ctx)
c.SendEOS(ctx, "source closed")
}()

// wait until room is ready
Expand Down Expand Up @@ -373,7 +374,7 @@ func (c *Controller) removeSink(ctx context.Context, url string, streamErr error
if streamErr != nil {
return streamErr
} else {
c.SendEOS(ctx)
c.SendEOS(ctx, "all streams removed")
return nil
}
}
Expand All @@ -387,7 +388,7 @@ func (c *Controller) removeSink(ctx context.Context, url string, streamErr error
return c.streamBin.RemoveStream(url)
}

func (c *Controller) SendEOS(ctx context.Context) {
func (c *Controller) SendEOS(ctx context.Context, reason string) {
ctx, span := tracer.Start(ctx, "Pipeline.SendEOS")
defer span.End()

Expand All @@ -396,6 +397,7 @@ func (c *Controller) SendEOS(ctx context.Context) {
c.limitTimer.Stop()
}

c.Info.Details = fmt.Sprintf("end reason: %s", reason)
switch c.Info.Status {
case livekit.EgressStatus_EGRESS_STARTING:
c.Info.SetAborted(info.MsgStoppedBeforeStarted)
Expand Down Expand Up @@ -507,7 +509,7 @@ func (c *Controller) startSessionLimitTimer(ctx context.Context) {
c.Info.SetLimitReached()
}
if c.playing.IsBroken() {
c.SendEOS(ctx)
c.SendEOS(ctx, "time limit reached")
} else {
c.p.Stop()
}
Expand Down
7 changes: 0 additions & 7 deletions pkg/pipeline/source/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,6 @@ func (s *WebSource) launchChrome(ctx context.Context, p *config.PipelineConfig,

case *runtime.EventExceptionThrown:
logChrome("exception", ev)
if s.info.Details == "" {
if exceptionDetails := ev.ExceptionDetails; exceptionDetails != nil {
if exception := exceptionDetails.Exception; exception != nil {
s.info.Details = fmt.Sprintf("Uncaught chrome exception: %s", exception.Description)
}
}
}
}
})

Expand Down
Loading