File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 1414using System . Threading . Tasks ;
1515using System . Web . Script . Serialization ;
1616using System . Windows . Forms ;
17+ using Microsoft . NodejsTools . Telemetry ;
1718using Microsoft . VisualStudio . Shell ;
1819using Microsoft . VisualStudio . Text ;
1920
@@ -27,6 +28,8 @@ internal sealed class NodejsReplEvaluator : IReplEvaluator
2728 private readonly INodejsReplSite _site ;
2829 internal static readonly object InputBeforeReset = new object ( ) ; // used to mark buffers which are no longer valid because we've done a reset
2930
31+ private static bool LoggedReplUse = false ;
32+
3033 public NodejsReplEvaluator ( )
3134 : this ( VsNodejsReplSite . Site )
3235 {
@@ -93,6 +96,14 @@ public Task<ExecutionResult> ExecuteText(string text)
9396 return ExecutionResult . Failed ;
9497 }
9598
99+ if ( ! LoggedReplUse )
100+ {
101+ // we only want to log the first time each session,
102+ // and not flood the telemetry with every command.
103+ TelemetryHelper . LogReplUse ( ) ;
104+ LoggedReplUse = true ;
105+ }
106+
96107 return this . _listener . ExecuteText ( text ) ;
97108 }
98109
Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ internal static class TelemetryEvents
3333 /// User uninstalled package.
3434 /// </summary>
3535 public const string UnInstallNpm = Prefix + "UnInstallNpm" ;
36+
37+ /// <summary>
38+ /// User executed some script in the interactive window.
39+ /// </summary>
40+ public const string UsedRepl = Prefix + "UsedRepl" ;
3641 }
3742
3843 internal static class TelemetryProperties
Original file line number Diff line number Diff line change @@ -62,13 +62,9 @@ public static void LogUnInstallNpmPackage(string packageName)
6262 defaultSession . PostEvent ( userTask ) ;
6363 }
6464
65- public static void LogUpdateNpmPackage ( string packageName , string version )
65+ internal static void LogReplUse ( )
6666 {
67- var userTask = new UserTaskEvent ( UpdateNpm , TelemetryResult . Success ) ;
68- userTask . Properties [ NpmPackageName ] = packageName ;
69- userTask . Properties [ NpmPackageVersion ] = version ;
70-
71- defaultSession . PostEvent ( userTask ) ;
67+ defaultSession . PostUserTask ( UsedRepl , TelemetryResult . Success ) ;
7268 }
7369 }
7470}
You can’t perform that action at this time.
0 commit comments