telemetry

package
v1.13.6 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 21 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)

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) 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

type ReferenceGuard added in v1.9.2

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

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) 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) SetConnected added in v1.3.3

func (s *StatsWorker) SetConnected()

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)

	// 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)
	// 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