Skip to content

Commit

Permalink
Adding basic data model telemetry support
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hall (DEVDIV) committed Jan 9, 2017
1 parent f18a2f2 commit 0e314dc
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
Binary file added lib/Microsoft.VisualStudio.Telemetry.dll
Binary file not shown.
5 changes: 5 additions & 0 deletions src/Package/ExperimentalFeatures.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Commands\ShowModalCommand.cs" />
<Compile Include="ExperimentalFeaturesPackage.cs" />
<Compile Include="Telemetry\PackageTelemetry.cs" />
<Compile Include="VSCommandTable.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand Down Expand Up @@ -187,6 +188,10 @@
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Telemetry, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Microsoft.VisualStudio.Telemetry.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll</HintPath>
<Private>False</Private>
Expand Down
4 changes: 3 additions & 1 deletion src/Package/ExperimentalFeaturesPackage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio;
using ExperimentalFeatures.Telemetry;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.ExtensionManager;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
Expand Down Expand Up @@ -48,6 +49,7 @@ protected override async Tasks.Task InitializeAsync(CancellationToken cancellati

bool hasUpdates = await Installer.CheckForUpdatesAsync();

PackageTelemetry.TelemetrySession.PackageLoaded();
#if !DEBUG
if (!hasUpdates)
return;
Expand Down
42 changes: 42 additions & 0 deletions src/Package/Telemetry/PackageTelemetry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Telemetry;

namespace ExperimentalFeatures.Telemetry
{
public class PackageTelemetry
{
public static PackageTelemetry TelemetrySession { get; private set; }

static PackageTelemetry()
{
TelemetrySession = new PackageTelemetry();
}

public PackageTelemetry()
{

}

public void PackageLoaded()
{
var telEvent = new TelemetryEvent(TelemetryConstants.PackageLoadedEvent);
this.PostEventToDefaultSession(telEvent);
}

private void PostEventToDefaultSession(TelemetryEvent vsTelemetryEvent)
{
TelemetryService.DefaultSession.PostEvent(vsTelemetryEvent);
}

private static class TelemetryConstants
{
public const string ExperimentsEventPrefix = "WebTools/Experiments/";

public const string PackageLoadedEvent = ExperimentsEventPrefix + "PackageLoaded";
}
}
}

0 comments on commit 0e314dc

Please sign in to comment.