From cf830191e30cb62cb828b87b592ea73a5612e139 Mon Sep 17 00:00:00 2001 From: shishirng Date: Thu, 13 Jan 2022 17:45:21 -0500 Subject: [PATCH] Add client info to participant_joined event (#337) Signed-off-by: shishir gowda --- go.mod | 2 +- go.sum | 4 ++++ .../telemetryserviceinternalevents.go | 20 ++++++++++++------- .../test/telemetry_service_events_test.go | 16 ++++++++++++++- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 409a78710..1de2f5f1e 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 30e0120be..c75866182 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/telemetry/telemetryserviceinternalevents.go b/pkg/telemetry/telemetryserviceinternalevents.go index 87752317d..eca2e9d1e 100644 --- a/pkg/telemetry/telemetryserviceinternalevents.go +++ b/pkg/telemetry/telemetryserviceinternalevents.go @@ -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(), }) } diff --git a/pkg/telemetry/test/telemetry_service_events_test.go b/pkg/telemetry/test/telemetry_service_events_test.go index 230cfa9ac..48cf297a7 100644 --- a/pkg/telemetry/test/telemetry_service_events_test.go +++ b/pkg/telemetry/test/telemetry_service_events_test.go @@ -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) {