diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/BaseComponents/ComponentTracker.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/BaseComponents/ComponentTracker.cs index 1c3b2ba465..8b12444d7f 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/BaseComponents/ComponentTracker.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/BaseComponents/ComponentTracker.cs @@ -14,13 +14,13 @@ public ComponentTracker(GH_Component parent) Parent = parent; } - private static void AppendHostAppInfoToProperties(Dictionary properties) + private static void AppendHostAppInfoToProperties(Dictionary properties) { properties["hostAppVersion"] = Loader.GetGrasshopperHostAppVersion(); properties["hostApp"] = HostApplications.Grasshopper.Slug; } - public void TrackEvent(Speckle.Core.Logging.Analytics.Events eventName, Dictionary properties) + public void TrackEvent(Speckle.Core.Logging.Analytics.Events eventName, Dictionary properties) { AppendHostAppInfoToProperties(properties); Speckle.Core.Logging.Analytics.TrackEvent(eventName, properties); @@ -44,9 +44,9 @@ public void TrackNodeRun(string? name = null, string? node = null) Speckle.Core.Logging.Analytics.TrackEvent(Speckle.Core.Logging.Analytics.Events.NodeRun, customProperties); } - public void TrackNodeSend(Account acc, bool auto, bool sync = false) + public void TrackNodeSend(Account acc, bool auto, string? workspaceId, bool sync = false) { - var customProperties = new Dictionary(); + var customProperties = new Dictionary() { { "workspace_id", workspaceId } }; if (auto) { customProperties.Add("auto", auto); @@ -61,14 +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, bool isMultiplayer, string sourceHostApp) + public void TrackNodeReceive(Account acc, bool auto, bool isMultiplayer, string sourceHostApp, string? workspaceId) { - var properties = new Dictionary + var properties = new Dictionary { { "auto", auto }, { "isMultiplayer", isMultiplayer }, { "sourceHostApp", HostApplications.GetHostAppFromString(sourceHostApp).Slug }, { "sourceHostAppVersion", sourceHostApp }, + { "workspace_id", workspaceId }, }; AppendHostAppInfoToProperties(properties); Speckle.Core.Logging.Analytics.TrackEvent(acc, Speckle.Core.Logging.Analytics.Events.Receive, properties); diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.ReceiveComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.ReceiveComponent.cs index e4dd583fac..e7ca0fed80 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.ReceiveComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.ReceiveComponent.cs @@ -554,7 +554,8 @@ public override void DoWork(Action ReportProgress, Action Done) Done(); return; } - receiveComponent.Tracker.TrackNodeSend(client.Account, receiveComponent.AutoReceive); + + receiveComponent.Tracker.TrackNodeSend(client.Account, receiveComponent.AutoReceive, null); var remoteTransport = new ServerTransport(InputWrapper?.GetAccount().Result, InputWrapper?.StreamId); remoteTransport.TransportName = "R"; diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponent.cs index e381ec57e9..05fe8b2e69 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponent.cs @@ -445,7 +445,7 @@ public override void DoWork(Action ReportProgress, Action Done) continue; } - sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend); + sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend, null); var serverTransport = new ServerTransport(acc, sw.StreamId) { TransportName = $"T{t}" }; transportBranches.Add(serverTransport, sw.BranchName ?? "main"); diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.VariableInputSendComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.VariableInputSendComponent.cs index 9389c4d969..13625e25a5 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.VariableInputSendComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.VariableInputSendComponent.cs @@ -533,7 +533,7 @@ public override void DoWork(Action ReportProgress, Action Done) transportBranches.Add(serverTransport, sw.BranchName ?? "main"); Transports.Add(serverTransport); - sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend); + sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend, null); } else if (transport is ITransport otherTransport) { diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncReceiveComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncReceiveComponent.cs index 265caeb6f2..3912966101 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncReceiveComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncReceiveComponent.cs @@ -252,7 +252,15 @@ public override void SolveInstanceWithLogContext(IGH_DataAccess DA) return null; } - Tracker.TrackNodeReceive(acc, AutoReceive, myCommit.authorId != acc.userInfo.id, myCommit.sourceApplication); + var workspaceId = await client.GetWorkspaceId(StreamWrapper.StreamId).ConfigureAwait(false); + + Tracker.TrackNodeReceive( + acc, + AutoReceive, + myCommit.authorId != acc.userInfo.id, + myCommit.sourceApplication, + workspaceId + ); var totalObjectCount = 1; diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs index 08c8224681..9b5b7d4190 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs @@ -720,11 +720,14 @@ public override void DoWork(Action ReportProgress, Action Done) } ReceivedCommit = myCommit; + var workspaceId = await receiveComponent.ApiClient.GetWorkspaceId(InputWrapper.StreamId).ConfigureAwait(false); + receiveComponent.Tracker.TrackNodeReceive( acc, receiveComponent.AutoReceive, myCommit.authorId != acc.userInfo.id, - myCommit.sourceApplication + myCommit.sourceApplication, + workspaceId ); if (CancellationToken.IsCancellationRequested) diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs index b80b5e5980..5d4a143a0b 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs @@ -558,7 +558,10 @@ public override void DoWork(Action ReportProgress, Action Done) transportBranches.Add(serverTransport, sw.BranchName ?? "main"); Transports.Add(serverTransport); - sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend); + using Client c = new(acc); + var workspaceId = c.GetWorkspaceId(sw.StreamId).Result; + + sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend, workspaceId); } else if (transport is ITransport otherTransport) {