Add client info to participant_joined event (#337)

Signed-off-by: shishir gowda <shishir@livekit.io>
This commit is contained in:
shishirng
2022-01-13 17:45:21 -05:00
committed by GitHub
parent f9b2af0cf9
commit cf830191e3
4 changed files with 33 additions and 9 deletions
@@ -57,13 +57,19 @@ func (t *telemetryServiceInternal) ParticipantJoined(ctx context.Context, room *
})
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
Type: livekit.AnalyticsEventType_PARTICIPANT_JOINED,
Timestamp: timestamppb.Now(),
RoomId: room.Sid,
ParticipantId: participant.Sid,
Participant: participant,
Room: room,
SdkType: clientInfo.GetSdk(),
Type: livekit.AnalyticsEventType_PARTICIPANT_JOINED,
Timestamp: timestamppb.Now(),
RoomId: room.Sid,
ParticipantId: participant.Sid,
Participant: participant,
Room: room,
SdkType: clientInfo.GetSdk(),
ClientVersion: clientInfo.GetVersion(),
ClientOs: clientInfo.GetOs(),
ClientOsVersion: clientInfo.GetOsVersion(),
ClientDeviceModel: clientInfo.GetDeviceModel(),
ClientBrowser: clientInfo.GetBrowser(),
ClientBrowserVersion: clientInfo.GetBrowserVersion(),
})
}
@@ -14,7 +14,15 @@ func Test_OnParticipantJoin_EventIsSent(t *testing.T) {
//prepare
room := &livekit.Room{Sid: "RoomSid", Name: "RoomName"}
partSID := "part1"
clientInfo := &livekit.ClientInfo{Sdk: 2}
clientInfo := &livekit.ClientInfo{
Sdk: 2,
Version: "v1",
Os: "mac",
OsVersion: "v1",
DeviceModel: "DM1",
Browser: "chrome",
BrowserVersion: "97.0.1",
}
participantInfo := &livekit.ParticipantInfo{Sid: partSID}
//do
@@ -29,6 +37,12 @@ func Test_OnParticipantJoin_EventIsSent(t *testing.T) {
require.Equal(t, room.Sid, event.RoomId)
require.Equal(t, room, event.Room)
require.Equal(t, clientInfo.Sdk, event.SdkType)
require.Equal(t, clientInfo.Version, event.ClientVersion)
require.Equal(t, clientInfo.Os, event.ClientOs)
require.Equal(t, clientInfo.OsVersion, event.ClientOsVersion)
require.Equal(t, clientInfo.DeviceModel, event.ClientDeviceModel)
require.Equal(t, clientInfo.Browser, event.ClientBrowser)
require.Equal(t, clientInfo.BrowserVersion, event.ClientBrowserVersion)
}
func Test_OnParticipantLeft_EventIsSent(t *testing.T) {