telemetry

This commit is contained in:
christianwade 2018-12-06 19:59:49 -08:00
parent 3d69eca0de
commit 198abe4ab6
15 changed files with 191 additions and 25 deletions

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.29")]
[assembly: AssemblyFileVersion("4.0.0.29")]
[assembly: AssemblyVersion("4.0.0.30")]
[assembly: AssemblyFileVersion("4.0.0.30")]

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.29")]
[assembly: AssemblyFileVersion("4.0.0.29")]
[assembly: AssemblyVersion("4.0.0.30")]
[assembly: AssemblyFileVersion("4.0.0.30")]

View File

@ -27,7 +27,7 @@ namespace BismNormalizer.Tests
{
using (Amo.Server server = new Amo.Server())
{
server.Connect("localhost");
server.Connect("localhost\\tb");
Amo.Database db = server.Databases.FindByName("Test1103_Target");
Assert.IsNotNull(db);
@ -42,7 +42,7 @@ namespace BismNormalizer.Tests
{
using (Tom.Server server = new Tom.Server())
{
server.Connect("localhost");
server.Connect("localhost\\tb");
Tom.Database db = server.Databases.FindByName("Test1200_Target");
Assert.IsNotNull(db);

View File

@ -0,0 +1,38 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BismNormalizer.Tests {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("localhost\\tb")]
public string TestServer {
get {
return ((string)(this["TestServer"]));
}
set {
this["TestServer"] = value;
}
}
}
}

View File

@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="BismNormalizer.Tests" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="TestServer" Type="System.String" Scope="User">
<Value Profile="(Default)">localhost\tb</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -2,12 +2,12 @@
<ComparisonInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ConnectionInfoSource>
<UseProject>false</UseProject>
<ServerName>localhost</ServerName>
<ServerName>localhost\tb</ServerName>
<DatabaseName>Test1103_Source</DatabaseName>
</ConnectionInfoSource>
<ConnectionInfoTarget>
<UseProject>false</UseProject>
<ServerName>localhost</ServerName>
<ServerName>localhost\tb</ServerName>
<DatabaseName>Test1103_Target</DatabaseName>
</ConnectionInfoTarget>
<OptionsInfo>

View File

@ -2,13 +2,13 @@
<ComparisonInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ConnectionInfoSource>
<UseProject>false</UseProject>
<ServerName>localhost</ServerName>
<ServerName>localhost\tb</ServerName>
<DatabaseName>Test1200_Source</DatabaseName>
<ProjectName>Tabular1200</ProjectName>
</ConnectionInfoSource>
<ConnectionInfoTarget>
<UseProject>false</UseProject>
<ServerName>localhost</ServerName>
<ServerName>localhost\tb</ServerName>
<DatabaseName>Test1200_Target</DatabaseName>
</ConnectionInfoTarget>
<OptionsInfo>

View File

@ -17,7 +17,7 @@ Function script:deletedb($databasename)
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") >$NULL
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect("localhost")
$server.connect("localhost\tb")
deletedb "Test1103_Source"
deletedb "Test1103_Target"

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="BismNormalizer.Tests.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<BismNormalizer.Tests.Settings>
<setting name="TestServer" serializeAs="String">
<value>localhost\tb</value>
</setting>
</BismNormalizer.Tests.Settings>
</userSettings>
</configuration>

View File

@ -79,20 +79,38 @@
<Reference Include="envdte80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.AnalysisServices, Version=15.0.2.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.0.2\lib\net45\Microsoft.AnalysisServices.dll</HintPath>
<Reference Include="Microsoft.AI.Agent.Intercept, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.4.0\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices.Core, Version=15.0.2.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.0.2\lib\net45\Microsoft.AnalysisServices.Core.dll</HintPath>
<Reference Include="Microsoft.AI.DependencyCollector, Version=2.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.8.1\lib\net45\Microsoft.AI.DependencyCollector.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices.SPClient.Interfaces, Version=15.0.2.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.0.2\lib\net45\Microsoft.AnalysisServices.SPClient.Interfaces.dll</HintPath>
<Reference Include="Microsoft.AI.PerfCounterCollector, Version=2.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.8.1\lib\net45\Microsoft.AI.PerfCounterCollector.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices.Tabular, Version=15.0.2.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.0.2\lib\net45\Microsoft.AnalysisServices.Tabular.dll</HintPath>
<Reference Include="Microsoft.AI.ServerTelemetryChannel, Version=2.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.8.1\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices.Tabular.Json, Version=15.0.2.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.0.2\lib\net45\Microsoft.AnalysisServices.Tabular.Json.dll</HintPath>
<Reference Include="Microsoft.AI.WindowsServer, Version=2.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.2.8.1\lib\net45\Microsoft.AI.WindowsServer.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices, Version=15.7.0.2, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.7.0.2\lib\net45\Microsoft.AnalysisServices.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices.Core, Version=15.7.0.2, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.7.0.2\lib\net45\Microsoft.AnalysisServices.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices.SPClient.Interfaces, Version=15.7.0.2, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.7.0.2\lib\net45\Microsoft.AnalysisServices.SPClient.Interfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices.Tabular, Version=15.7.0.2, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.7.0.2\lib\net45\Microsoft.AnalysisServices.Tabular.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AnalysisServices.Tabular.Json, Version=15.7.0.2, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.15.7.0.2\lib\net45\Microsoft.AnalysisServices.Tabular.Json.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ApplicationInsights, Version=2.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ApplicationInsights.2.8.1\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
@ -179,8 +197,14 @@
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.5.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="PresentationCore" />
@ -200,6 +224,7 @@
<Compile Include="TabularCompare\TabularMetadata\ExpressionCollection.cs" />
<Compile Include="TabularCompare\TabularMetadata\CalcDependency.cs" />
<Compile Include="TabularCompare\TabularMetadata\CalcDependencyCollection.cs" />
<Compile Include="TabularCompare\Telemetry.cs" />
<Compile Include="TabularCompare\UI\HighDpiUtils.cs" />
<Compile Include="TabularCompare\UI\BlobCredentials.cs">
<SubType>Form</SubType>
@ -395,6 +420,9 @@
<Resource Include="Resources\Warning.png" />
<Resource Include="Resources\WarningToolWindow.png" />
<Resource Include="Resources\SkipActionGrey.png" />
<None Include="ApplicationInsights.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TabularCompare\TabularCompare.dgml">
<SubType>Designer</SubType>
</None>

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.29")]
[assembly: AssemblyFileVersion("4.0.0.29")]
[assembly: AssemblyVersion("4.0.0.30")]
[assembly: AssemblyFileVersion("4.0.0.30")]

View File

@ -61,6 +61,8 @@ namespace BismNormalizer.TabularCompare
private static Comparison CreateComparisonInitialized(ComparisonInfo comparisonInfo)
{
Telemetry.TrackEvent("CreateComparisonInitialized", new Dictionary<string, string> { { "App", "BismNormalizer" } });
if (comparisonInfo.SourceCompatibilityLevel != comparisonInfo.TargetCompatibilityLevel && !(comparisonInfo.SourceCompatibilityLevel == 1200 && comparisonInfo.TargetCompatibilityLevel == 1400))
{
throw new ConnectionException($"This combination of mixed compatibility levels is not supported.\nSource is {Convert.ToString(comparisonInfo.SourceCompatibilityLevel)} and target is {Convert.ToString(comparisonInfo.TargetCompatibilityLevel)}.");

View File

@ -0,0 +1,67 @@
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace BismNormalizer.TabularCompare
{
public static class Telemetry
{
private const string TelemetryKey = "f3a055c0-3210-42c0-b5d2-3c05dd4e9a96";
private static TelemetryClient _telemetry = GetAppInsightsClient();
public static bool Enabled { get; set; } = true;
private static TelemetryClient GetAppInsightsClient()
{
var config = new TelemetryConfiguration();
config.InstrumentationKey = TelemetryKey;
config.TelemetryChannel = new Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel();
//config.TelemetryChannel = new Microsoft.ApplicationInsights.Channel.InMemoryChannel(); // Default channel
config.TelemetryChannel.DeveloperMode = Debugger.IsAttached;
#if DEBUG
config.TelemetryChannel.DeveloperMode = true;
#endif
TelemetryClient client = new TelemetryClient(config);
client.Context.Component.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
client.Context.Session.Id = Guid.NewGuid().ToString();
client.Context.User.Id = (Environment.UserName + Environment.MachineName).GetHashCode().ToString();
//client.Context.Device.OperatingSystem = Environment.OSVersion.ToString();
return client;
}
public static void SetUser(string user)
{
_telemetry.Context.User.AuthenticatedUserId = user;
}
public static void TrackEvent(string key, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
{
if (Enabled)
{
_telemetry.TrackEvent(key, properties, metrics);
}
}
public static void TrackException(Exception ex)
{
if (ex != null && Enabled)
{
var telex = new Microsoft.ApplicationInsights.DataContracts.ExceptionTelemetry(ex);
_telemetry.TrackException(telex);
Flush();
}
}
internal static void Flush()
{
_telemetry.Flush();
}
}
}

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AnalysisServices.retail.amd64" version="15.0.2" targetFramework="net461" />
<package id="Microsoft.AnalysisServices.retail.amd64" version="15.7.0.2" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights" version="2.8.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.8.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.8.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.8.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.8.1" targetFramework="net461" />
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net452" />
<package id="Microsoft.VisualStudio.Imaging" version="14.3.25407" targetFramework="net461" />
<package id="Microsoft.VisualStudio.OLE.Interop" version="7.10.6070" targetFramework="net461" />
@ -19,4 +25,5 @@
<package id="Microsoft.VisualStudio.Validation" version="14.1.111" targetFramework="net461" />
<package id="MSBuild.Extension.Pack" version="1.8.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.5.0" targetFramework="net461" />
</packages>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="BismNormalizer.ea2aeb43-64a6-4dee-8816-099fb44513fa" Version="4.0.0.29" Language="en-US" Publisher="BISM Normalizer" />
<Identity Id="BismNormalizer.ea2aeb43-64a6-4dee-8816-099fb44513fa" Version="4.0.0.30" Language="en-US" Publisher="BISM Normalizer" />
<DisplayName>BISM Normalizer</DisplayName>
<Description xml:space="preserve">BISM Normalizer manages Analysis Services tabular models</Description>
<MoreInfo>http://bism-normalizer.com/</MoreInfo>