-
Notifications
You must be signed in to change notification settings - Fork 354
Adding Installer Telemetry #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
0fb47d4
Addin Installer Telemetry
sanyamc-msft 785acc2
InstallerTelemetry2
sanyamc-msft 2cda404
Removing older files
sanyamc-msft 99a5f49
adding indentation
sanyamc-msft 9d75c29
Removing tabs from Buildrelease.ps1
sanyamc-msft a4cba5d
Addressing PR feedback
sanyamc-msft 06f51e2
Added final feedback
sanyamc-msft 77de181
using default wix targets
sanyamc-msft ef73165
Adding build.targets
sanyamc-msft 7b3b336
Adding Build.targets
sanyamc-msft 82500a5
Reverting build.targets changes as my dlls are projects and not dlls …
sanyamc-msft 32ff627
Adding feedback
sanyamc-msft 4931fe4
Adding feedback from CR
sanyamc-msft f1e4aae
Merge pull request #381 from nareshjo/telemetry
mousetraps 3c6a345
Using Checked in wix.ca.targets
sanyamc-msft 190322c
Removing assemblyversions.cs
sanyamc-msft 5a093e5
Fixing releasebuild variable and adding csharp target to build .ca.dl…
sanyamc-msft ca896ec
Adding default AssemblyVersion.cs
sanyamc-msft 34a9c26
Addin Installer Telemetry
sanyamc-msft d1b4d20
InstallerTelemetry2
sanyamc-msft b5c4e10
Removing older files
sanyamc-msft a722233
adding indentation
sanyamc-msft 963acce
Removing tabs from Buildrelease.ps1
sanyamc-msft 82518c9
Addressing PR feedback
sanyamc-msft 135fca0
Added final feedback
sanyamc-msft 8d23423
using default wix targets
sanyamc-msft 7974ad4
Adding build.targets
sanyamc-msft 0a848ce
Reverting build.targets changes as my dlls are projects and not dlls …
sanyamc-msft 8d88318
Adding feedback from CR
sanyamc-msft 7f6c793
Using Checked in wix.ca.targets
sanyamc-msft 3003c20
Fixing releasebuild variable and adding csharp target to build .ca.dl…
sanyamc-msft 7ea8a49
Updating with latest changes from master
sanyamc-msft a6bfc96
Merging files
sanyamc-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <configuration> | ||
| <startup useLegacyV2RuntimeActivationPolicy="true"> | ||
|
|
||
| <!-- | ||
| Use supportedRuntime tags to explicitly specify the version(s) of the .NET Framework runtime that | ||
| the custom action should run on. If no versions are specified, the chosen version of the runtime | ||
| will be the "best" match to what Microsoft.Deployment.WindowsInstaller.dll was built against. | ||
|
|
||
| WARNING: leaving the version unspecified is dangerous as it introduces a risk of compatibility | ||
| problems with future versions of the .NET Framework runtime. It is highly recommended that you specify | ||
| only the version(s) of the .NET Framework runtime that you have tested against. | ||
|
|
||
| Note for .NET Framework v3.0 and v3.5, the runtime version is still v2.0. | ||
|
|
||
| In order to enable .NET Framework version 2.0 runtime activation policy, which is to load all assemblies | ||
| by using the latest supported runtime, @useLegacyV2RuntimeActivationPolicy="true". | ||
|
|
||
| For more information, see http://msdn.microsoft.com/en-us/library/bbx34a2h.aspx | ||
| --> | ||
|
|
||
| <supportedRuntime version="v4.0" /> | ||
| <supportedRuntime version="v2.0.50727"/> | ||
| </startup> | ||
|
|
||
| <!-- | ||
| Add additional configuration settings here. For more information on application config files, | ||
| see http://msdn.microsoft.com/en-us/library/kza1yk3a.aspx | ||
| --> | ||
|
|
||
| </configuration> |
129 changes: 129 additions & 0 deletions
129
Nodejs/Setup/InstallerTelemetryAction/InstallerTelemetryAction.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| //*********************************************************// | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
| // | ||
| // Apache 2.0 License | ||
| // | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
| // implied. See the License for the specific language governing | ||
| // permissions and limitations under the License. | ||
| // | ||
| //*********************************************************// | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Collections.Specialized; | ||
| using System.Diagnostics; | ||
| using System.Net; | ||
| using System.Text; | ||
| using System.Web.Script.Serialization; | ||
| using System.Globalization; | ||
| using Microsoft.Deployment.WindowsInstaller; | ||
|
|
||
| namespace Microsoft.NodejsTools.Telemetry | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Braces on same line here and everywhere else. |
||
| public class InstallerTelemetryActions { | ||
|
|
||
| [CustomAction] | ||
| public static ActionResult RecordInstallStartTime(Session session) { | ||
| session["InstallStartTime"] = DateTime.Now.ToString(CultureInfo.InvariantCulture); | ||
| return ActionResult.Success; | ||
| } | ||
|
|
||
| [CustomAction] | ||
| public static ActionResult LogInstallSuccessResult(Session session) { | ||
| session.Log("Begin Telemetry Log"); | ||
| LogInstallStatus("Success", session); | ||
| session.Log("End Telemetry Log"); | ||
| return ActionResult.Success; | ||
| } | ||
|
|
||
| [CustomAction] | ||
| public static ActionResult LogInstallErrorResult(Session session) { | ||
| session.Log("Begin Telemetry Log"); | ||
| LogInstallStatus("Error", session); | ||
| session.Log("End Telemetry Log"); | ||
| return ActionResult.Success; | ||
| } | ||
|
|
||
| [CustomAction] | ||
| public static ActionResult LogInstallCancelResult(Session session) { | ||
| session.Log("Begin Telemetry Log"); | ||
| LogInstallStatus("Cancel", session); | ||
| session.Log("End Telemetry Log"); | ||
| return ActionResult.Success; | ||
| } | ||
|
|
||
| private static void LogInstallStatus(string InstallStatus, Session session) | ||
| { | ||
| TimeSpan installTime = DateTime.Now - DateTime.Parse(session["InstallStartTime"]); | ||
| bool isInstalled = session.EvaluateCondition("Installed"); | ||
| string currentState = null; | ||
| string requestState = null; | ||
|
|
||
| FeatureInfoCollection featureInfoCollection = session.Features; | ||
| foreach (FeatureInfo featureInfo in featureInfoCollection) | ||
| { | ||
| currentState = featureInfo.CurrentState.ToString("F"); | ||
| requestState = featureInfo.RequestState.ToString("F"); | ||
| // we just want the current and requested state of A feature to understand if its a new user, upgrade, reinstall or remove. | ||
| break; | ||
| } | ||
| session.Log("Starting POST"); | ||
| Dictionary<string, object> data = new Dictionary<string, object>() { | ||
| { | ||
| "iKey", "377a3718-78a7-49df-abcc-1001317db729" | ||
| }, { | ||
| "name", "Microsoft.ApplicationInsights.Event" | ||
| }, { | ||
| "time", DateTime.Now.ToUniversalTime().ToString(CultureInfo.InvariantCulture) | ||
| }, { | ||
| "data", new Dictionary <string, object> () { | ||
| { | ||
| "baseType", "EventData" | ||
| }, { | ||
| "baseData", new Dictionary <string, object> () { | ||
| { | ||
| "ver", "2" | ||
| }, { | ||
| "name", "NtvsInstallerTelemetry" | ||
| }, { | ||
| "properties", new Dictionary <string, string> () { | ||
| { | ||
| "InstallStatus", InstallStatus | ||
| }, { | ||
| "IsNtvsInstalled", isInstalled.ToString(CultureInfo.InvariantCulture) | ||
| }, { | ||
| "CurrentState", currentState | ||
| }, { | ||
| "RequestState", requestState | ||
| }, { | ||
| "NtvsVersion", session["NtvsVersion"] | ||
| }, { | ||
| "VSVersion", session["VSVersion"] | ||
| }, { | ||
| "MsiVersion", session["MsiVersion"] | ||
| }, { | ||
| "TimeTakenInSeconds", installTime.TotalSeconds.ToString(CultureInfo.InvariantCulture) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| string jsonString = (new JavaScriptSerializer()).Serialize(data); | ||
| using (WebClient client = new WebClient()) | ||
| { | ||
| string response = client.UploadString("https://dc.services.visualstudio.com/v2/track", jsonString); | ||
| session.Log(response); | ||
| } | ||
| } | ||
|
|
||
| } | ||
| } | ||
69 changes: 69 additions & 0 deletions
69
Nodejs/Setup/InstallerTelemetryAction/InstallerTelemetryAction.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <Choose> | ||
| <When Condition=" '$(VisualStudioVersion)'=='14.0' Or '$(TargetVisualStudioVersion)'=='VS140' "> | ||
| <PropertyGroup> | ||
| <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> | ||
| <FileUpgradeFlags> | ||
| </FileUpgradeFlags> | ||
| <UpgradeBackupLocation> | ||
| </UpgradeBackupLocation> | ||
| <OldToolsVersion>4.0</OldToolsVersion> | ||
| </PropertyGroup> | ||
| </When> | ||
| <When Condition=" '$(VisualStudioVersion)'=='12.0' Or '$(TargetVisualStudioVersion)'=='VS120' "> | ||
| <PropertyGroup> | ||
| <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> | ||
| <FileUpgradeFlags> | ||
| </FileUpgradeFlags> | ||
| <UpgradeBackupLocation> | ||
| </UpgradeBackupLocation> | ||
| <OldToolsVersion>4.0</OldToolsVersion> | ||
| </PropertyGroup> | ||
| </When> | ||
| <When Condition=" '$(VisualStudioVersion)'=='11.0' Or '$(TargetVisualStudioVersion)'=='VS110' "> | ||
| <PropertyGroup> | ||
| <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> | ||
| <FileUpgradeFlags> | ||
| </FileUpgradeFlags> | ||
| <UpgradeBackupLocation> | ||
| </UpgradeBackupLocation> | ||
| <OldToolsVersion>4.0</OldToolsVersion> | ||
| </PropertyGroup> | ||
| </When> | ||
| </Choose> | ||
| <Import Project="..\SetupProjectBefore.settings" /> | ||
| <PropertyGroup> | ||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| <ProductVersion>8.0.30703</ProductVersion> | ||
| <SchemaVersion>2.0</SchemaVersion> | ||
| <ProjectGuid>{775E686D-C646-4DAB-9DCF-D2C37FF8EA78}</ProjectGuid> | ||
| <OutputType>Library</OutputType> | ||
| <AppDesignerFolder>Properties</AppDesignerFolder> | ||
| <RootNamespace>Microsoft.NodejsTools.Telemetry</RootNamespace> | ||
| <AssemblyName>Microsoft.NodejsTools.InstallerTelemetryAction</AssemblyName> | ||
| <WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATargetsPath> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> | ||
| <PlatformTarget>AnyCPU</PlatformTarget> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Reference Include="System" /> | ||
| <Reference Include="System.Core" /> | ||
| <Reference Include="System.Web.Extensions" /> | ||
| <Reference Include="System.Xml.Linq" /> | ||
| <Reference Include="Microsoft.CSharp" /> | ||
| <Reference Include="System.Xml" /> | ||
| <Reference Include="Microsoft.Deployment.WindowsInstaller"> | ||
| <Private>True</Private> | ||
| </Reference> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <Compile Include="InstallerTelemetryAction.cs" /> | ||
| <Content Include="CustomAction.config" /> | ||
| </ItemGroup> | ||
| <Import Project="$(BuildRoot)\Build\Common.Build.CSharp.targets" /> | ||
| <Import Project="$(WixCATargetsPath)" /> | ||
| <Import Project="..\SetupProjectAfter.settings" /> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort usings - First System.*, then everything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks did that.