|
4 | 4 | using System; |
5 | 5 | using System.Collections.Generic; |
6 | 6 | using System.Linq; |
7 | | -using System.Net; |
8 | 7 | using System.Net.Http; |
9 | 8 | using System.Security.Principal; |
10 | 9 | using System.Web; |
@@ -75,6 +74,8 @@ internal class Events |
75 | 74 | public const string SearchCircuitBreakerOnBreak = "SearchCircuitBreakerOnBreak"; |
76 | 75 | public const string SearchCircuitBreakerOnReset = "SearchCircuitBreakerOnReset"; |
77 | 76 | public const string SearchOnRetry = "SearchOnRetry"; |
| 77 | + public const string SearchSideBySideFeedback = "SearchSideBySideFeedback"; |
| 78 | + public const string SearchSideBySide = "SearchSideBySide"; |
78 | 79 | } |
79 | 80 |
|
80 | 81 | private IDiagnosticsSource _diagnosticsSource; |
@@ -176,6 +177,18 @@ internal class Events |
176 | 177 | public const string SearchPollyCorrelationId = "SearchPollyCorrelationId"; |
177 | 178 | public const string SearchCircuitBreakerStatus = "SearchCircuitBreakerStatus"; |
178 | 179 |
|
| 180 | + // Search side-by-side properties |
| 181 | + public const string SearchTerm = "SearchTerm"; |
| 182 | + public const string OldHits = "OldHits"; |
| 183 | + public const string OldSuccess = "OldSuccess"; |
| 184 | + public const string NewHits = "NewHits"; |
| 185 | + public const string NewSuccess = "NewSuccess"; |
| 186 | + public const string BetterSide = "BetterSide"; |
| 187 | + public const string MostRelevantPackage = "MostRelevantPackage"; |
| 188 | + public const string ExpectedPackages = "ExpectedPackages"; |
| 189 | + public const string HasComments = "HasComments"; |
| 190 | + public const string HasEmailAddress = "HasEmailAddress"; |
| 191 | + |
179 | 192 | public TelemetryService(IDiagnosticsService diagnosticsService, ITelemetryClient telemetryClient = null) |
180 | 193 | { |
181 | 194 | if (diagnosticsService == null) |
@@ -835,6 +848,45 @@ public void TrackMetricForSearchOnRetry(string searchName, Exception exception, |
835 | 848 | properties.Add(SearchCircuitBreakerStatus, circuitBreakerStatus); |
836 | 849 | }); |
837 | 850 | } |
| 851 | + |
| 852 | + public void TrackSearchSideBySideFeedback( |
| 853 | + string searchTerm, |
| 854 | + int oldHits, |
| 855 | + int newHits, |
| 856 | + string betterSide, |
| 857 | + string mostRelevantPackage, |
| 858 | + string expectedPackages, |
| 859 | + bool hasComments, |
| 860 | + bool hasEmailAddress) |
| 861 | + { |
| 862 | + TrackMetric(Events.SearchSideBySideFeedback, 1, properties => { |
| 863 | + properties.Add(SearchTerm, searchTerm); |
| 864 | + properties.Add(OldHits, oldHits.ToString()); |
| 865 | + properties.Add(NewHits, newHits.ToString()); |
| 866 | + properties.Add(BetterSide, betterSide); |
| 867 | + properties.Add(MostRelevantPackage, mostRelevantPackage); |
| 868 | + properties.Add(ExpectedPackages, expectedPackages); |
| 869 | + properties.Add(HasComments, hasComments.ToString()); |
| 870 | + properties.Add(HasEmailAddress, hasEmailAddress.ToString()); |
| 871 | + }); |
| 872 | + } |
| 873 | + |
| 874 | + public void TrackSearchSideBySide( |
| 875 | + string searchTerm, |
| 876 | + bool oldSuccess, |
| 877 | + int oldHits, |
| 878 | + bool newSuccess, |
| 879 | + int newHits) |
| 880 | + { |
| 881 | + TrackMetric(Events.SearchSideBySide, 1, properties => { |
| 882 | + properties.Add(SearchTerm, searchTerm); |
| 883 | + properties.Add(OldSuccess, oldSuccess.ToString()); |
| 884 | + properties.Add(OldHits, oldHits.ToString()); |
| 885 | + properties.Add(NewSuccess, newSuccess.ToString()); |
| 886 | + properties.Add(NewHits, newHits.ToString()); |
| 887 | + }); |
| 888 | + } |
| 889 | + |
838 | 890 | /// <summary> |
839 | 891 | /// We use <see cref="ITelemetryClient.TrackMetric(string, double, IDictionary{string, string})"/> instead of |
840 | 892 | /// <see cref="ITelemetryClient.TrackEvent(string, IDictionary{string, string}, IDictionary{string, double})"/> |
|
0 commit comments