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
+1 -1
View File
@@ -14,7 +14,7 @@ require (
github.com/google/wire v0.5.0
github.com/gorilla/websocket v1.4.2
github.com/hashicorp/golang-lru v0.5.4
github.com/livekit/protocol v0.11.11-0.20220113073321-71562c1a1a33
github.com/livekit/protocol v0.11.11-0.20220113222200-a4208afda1fd
github.com/magefile/mage v1.11.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
github.com/mitchellh/go-homedir v1.1.0
+4
View File
@@ -134,6 +134,10 @@ github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
github.com/livekit/protocol v0.11.11-0.20220113073321-71562c1a1a33 h1:XlV/QWVrwkCXXq/sS9ADNsIUGQWTJRaXSeCLznzc9OQ=
github.com/livekit/protocol v0.11.11-0.20220113073321-71562c1a1a33/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
github.com/livekit/protocol v0.11.11-0.20220113220524-70bf63940230 h1:MFXlr2tTopDdzH8SxiEMHrVqo2hOp97n21QxKyDDkbw=
github.com/livekit/protocol v0.11.11-0.20220113220524-70bf63940230/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
github.com/livekit/protocol v0.11.11-0.20220113222200-a4208afda1fd h1:62EgUkw1tQyqgie8o03/56f6ZSW5i6o3bApYPYFCK5c=
github.com/livekit/protocol v0.11.11-0.20220113222200-a4208afda1fd/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls=
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
@@ -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) {