service

package
v1.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotMergeGauges = errors.New("cannot merge gauge metrics with identical labels")

ErrCannotMergeGauges fires when two gauges share a family name and label set — gauges have no meaningful sum, so this is treated as an invariant violation. mergeFamilies keeps the first occurrence and returns the error.

Functions

This section is empty.

Types

type DebugService added in v1.8.4

type DebugService struct {
	// contains filtered or unexported fields
}

func NewDebugService added in v1.8.4

func NewDebugService(pm ProcessManager) *DebugService

func (*DebugService) GetGstPipelineDotFile added in v1.8.4

func (s *DebugService) GetGstPipelineDotFile(egressID string) (string, error)

func (*DebugService) StartDebugHandlers added in v1.8.4

func (s *DebugService) StartDebugHandlers(port int)

type HandlerRPCProxy added in v1.14.0

type HandlerRPCProxy struct {
	// contains filtered or unexported fields
}

HandlerRPCProxy hosts the per-egress EgressHandler psrpc topics in the service process and forwards requests to the handler subprocess over IPC, so handlers never connect to the message bus.

func NewHandlerRPCProxy added in v1.14.0

func NewHandlerRPCProxy(pm ProcessManager, bus psrpc.MessageBus) (*HandlerRPCProxy, error)

func (*HandlerRPCProxy) DeregisterEgress added in v1.14.0

func (p *HandlerRPCProxy) DeregisterEgress(egressID string)

func (*HandlerRPCProxy) Kill added in v1.14.0

func (p *HandlerRPCProxy) Kill()

func (*HandlerRPCProxy) RegisterEgress added in v1.14.0

func (p *HandlerRPCProxy) RegisterEgress(egressID string) error

RegisterEgress is invoked by the process manager during Launch, once the handler's IPC client exists, so incoming requests can always resolve a client. Calls made before the handler's IPC listener is up wait on the connection (bounded by the request deadline) instead of failing fast.

func (*HandlerRPCProxy) Shutdown added in v1.14.0

func (p *HandlerRPCProxy) Shutdown()

func (*HandlerRPCProxy) StopEgress added in v1.14.0

func (*HandlerRPCProxy) UpdateEgress added in v1.14.0

func (*HandlerRPCProxy) UpdateStream added in v1.14.0

type MetricsService added in v1.8.4

type MetricsService struct {
	// contains filtered or unexported fields
}

func NewMetricsService added in v1.8.4

func NewMetricsService(pm ProcessManager) *MetricsService

func (*MetricsService) CreateGatherer added in v1.8.4

func (s *MetricsService) CreateGatherer() prometheus.Gatherer

func (*MetricsService) MergeInAccumulator added in v1.14.0

func (s *MetricsService) MergeInAccumulator(egressID string)

MergeInAccumulator folds a finished handler's cached accumulatable tally into the accumulator and suppresses its live values.

func (*MetricsService) PromHandler added in v1.8.4

func (s *MetricsService) PromHandler() http.Handler

func (*MetricsService) StoreProcessEndedMetrics added in v1.8.4

func (s *MetricsService) StoreProcessEndedMetrics(egressID string, metrics string) error

type Process added in v1.7.8

type Process struct {
	// contains filtered or unexported fields
}

func (*Process) Gather added in v1.8.1

func (p *Process) Gather() ([]*dto.MetricFamily, error)

Gather implements prometheus.Gatherer, pulling live metrics from the handler over IPC. It returns empty once the handler's metrics are finalized so its values aren't counted both live and in the service accumulator.

type ProcessManager added in v1.5.3

type ProcessManager interface {
	Launch(ctx context.Context, handlerID string, req *rpc.StartEgressRequest, info *livekit.EgressInfo, cmd *exec.Cmd) error
	// SetHandlerTopicHooks installs callbacks used to advertise and remove the
	// per-egress handler RPC topics. Registration happens inside Launch, after
	// the handler's IPC client exists; deregistration happens in ProcessFinished.
	// The hooks are read without synchronization, so this must be called once
	// during server construction, before any handler is launched.
	SetHandlerTopicHooks(register func(egressID string) error, deregister func(egressID string))
	GetContext(egressID string) context.Context
	AlreadyExists(egressID string) bool
	HandlerStarted(egressID string) error
	GetActiveEgressIDs() []string
	GetStatus(info map[string]interface{})
	GetGatherers() []prometheus.Gatherer
	GetGRPCClient(egressID string) (ipc.EgressHandlerClient, error)
	KillAll()
	AbortProcess(egressID string, err error)
	StopProcess(egressID string, reason string)
	KillProcess(egressID string, reason string, err error)
	SetExitReason(egressID string, reason string)
	GetKillReason(egressID string) string
	ProcessFinished(egressID string)
	// StoreAccumulatableMetrics caches the accumulatable portion of a handler's metrics
	StoreAccumulatableMetrics(egressID string, metrics []*dto.MetricFamily)
	// FinalizeMetrics suppresses a handler's live values (Process.Gather returns
	// empty afterwards) and returns its cached accumulatable tally.
	FinalizeMetrics(egressID string) (metrics []*dto.MetricFamily, alreadyFinalized bool)
}

func NewProcessManager added in v1.5.3

func NewProcessManager() ProcessManager

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL