telemetry

package
v1.13.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyticsService added in v0.15.0

type AnalyticsService interface {
	SendStats(ctx context.Context, stats []*livekit.AnalyticsStat)
	SendEvent(ctx context.Context, events *livekit.AnalyticsEvent)
	SendNodeRoomStates(ctx context.Context, nodeRooms *livekit.AnalyticsNodeRooms)
	RoomProjectReporter(ctx context.Context) roomobs.ProjectReporter
}

func NewAnalyticsService added in v0.15.0

func NewAnalyticsService(_ *config.Config, currentNode routing.LocalNode) AnalyticsService

type CondensedStat added in v1.9.1

type CondensedStat struct {
	StartTime   time.Time
	EndTime     time.Time
	Bytes       uint64
	Packets     uint32
	PacketsLost uint32
	Frames      uint32
}

func CondenseStat added in v1.9.1

func CondenseStat(stat *livekit.AnalyticsStat) (ps CondensedStat, ok bool)

type Conn added in v1.2.1

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewConn added in v1.2.1

func NewConn(c net.Conn, direction prometheus.Direction) *Conn

func (*Conn) Close added in v1.2.1

func (c *Conn) Close() error

func (*Conn) Read added in v1.2.1

func (c *Conn) Read(b []byte) (n int, err error)

func (*Conn) Write added in v1.2.1

func (c *Conn) Write(b []byte) (n int, err error)

type Listener added in v1.2.1

type Listener struct {
	net.Listener
}

func NewListener added in v1.2.1

func NewListener(l net.Listener) *Listener

func (*Listener) Accept added in v1.2.1

func (l *Listener) Accept() (net.Conn, error)

type NullAnalyticService added in v1.9.10

type NullAnalyticService struct{}

func (NullAnalyticService) RoomProjectReporter added in v1.9.10

func (n NullAnalyticService) RoomProjectReporter(_ctx context.Context) roomobs.ProjectReporter

func (NullAnalyticService) SendEvent added in v1.9.10

func (NullAnalyticService) SendNodeRoomStates added in v1.9.10

func (n NullAnalyticService) SendNodeRoomStates(_ context.Context, _ *livekit.AnalyticsNodeRooms)

func (NullAnalyticService) SendStats added in v1.9.10

type NullTelemetryService added in v1.9.10

type NullTelemetryService struct {
	NullAnalyticService
}

func (NullTelemetryService) APICall added in v1.9.10

func (n NullTelemetryService) APICall(ctx context.Context, apiCallInfo *livekit.APICallInfo)

func (NullTelemetryService) EgressEnded added in v1.9.10

func (n NullTelemetryService) EgressEnded(ctx context.Context, info *livekit.EgressInfo)

func (NullTelemetryService) EgressStarted added in v1.9.10

func (n NullTelemetryService) EgressStarted(ctx context.Context, info *livekit.EgressInfo)

func (NullTelemetryService) EgressUpdated added in v1.9.10

func (n NullTelemetryService) EgressUpdated(ctx context.Context, info *livekit.EgressInfo)

func (NullTelemetryService) FlushStats added in v1.9.10

func (n NullTelemetryService) FlushStats()

func (NullTelemetryService) IngressCreated added in v1.9.10

func (n NullTelemetryService) IngressCreated(ctx context.Context, info *livekit.IngressInfo)

func (NullTelemetryService) IngressDeleted added in v1.9.10

func (n NullTelemetryService) IngressDeleted(ctx context.Context, info *livekit.IngressInfo)

func (NullTelemetryService) IngressEnded added in v1.9.10

func (n NullTelemetryService) IngressEnded(ctx context.Context, info *livekit.IngressInfo)

func (NullTelemetryService) IngressStarted added in v1.9.10

func (n NullTelemetryService) IngressStarted(ctx context.Context, info *livekit.IngressInfo)

func (NullTelemetryService) IngressUpdated added in v1.9.10

func (n NullTelemetryService) IngressUpdated(ctx context.Context, info *livekit.IngressInfo)

func (NullTelemetryService) LocalRoomState added in v1.9.10

func (n NullTelemetryService) LocalRoomState(ctx context.Context, info *livekit.AnalyticsNodeRooms)

func (NullTelemetryService) NotifyEgressEvent added in v1.9.10

func (n NullTelemetryService) NotifyEgressEvent(ctx context.Context, event string, info *livekit.EgressInfo)

func (NullTelemetryService) ParticipantActive added in v1.9.10

func (n NullTelemetryService) ParticipantActive(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, clientMeta *livekit.AnalyticsClientMeta, isMigration bool, isWarp bool, guard *ReferenceGuard)

func (NullTelemetryService) ParticipantJoined added in v1.9.10

func (n NullTelemetryService) ParticipantJoined(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, clientInfo *livekit.ClientInfo, clientMeta *livekit.AnalyticsClientMeta, shouldSendEvent bool, guard *ReferenceGuard)

func (NullTelemetryService) ParticipantLeft added in v1.9.10

func (n NullTelemetryService) ParticipantLeft(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, shouldSendEvent bool, guard *ReferenceGuard)

func (NullTelemetryService) ParticipantResumed added in v1.9.10

func (n NullTelemetryService) ParticipantResumed(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, nodeID livekit.NodeID, reason livekit.ReconnectReason)

func (NullTelemetryService) Report added in v1.9.10

func (n NullTelemetryService) Report(ctx context.Context, reportInfo *livekit.ReportInfo)

func (NullTelemetryService) RoomEnded added in v1.9.10

func (n NullTelemetryService) RoomEnded(ctx context.Context, room *livekit.Room, reason livekit.RoomEndReason)

func (NullTelemetryService) RoomIDChanged added in v1.13.7

func (n NullTelemetryService) RoomIDChanged(ctx context.Context, prevRoomID livekit.RoomID, room *livekit.Room)

func (NullTelemetryService) RoomStarted added in v1.9.10

func (n NullTelemetryService) RoomStarted(ctx context.Context, room *livekit.Room)

func (NullTelemetryService) TrackMaxSubscribedVideoQuality added in v1.9.10

func (n NullTelemetryService) TrackMaxSubscribedVideoQuality(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo, mime mime.MimeType, maxQuality livekit.VideoQuality)

func (NullTelemetryService) TrackMuted added in v1.9.10

func (n NullTelemetryService) TrackMuted(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo)

func (NullTelemetryService) TrackPublishRTPStats added in v1.9.10

func (n NullTelemetryService) TrackPublishRTPStats(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, layer int, stats *livekit.RTPStats)

func (NullTelemetryService) TrackPublishRequested added in v1.9.10

func (n NullTelemetryService) TrackPublishRequested(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo, shouldSendEvent bool)

func (NullTelemetryService) TrackPublished added in v1.9.10

func (n NullTelemetryService) TrackPublished(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo, shouldSendEvent bool)

func (NullTelemetryService) TrackPublishedUpdate added in v1.9.10

func (n NullTelemetryService) TrackPublishedUpdate(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo)

func (NullTelemetryService) TrackStats added in v1.9.10

func (n NullTelemetryService) TrackStats(roomID livekit.RoomID, roomName livekit.RoomName, key StatsKey, stat *livekit.AnalyticsStat)

func (NullTelemetryService) TrackSubscribeFailed added in v1.9.10

func (n NullTelemetryService) TrackSubscribeFailed(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, trackID livekit.TrackID, err error, isUserError bool)

func (NullTelemetryService) TrackSubscribeRTPStats added in v1.9.10

func (n NullTelemetryService) TrackSubscribeRTPStats(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, stats *livekit.RTPStats)

func (NullTelemetryService) TrackSubscribeRequested added in v1.9.10

func (n NullTelemetryService) TrackSubscribeRequested(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo)

func (NullTelemetryService) TrackSubscribed added in v1.9.10

func (n NullTelemetryService) TrackSubscribed(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo, publisher *livekit.ParticipantInfo, shouldSendEvent bool)

func (NullTelemetryService) TrackUnmuted added in v1.9.10

func (n NullTelemetryService) TrackUnmuted(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo)

func (NullTelemetryService) TrackUnpublished added in v1.9.10

func (n NullTelemetryService) TrackUnpublished(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo, wasPublishedLocally bool, shouldSendEvent bool)

func (NullTelemetryService) TrackUnsubscribed added in v1.9.10

func (n NullTelemetryService) TrackUnsubscribed(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo, shouldSendEvent bool)

func (NullTelemetryService) Webhook added in v1.9.10

func (n NullTelemetryService) Webhook(ctx context.Context, webhookInfo *livekit.WebhookInfo)

type PacketConn added in v1.2.1

type PacketConn struct {
	net.PacketConn
	// contains filtered or unexported fields
}

func NewPacketConn added in v1.2.1

func NewPacketConn(c net.PacketConn, direction prometheus.Direction) *PacketConn

func (*PacketConn) Close added in v1.2.1

func (c *PacketConn) Close() error

func (*PacketConn) ReadFrom added in v1.2.1

func (c *PacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*PacketConn) WriteTo added in v1.2.1

func (c *PacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

type ReferenceCount added in v1.9.2

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

func (*ReferenceCount) Absorb added in v1.13.7

func (s *ReferenceCount) Absorb(count int)

Absorb takes on references handed over from elsewhere.

func (*ReferenceCount) Activate added in v1.9.2

func (s *ReferenceCount) Activate(guard *ReferenceGuard)

func (ReferenceCount) MarshalLogObject added in v1.9.12

func (s ReferenceCount) MarshalLogObject(e zapcore.ObjectEncoder) error

func (*ReferenceCount) Release added in v1.9.2

func (s *ReferenceCount) Release(guard *ReferenceGuard) bool

func (*ReferenceCount) Take added in v1.13.7

func (s *ReferenceCount) Take() int

Take hands over every reference held, leaving none behind.

type ReferenceGuard added in v1.9.2

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

func (*ReferenceGuard) MarshalLogObject added in v1.13.7

func (r *ReferenceGuard) MarshalLogObject(e zapcore.ObjectEncoder) error

type RelayAddressGenerator added in v1.2.1

type RelayAddressGenerator struct {
	turn.RelayAddressGenerator
}

func NewRelayAddressGenerator added in v1.2.1

func NewRelayAddressGenerator(g turn.RelayAddressGenerator) *RelayAddressGenerator

func (*RelayAddressGenerator) AllocateConn added in v1.2.1

func (*RelayAddressGenerator) AllocateListener added in v1.12.0

func (*RelayAddressGenerator) AllocatePacketConn added in v1.2.1

type StatsKey added in v1.3.4

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

func StatsKeyForData added in v1.3.4

func StatsKeyForData(
	country string,
	streamType livekit.StreamType,
	participantID livekit.ParticipantID,
	trackID livekit.TrackID,
) StatsKey

func StatsKeyForTrack added in v1.3.4

func StatsKeyForTrack(
	country string,
	streamType livekit.StreamType,
	participantID livekit.ParticipantID,
	trackID livekit.TrackID,
	trackSource livekit.TrackSource,
	trackType livekit.TrackType,
) StatsKey

type StatsWorker

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

StatsWorker handles participant stats

func (*StatsWorker) Close

func (s *StatsWorker) Close(guard *ReferenceGuard) bool

func (*StatsWorker) Closed added in v1.7.1

func (s *StatsWorker) Closed(guard *ReferenceGuard) bool

func (*StatsWorker) Flush added in v1.2.2

func (s *StatsWorker) Flush(now time.Time, closeWait time.Duration) bool

func (*StatsWorker) ForceClose added in v1.13.7

func (s *StatsWorker) ForceClose(successor *StatsWorker) bool

ForceClose closes the worker irrespective of outstanding references. Used when a worker can no longer be reached through the worker map, so that it drains and is reaped instead of lingering in the flush list forever.

Its references are handed over to `successor`, the worker that can be reached in its place, so that whoever holds one still has a live worker to close. A ReferenceGuard records that it activated some worker, not which one, so leaving them behind would strand the successor with references it can never see released.

func (*StatsWorker) IsConnected added in v1.3.3

func (s *StatsWorker) IsConnected() bool

func (*StatsWorker) MarshalLogObject added in v1.9.12

func (s *StatsWorker) MarshalLogObject(e zapcore.ObjectEncoder) error

func (*StatsWorker) OnTrackStat added in v0.15.3

func (s *StatsWorker) OnTrackStat(trackID livekit.TrackID, direction livekit.StreamType, stat *livekit.AnalyticsStat)

func (*StatsWorker) ParticipantID added in v1.2.0

func (s *StatsWorker) ParticipantID() livekit.ParticipantID

func (*StatsWorker) RoomID added in v1.13.7

func (s *StatsWorker) RoomID() livekit.RoomID

func (*StatsWorker) SetConnected added in v1.3.3

func (s *StatsWorker) SetConnected()

func (*StatsWorker) SetRoom added in v1.13.7

func (s *StatsWorker) SetRoom(roomID livekit.RoomID, roomName livekit.RoomName)

SetRoom re-points the worker at a room.

Stats collected so far are sealed off rather than re-stamped - a room id changes because the previous session ended, so what was collected under it belongs to it. Sealing keeps the re-key free of any sending, the sealed stats go out on the next flush like every other stat.

type TelemetryService

type TelemetryService interface {
	// TrackStats is called periodically for each track in both directions (published/subscribed)
	TrackStats(roomID livekit.RoomID, roomName livekit.RoomName, key StatsKey, stat *livekit.AnalyticsStat)

	// events
	RoomStarted(ctx context.Context, room *livekit.Room)
	RoomEnded(ctx context.Context, room *livekit.Room, reason livekit.RoomEndReason)

	// ParticipantJoined - a participant establishes signal connection to a room
	ParticipantJoined(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, clientInfo *livekit.ClientInfo, clientMeta *livekit.AnalyticsClientMeta, shouldSendEvent bool, guard *ReferenceGuard)
	// ParticipantActive - a participant establishes media connection
	ParticipantActive(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, clientMeta *livekit.AnalyticsClientMeta, isMigration bool, isWarp bool, guard *ReferenceGuard)
	// ParticipantResumed - there has been an ICE restart or connection resume attempt, and we've received their signal connection
	ParticipantResumed(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, nodeID livekit.NodeID, reason livekit.ReconnectReason)
	// ParticipantLeft - the participant leaves the room, only sent if ParticipantActive has been called before
	ParticipantLeft(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, shouldSendEvent bool, guard *ReferenceGuard)
	// RoomIDChanged - the room kept its session, but got a different id (a provisional room id
	// replaced by the resolved one), re-keys the stats workers of every participant in the room
	RoomIDChanged(ctx context.Context, prevRoomID livekit.RoomID, room *livekit.Room)
	// TrackPublishRequested - a publication attempt has been received
	TrackPublishRequested(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo, shouldSendEvent bool)
	// TrackPublished - a publication attempt has been successful
	TrackPublished(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo, shouldSendEvent bool)
	// TrackUnpublished - a participant unpublished a track
	TrackUnpublished(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo, wasPublishedLocally bool, shouldSendEvent bool)
	// TrackSubscribeRequested - a participant requested to subscribe to a track
	TrackSubscribeRequested(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo)
	// TrackSubscribed - a participant subscribed to a track successfully
	TrackSubscribed(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo, publisher *livekit.ParticipantInfo, shouldSendEvent bool)
	// TrackUnsubscribed - a participant unsubscribed from a track successfully
	TrackUnsubscribed(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo, shouldSendEvent bool)
	// TrackSubscribeFailed - failure to subscribe to a track
	TrackSubscribeFailed(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, trackID livekit.TrackID, err error, isUserError bool)
	// TrackMuted - the publisher has muted the Track
	TrackMuted(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo)
	// TrackUnmuted - the publisher has muted the Track
	TrackUnmuted(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo)
	// TrackPublishedUpdate - track metadata has been updated
	TrackPublishedUpdate(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo)
	// TrackMaxSubscribedVideoQuality - publisher is notified of the max quality subscribers desire
	TrackMaxSubscribedVideoQuality(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo, mime mime.MimeType, maxQuality livekit.VideoQuality)
	TrackPublishRTPStats(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, layer int, stats *livekit.RTPStats)
	TrackSubscribeRTPStats(ctx context.Context, room *livekit.Room, participantID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, stats *livekit.RTPStats)

	EgressStarted(ctx context.Context, info *livekit.EgressInfo)
	EgressUpdated(ctx context.Context, info *livekit.EgressInfo)
	EgressEnded(ctx context.Context, info *livekit.EgressInfo)

	IngressCreated(ctx context.Context, info *livekit.IngressInfo)
	IngressDeleted(ctx context.Context, info *livekit.IngressInfo)
	IngressStarted(ctx context.Context, info *livekit.IngressInfo)
	IngressUpdated(ctx context.Context, info *livekit.IngressInfo)
	IngressEnded(ctx context.Context, info *livekit.IngressInfo)

	LocalRoomState(ctx context.Context, info *livekit.AnalyticsNodeRooms)

	Report(ctx context.Context, reportInfo *livekit.ReportInfo)

	APICall(ctx context.Context, apiCallInfo *livekit.APICallInfo)

	Webhook(ctx context.Context, webhookInfo *livekit.WebhookInfo)

	// helpers
	AnalyticsService
	NotifyEgressEvent(ctx context.Context, event string, info *livekit.EgressInfo)
	FlushStats()
}

func NewTelemetryService

func NewTelemetryService(notifier webhook.QueuedNotifier, analytics AnalyticsService) TelemetryService

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