Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/light-apricots-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/protocol": patch
---

add session features to room observability
3 changes: 2 additions & 1 deletion observability/roomobs/gen_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"
)

const Version_LNTFR10 = true
const Version_JNN296G = true

type KeyResolver interface {
Resolve(string)
Expand Down Expand Up @@ -43,6 +43,7 @@ type RoomReporter interface {
type RoomSessionTx interface {
ReportStartTime(v time.Time)
ReportEndTime(v time.Time)
ReportFeatures(v uint16)
}

type RoomSessionReporter interface {
Expand Down
1 change: 1 addition & 0 deletions observability/roomobs/gen_reporter_noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
}
Expand Down
3 changes: 2 additions & 1 deletion observability/roomobs/gen_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
33 changes: 33 additions & 0 deletions observability/roomobs/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Loading