From 8226bb3bce3047e95705fe09169479f0809ea4a7 Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Fri, 30 Aug 2024 19:04:46 +0200 Subject: [PATCH] fix: Update receive node with proper tracking (#3621) * fix: Update receive node with proper tracking Update tracker to allow all properties tracked on receive * fix: Use tracker on sync receive component * fix: Remove unnecessary using statement --- .../BaseComponents/ComponentTracker.cs | 10 ++++++++-- .../Ops/Operations.SyncReceiveComponent.cs | 14 +------------- .../Operations.VariableInputReceiveComponent.cs | 15 ++++----------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/BaseComponents/ComponentTracker.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/BaseComponents/ComponentTracker.cs index 351d4c6324..1c3b2ba465 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/BaseComponents/ComponentTracker.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/BaseComponents/ComponentTracker.cs @@ -61,9 +61,15 @@ public void TrackNodeSend(Account acc, bool auto, bool sync = false) Speckle.Core.Logging.Analytics.TrackEvent(acc, Speckle.Core.Logging.Analytics.Events.Send, customProperties); } - public void TrackNodeReceive(Account acc, bool auto) + public void TrackNodeReceive(Account acc, bool auto, bool isMultiplayer, string sourceHostApp) { - var properties = new Dictionary { { "auto", auto } }; + var properties = new Dictionary + { + { "auto", auto }, + { "isMultiplayer", isMultiplayer }, + { "sourceHostApp", HostApplications.GetHostAppFromString(sourceHostApp).Slug }, + { "sourceHostAppVersion", sourceHostApp }, + }; AppendHostAppInfoToProperties(properties); Speckle.Core.Logging.Analytics.TrackEvent(acc, Speckle.Core.Logging.Analytics.Events.Receive, properties); } diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncReceiveComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncReceiveComponent.cs index e4652eb5e0..265caeb6f2 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncReceiveComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncReceiveComponent.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Drawing; using System.Threading.Tasks; using System.Windows.Forms; @@ -12,7 +11,6 @@ using Speckle.Core.Api; using Speckle.Core.Api.SubscriptionModels; using Speckle.Core.Credentials; -using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; using Speckle.Core.Transports; @@ -254,17 +252,7 @@ public override void SolveInstanceWithLogContext(IGH_DataAccess DA) return null; } - Speckle.Core.Logging.Analytics.TrackEvent( - acc, - Speckle.Core.Logging.Analytics.Events.Receive, - new Dictionary - { - { "sync", true }, - { "sourceHostApp", HostApplications.GetHostAppFromString(myCommit.sourceApplication).Slug }, - { "sourceHostAppVersion", myCommit.sourceApplication }, - { "isMultiplayer", myCommit.authorId != acc.userInfo.id } - } - ); + Tracker.TrackNodeReceive(acc, AutoReceive, myCommit.authorId != acc.userInfo.id, myCommit.sourceApplication); var totalObjectCount = 1; diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs index 608e7f4616..08c8224681 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs @@ -24,7 +24,6 @@ using Speckle.Core.Api.SubscriptionModels; using Speckle.Core.Credentials; using Speckle.Core.Helpers; -using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; using Speckle.Core.Models.Extensions; @@ -523,7 +522,6 @@ private void HandleInputType(StreamWrapper wrapper) StreamWrapper = wrapper; - //ResetApiClient(wrapper); Task.Run(async () => { ApiResetTask = ResetApiClient(StreamWrapper); @@ -722,16 +720,11 @@ public override void DoWork(Action ReportProgress, Action Done) } ReceivedCommit = myCommit; - Speckle.Core.Logging.Analytics.TrackEvent( + receiveComponent.Tracker.TrackNodeReceive( acc, - Speckle.Core.Logging.Analytics.Events.Receive, - new Dictionary - { - { "auto", receiveComponent.AutoReceive }, - { "sourceHostApp", HostApplications.GetHostAppFromString(myCommit.sourceApplication).Slug }, - { "sourceHostAppVersion", myCommit.sourceApplication }, - { "isMultiplayer", myCommit.authorId != acc.userInfo.id } - } + receiveComponent.AutoReceive, + myCommit.authorId != acc.userInfo.id, + myCommit.sourceApplication ); if (CancellationToken.IsCancellationRequested)