appstats

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Requests = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "in_requests",
		Help:      "Number received by the recorder",
	},
		[]string{
			"method",
		})

	InvalidRequests = prometheus.NewCounter(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "invalid_requests",
		Help:      "Number of invalid requests",
	})

	Responses = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "out_responses",
		Help:      "Number of responses from the recorder",
	},
		[]string{
			"method",
		})

	Sessions = prometheus.NewGauge(prometheus.GaugeOpts{
		Subsystem: "recorder",
		Name:      "sessions",
		Help:      "Current number of recorder sessions",
	})

	// TODO implement ActiveTracks tracking (session storage)
	ActiveTracks = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Subsystem: "recorder",
		Name:      "active_tracks",
		Help:      "Number of active tracks by type",
	},
		[]string{
			"kind",
			"mime",
			"source",
		})

	PLIRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "pli_requests_total",
		Help:      "Total number of PLI (Picture Loss Indication) requests sent",
	},
		[]string{
			"source",
			"mime",
		})

	PacketLossBuffer = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Subsystem: "recorder",
		Name:      "packet_loss_buffer_percentage",
		Help:      "Packet loss percentage (buffer)",
		Buckets:   []float64{0, 0.1, 0.3, 0.5, 0.7, 1, 5, 10, 40, 100},
	},
		[]string{
			"source",
			"kind",
			"mime",
		})

	SampleDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Subsystem: "recorder",
		Name:      "sample_duration_ms",
		Help:      "Sample duration in milliseconds",
		Buckets:   []float64{10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240},
	},
		[]string{
			"source",
			"kind",
			"mime",
		})

	FrameSize = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Subsystem: "recorder",
		Name:      "frame_size_bytes",
		Help:      "Frame size in bytes",
		Buckets:   prometheus.ExponentialBuckets(1024, 2, 10),
	},
		[]string{
			"source",
			"kind",
			"mime",
		})

	RTPDiscontinuities = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "rtp_discontinuities_total",
		Help:      "Total number of RTP sequence number discontinuities",
	},
		[]string{
			"source",
			"kind",
			"mime",
		})

	VP8PictureIDDiscontinuities = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "vp8_picture_id_discontinuities_total",
		Help:      "Total number of VP8 Picture ID discontinuities",
	},
		[]string{
			"source",
			"mime",
		})

	KeyframeCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "keyframes_total",
		Help:      "Total number of keyframes",
	},
		[]string{
			"source",
			"mime",
		})

	CorruptedFrames = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "corrupted_frames_total",
		Help:      "Total number of corrupted frames",
	},
		[]string{
			"source",
			"mime",
		})

	WrittenSamples = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "written_samples_total",
		Help:      "Total number of samples written to the output file",
	},
		[]string{
			"source",
			"kind",
			"mime",
		})

	RTPReadErrors = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "rtp_read_errors_total",
		Help:      "Total number of RTP read errors",
	},
		[]string{
			"source",
			"kind",
			"mime",
			"error",
		})

	ParticipantReconnectingEvents = prometheus.NewCounter(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "participant_reconnecting_events_total",
		Help:      "Total number of participant reconnecting events",
	})

	ParticipantReconnects = prometheus.NewCounter(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "participant_reconnects_total",
		Help:      "Total number of participant reconnects",
	})

	TrackSubscriptionFailures = prometheus.NewCounterVec(prometheus.CounterOpts{
		Subsystem: "recorder",
		Name:      "track_subscription_failures_total",
		Help:      "Total number of track subscription failures",
	},
		[]string{
			"error",
		})

	ComponentHealth = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Subsystem: "recorder",
		Name:      "component_health",
		Help:      "Health status of recorder components (1 = healthy, 0 = unhealthy)",
	},
		[]string{
			"component",
		})
)

Functions

func Init

func Init()

func OnParticipantReconnected added in v0.9.4

func OnParticipantReconnected()

func OnParticipantReconnecting added in v0.9.4

func OnParticipantReconnecting()

func OnRTPReadError

func OnRTPReadError(source string, kind string, mime string, error string)

func OnServerRequest

func OnServerRequest(event *events.Event)

func OnServerResponse

func OnServerResponse(msg interface{})

func OnTrackRecordingStarted added in v0.9.1

func OnTrackRecordingStarted(kind string, mime string, source string)

func OnTrackRecordingStopped added in v0.9.1

func OnTrackRecordingStopped(kind string, mime string, source string)

func OnTrackSubscriptionFailed added in v0.9.4

func OnTrackSubscriptionFailed(error string)

func ServePromMetrics

func ServePromMetrics(cfg config.Prometheus)

func SetComponentHealth added in v0.10.0

func SetComponentHealth(component string, healthy bool)

func UpdateCaptureMetrics

func UpdateCaptureMetrics(stats *CaptureStats)

Types

type AdapterTrackStats

type AdapterTrackStats struct {
	StartTime         int64  `json:"startTime"`
	EndTime           int64  `json:"endTime"`
	FirstSeqNum       uint16 `json:"firstSeqNum"`
	LastSeqNum        uint16 `json:"lastSeqNum"`
	SeqNumWrapArounds int    `json:"seqNumWrapArounds"`
	PLIRequests       int    `json:"pliRequests"`
	RTPReadErrors     int    `json:"rtpReadErrors"`
}

type BufferStatsWrapper

type BufferStatsWrapper struct {
	PacketsPushed  uint64 `json:"packetsPushed"`
	PacketsPopped  uint64 `json:"packetsPopped"`
	PacketsDropped uint64 `json:"packetsDropped"`
	PaddingPushed  uint64 `json:"paddingPushed"`
	SamplesPopped  uint64 `json:"samplesPopped"`
}

type CaptureStats

type CaptureStats struct {
	RecorderSessionUUID string                 `json:"recorderSessionId"`
	RoomID              string                 `json:"roomId"`
	ParticipantID       string                 `json:"participantId"`
	Tracks              map[string]*TrackStats `json:"tracks"`
	FileName            string                 `json:"fileName"`
}

type StatsFileOutput

type StatsFileOutput struct {
	CaptureStats   *CaptureStats `json:"captureStats"`
	StatsTimestamp int64         `json:"statsTimestamp"`
}

type StatsFileWriter

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

func NewStatsFileWriter

func NewStatsFileWriter(basePath string, fileMode os.FileMode) *StatsFileWriter

func (*StatsFileWriter) WriteStats

func (w *StatsFileWriter) WriteStats(webmFilePath string, stats *StatsFileOutput) error

type TrackStats

type TrackStats struct {
	Source             string                       `json:"source"`
	Buffer             *BufferStatsWrapper          `json:"buffer"`
	Adapter            *AdapterTrackStats           `json:"adapter"`
	RecorderTrackStats *recorder.RecorderTrackStats `json:"recorderTrackStats,omitempty"`
	TrackKind          string                       `json:"trackKind"`
	MimeType           string                       `json:"mimeType"`
}

Jump to

Keyboard shortcuts

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