Documentation
¶
Index ¶
- Constants
- func LogMediaStats(s *ipc.MediaStats, logger logger.Logger)
- type LocalMediaStatsGatherer
- type LocalStatsUpdater
- type MediaStatsReporter
- type MediaTrackStatGatherer
- func (g *MediaTrackStatGatherer) MediaReceived(size int64)
- func (g *MediaTrackStatGatherer) ObserveLatency(latency time.Duration)
- func (g *MediaTrackStatGatherer) PLI()
- func (g *MediaTrackStatGatherer) PacketLost(count int64)
- func (g *MediaTrackStatGatherer) Path() string
- func (g *MediaTrackStatGatherer) UpdateStats() *ipc.TrackStats
- type Monitor
- func (m *Monitor) AcceptIngress(info *livekit.IngressInfo) bool
- func (m *Monitor) CanAccept() bool
- func (m *Monitor) CanAcceptIngress(info *livekit.IngressInfo) bool
- func (m *Monitor) GetAvailableCPU() float64
- func (m *Monitor) HandlerExited(pid int, state *os.ProcessState)
- func (m *Monitor) HandlerStarted(info *livekit.IngressInfo, pid int)
- func (m *Monitor) HandlerStateUpdated(info *livekit.IngressInfo)
- func (m *Monitor) IngressEnded(info *livekit.IngressInfo)
- func (m *Monitor) IngressStarted(info *livekit.IngressInfo)
- func (m *Monitor) RecordPublicationResult(ingressType string, err error)
- func (m *Monitor) SessionEnded(resourceID string) *SessionUsage
- func (m *Monitor) Shutdown()
- func (m *Monitor) Start(conf *config.Config) error
- func (m *Monitor) Stop()
- func (m *Monitor) UpdateCostConfig(cpuCostConfig *config.CPUCostConfig) error
- type SessionUsage
Constants ¶
const ( InputAudio = "input.audio" InputVideo = "input.video" OutputAudio = "output.audio" OutputVideo = "output.video" )
Variables ¶
This section is empty.
Functions ¶
func LogMediaStats ¶ added in v1.3.0
func LogMediaStats(s *ipc.MediaStats, logger logger.Logger)
Types ¶
type LocalMediaStatsGatherer ¶ added in v1.3.0
type LocalMediaStatsGatherer struct {
// contains filtered or unexported fields
}
func NewLocalMediaStatsGatherer ¶ added in v1.3.0
func NewLocalMediaStatsGatherer() *LocalMediaStatsGatherer
func (*LocalMediaStatsGatherer) GatherStats ¶ added in v1.3.0
func (l *LocalMediaStatsGatherer) GatherStats(_ context.Context) (*ipc.MediaStats, error)
func (*LocalMediaStatsGatherer) RegisterTrackStats ¶ added in v1.3.0
func (l *LocalMediaStatsGatherer) RegisterTrackStats(path string) *MediaTrackStatGatherer
type LocalStatsUpdater ¶ added in v1.3.0
func (*LocalStatsUpdater) UpdateMediaStats ¶ added in v1.3.0
func (a *LocalStatsUpdater) UpdateMediaStats(_ context.Context, s *ipc.MediaStats) error
type MediaStatsReporter ¶ added in v1.1.0
type MediaStatsReporter struct {
// contains filtered or unexported fields
}
func NewMediaStats ¶ added in v1.1.0
func NewMediaStats(statsUpdater types.MediaStatsUpdater, ingressType string) *MediaStatsReporter
func (*MediaStatsReporter) Close ¶ added in v1.1.0
func (m *MediaStatsReporter) Close()
func (*MediaStatsReporter) RegisterGatherer ¶ added in v1.3.0
func (m *MediaStatsReporter) RegisterGatherer(g types.MediaStatGatherer)
func (*MediaStatsReporter) UpdateStats ¶ added in v1.3.0
func (m *MediaStatsReporter) UpdateStats(ctx context.Context)
type MediaTrackStatGatherer ¶ added in v1.3.0
type MediaTrackStatGatherer struct {
// contains filtered or unexported fields
}
func NewMediaTrackStatGatherer ¶ added in v1.3.0
func NewMediaTrackStatGatherer(path string) *MediaTrackStatGatherer
func (*MediaTrackStatGatherer) MediaReceived ¶ added in v1.3.0
func (g *MediaTrackStatGatherer) MediaReceived(size int64)
func (*MediaTrackStatGatherer) ObserveLatency ¶ added in v1.5.0
func (g *MediaTrackStatGatherer) ObserveLatency(latency time.Duration)
func (*MediaTrackStatGatherer) PLI ¶ added in v1.4.0
func (g *MediaTrackStatGatherer) PLI()
func (*MediaTrackStatGatherer) PacketLost ¶ added in v1.3.0
func (g *MediaTrackStatGatherer) PacketLost(count int64)
func (*MediaTrackStatGatherer) Path ¶ added in v1.3.0
func (g *MediaTrackStatGatherer) Path() string
func (*MediaTrackStatGatherer) UpdateStats ¶ added in v1.3.0
func (g *MediaTrackStatGatherer) UpdateStats() *ipc.TrackStats
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
func NewMonitor ¶
func NewMonitor() *Monitor
func (*Monitor) AcceptIngress ¶
func (m *Monitor) AcceptIngress(info *livekit.IngressInfo) bool
func (*Monitor) CanAcceptIngress ¶
func (m *Monitor) CanAcceptIngress(info *livekit.IngressInfo) bool
func (*Monitor) GetAvailableCPU ¶ added in v1.5.0
func (*Monitor) HandlerExited ¶ added in v1.6.0
func (m *Monitor) HandlerExited(pid int, state *os.ProcessState)
HandlerExited adds the run of the exited handler pid to its session's usage.
func (*Monitor) HandlerStarted ¶ added in v1.6.0
func (m *Monitor) HandlerStarted(info *livekit.IngressInfo, pid int)
HandlerStarted attributes the handler process pid to the session in info.
func (*Monitor) HandlerStateUpdated ¶ added in v1.6.0
func (m *Monitor) HandlerStateUpdated(info *livekit.IngressInfo)
HandlerStateUpdated records the input track mime types from a state update the handler sent for the session in info. An update for a session without a usage record is ignored: the record exists from HandlerStarted until SessionEnded, and a late update must not recreate it.
func (*Monitor) IngressEnded ¶
func (m *Monitor) IngressEnded(info *livekit.IngressInfo)
func (*Monitor) IngressStarted ¶
func (m *Monitor) IngressStarted(info *livekit.IngressInfo)
func (*Monitor) RecordPublicationResult ¶ added in v1.6.0
RecordPublicationResult records the outcome of a stream publication attempt, bucketing it as success/4xx/5xx/internal. It is a no-op if the monitor has not been started (e.g. in standalone test binaries).
func (*Monitor) SessionEnded ¶ added in v1.6.0
func (m *Monitor) SessionEnded(resourceID string) *SessionUsage
SessionEnded returns the session's handler usage, or nil if no handler ran for it.
func (*Monitor) Shutdown ¶ added in v1.1.0
func (m *Monitor) Shutdown()
Shutdown - server is shutting down, but may stay up for some time for draining
func (*Monitor) UpdateCostConfig ¶ added in v1.2.2
func (m *Monitor) UpdateCostConfig(cpuCostConfig *config.CPUCostConfig) error
type SessionUsage ¶ added in v1.6.0
type SessionUsage struct {
IngressID string
ResourceID string
InputType livekit.IngressInput
Transcoding bool
// Mime types of the input tracks the handler reported, empty until the
// source has been parsed. A session that ends before then leaves both
// empty, which is distinct from an audio-only source.
AudioMimeType string
VideoMimeType string
CPUTime time.Duration // user + system time, from the exited handlers' rusage
Duration time.Duration // wall time the handlers ran
MaxCPU float64 // highest 1s sample, in cores
MaxMemory int // highest sampled RSS, in bytes
}
SessionUsage is the resource usage of all handler processes run for one session.
func (*SessionUsage) AvgCPU ¶ added in v1.6.0
func (u *SessionUsage) AvgCPU() float64
AvgCPU is the average number of cores used while a handler ran.
func (*SessionUsage) MediaLabel ¶ added in v1.6.0
func (u *SessionUsage) MediaLabel() string
MediaLabel is the media the source carried as a metric label: audio, video, av, or unknown while no track has been reported.
func (*SessionUsage) TypeLabel ¶ added in v1.6.0
func (u *SessionUsage) TypeLabel() string
TypeLabel is the session's input kind as a metric label: rtmp, whip, url, or unknown. WHIP sessions that bypass transcoding run in the service process without a handler, so they have no usage record and are never observed; whip therefore only covers transcoding sessions.