Skip to content

Commit dbdb72e

Browse files
authored
add session features to room observability (#1298)
* add session features to room observability * Create light-apricots-act.md
1 parent 8b204ac commit dbdb72e

File tree

5 files changed

+43
-2
lines changed

5 files changed

+43
-2
lines changed

.changeset/light-apricots-act.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/protocol": patch
3+
---
4+
5+
add session features to room observability

observability/roomobs/gen_reporter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"time"
77
)
88

9-
const Version_LNTFR10 = true
9+
const Version_JNN296G = true
1010

1111
type KeyResolver interface {
1212
Resolve(string)
@@ -43,6 +43,7 @@ type RoomReporter interface {
4343
type RoomSessionTx interface {
4444
ReportStartTime(v time.Time)
4545
ReportEndTime(v time.Time)
46+
ReportFeatures(v uint16)
4647
}
4748

4849
type RoomSessionReporter interface {

observability/roomobs/gen_reporter_noop.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ func (r *noopRoomSessionReporter) Tx(f func(RoomSessionTx))
7878
func (r *noopRoomSessionReporter) TxAt(ts time.Time, f func(RoomSessionTx)) {}
7979
func (r *noopRoomSessionReporter) ReportStartTime(v time.Time) {}
8080
func (r *noopRoomSessionReporter) ReportEndTime(v time.Time) {}
81+
func (r *noopRoomSessionReporter) ReportFeatures(v uint16) {}
8182
func (r *noopRoomSessionReporter) WithParticipant(identity string) ParticipantReporter {
8283
return &noopParticipantReporter{}
8384
}

observability/roomobs/gen_source.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,6 @@ const (
8787
RollupParticipantSession Rollup = "participant_session"
8888
RollupTrackIndex Rollup = "track_index"
8989
RollupTrack Rollup = "track"
90-
RollupProjectRoomIndex Rollup = "project_room_index"
90+
RollupStartTimeIndex Rollup = "start_time_index"
91+
RollupEndTimeIndex Rollup = "end_time_index"
9192
)

observability/roomobs/room.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,36 @@ func TrackSourceFromProto(p livekit.TrackSource) TrackSource {
9696
return TrackSourceUndefined
9797
}
9898
}
99+
100+
type RoomFeature uint16
101+
102+
func (f RoomFeature) HasIngress() bool { return f&IngressRoomFeature != 0 }
103+
func (f RoomFeature) HasEgress() bool { return f&EgressRoomFeature != 0 }
104+
func (f RoomFeature) HasSIP() bool { return f&SIPRoomFeature != 0 }
105+
func (f RoomFeature) HasAgent() bool { return f&AgentRoomFeature != 0 }
106+
func (f RoomFeature) HasConnector() bool { return f&ConnectorRoomFeature != 0 }
107+
108+
const (
109+
IngressRoomFeature RoomFeature = 1 << iota
110+
EgressRoomFeature
111+
SIPRoomFeature
112+
AgentRoomFeature
113+
ConnectorRoomFeature
114+
)
115+
116+
func RoomFeatureFromParticipantKind(k livekit.ParticipantInfo_Kind) RoomFeature {
117+
switch k {
118+
case livekit.ParticipantInfo_INGRESS:
119+
return IngressRoomFeature
120+
case livekit.ParticipantInfo_EGRESS:
121+
return EgressRoomFeature
122+
case livekit.ParticipantInfo_SIP:
123+
return SIPRoomFeature
124+
case livekit.ParticipantInfo_AGENT:
125+
return AgentRoomFeature
126+
case livekit.ParticipantInfo_CONNECTOR:
127+
return ConnectorRoomFeature
128+
default:
129+
return 0
130+
}
131+
}

0 commit comments

Comments
 (0)