Skip to content

Commit

Permalink
fix: Update receive node with proper tracking (#3621)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
AlanRynne authored Aug 30, 2024
1 parent 6e9e62a commit 8226bb3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object> { { "auto", auto } };
var properties = new Dictionary<string, object>
{
{ "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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
Expand All @@ -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;
Expand Down Expand Up @@ -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<string, object>
{
{ "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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -523,7 +522,6 @@ private void HandleInputType(StreamWrapper wrapper)

StreamWrapper = wrapper;

//ResetApiClient(wrapper);
Task.Run(async () =>
{
ApiResetTask = ResetApiClient(StreamWrapper);
Expand Down Expand Up @@ -722,16 +720,11 @@ public override void DoWork(Action<string, double> ReportProgress, Action Done)
}

ReceivedCommit = myCommit;
Speckle.Core.Logging.Analytics.TrackEvent(
receiveComponent.Tracker.TrackNodeReceive(
acc,
Speckle.Core.Logging.Analytics.Events.Receive,
new Dictionary<string, object>
{
{ "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)
Expand Down

0 comments on commit 8226bb3

Please sign in to comment.