diff --git a/.changeset/light-apricots-act.md b/.changeset/light-apricots-act.md new file mode 100644 index 000000000..7288fa79c --- /dev/null +++ b/.changeset/light-apricots-act.md @@ -0,0 +1,5 @@ +--- +"@livekit/protocol": patch +--- + +add session features to room observability diff --git a/observability/roomobs/gen_reporter.go b/observability/roomobs/gen_reporter.go index edbc0ad32..6265c45ac 100644 --- a/observability/roomobs/gen_reporter.go +++ b/observability/roomobs/gen_reporter.go @@ -6,7 +6,7 @@ import ( "time" ) -const Version_LNTFR10 = true +const Version_JNN296G = true type KeyResolver interface { Resolve(string) @@ -43,6 +43,7 @@ type RoomReporter interface { type RoomSessionTx interface { ReportStartTime(v time.Time) ReportEndTime(v time.Time) + ReportFeatures(v uint16) } type RoomSessionReporter interface { diff --git a/observability/roomobs/gen_reporter_noop.go b/observability/roomobs/gen_reporter_noop.go index 5bdf21716..50453b20a 100644 --- a/observability/roomobs/gen_reporter_noop.go +++ b/observability/roomobs/gen_reporter_noop.go @@ -78,6 +78,7 @@ func (r *noopRoomSessionReporter) Tx(f func(RoomSessionTx)) func (r *noopRoomSessionReporter) TxAt(ts time.Time, f func(RoomSessionTx)) {} func (r *noopRoomSessionReporter) ReportStartTime(v time.Time) {} func (r *noopRoomSessionReporter) ReportEndTime(v time.Time) {} +func (r *noopRoomSessionReporter) ReportFeatures(v uint16) {} func (r *noopRoomSessionReporter) WithParticipant(identity string) ParticipantReporter { return &noopParticipantReporter{} } diff --git a/observability/roomobs/gen_source.go b/observability/roomobs/gen_source.go index 9e65e2145..57ca242e2 100644 --- a/observability/roomobs/gen_source.go +++ b/observability/roomobs/gen_source.go @@ -87,5 +87,6 @@ const ( RollupParticipantSession Rollup = "participant_session" RollupTrackIndex Rollup = "track_index" RollupTrack Rollup = "track" - RollupProjectRoomIndex Rollup = "project_room_index" + RollupStartTimeIndex Rollup = "start_time_index" + RollupEndTimeIndex Rollup = "end_time_index" ) diff --git a/observability/roomobs/room.go b/observability/roomobs/room.go index 58abb2dc4..63f0d6842 100644 --- a/observability/roomobs/room.go +++ b/observability/roomobs/room.go @@ -96,3 +96,36 @@ func TrackSourceFromProto(p livekit.TrackSource) TrackSource { return TrackSourceUndefined } } + +type RoomFeature uint16 + +func (f RoomFeature) HasIngress() bool { return f&IngressRoomFeature != 0 } +func (f RoomFeature) HasEgress() bool { return f&EgressRoomFeature != 0 } +func (f RoomFeature) HasSIP() bool { return f&SIPRoomFeature != 0 } +func (f RoomFeature) HasAgent() bool { return f&AgentRoomFeature != 0 } +func (f RoomFeature) HasConnector() bool { return f&ConnectorRoomFeature != 0 } + +const ( + IngressRoomFeature RoomFeature = 1 << iota + EgressRoomFeature + SIPRoomFeature + AgentRoomFeature + ConnectorRoomFeature +) + +func RoomFeatureFromParticipantKind(k livekit.ParticipantInfo_Kind) RoomFeature { + switch k { + case livekit.ParticipantInfo_INGRESS: + return IngressRoomFeature + case livekit.ParticipantInfo_EGRESS: + return EgressRoomFeature + case livekit.ParticipantInfo_SIP: + return SIPRoomFeature + case livekit.ParticipantInfo_AGENT: + return AgentRoomFeature + case livekit.ParticipantInfo_CONNECTOR: + return ConnectorRoomFeature + default: + return 0 + } +}