/// <summary> /// Sends the telemetry with the suggestion returned to the user. /// </summary> private void SendTelemetry(GetSuggestionTelemetryData telemetryData) { var suggestions = telemetryData.Suggestion?.PredictiveSuggestions; var suggestionSource = telemetryData.Suggestion?.SuggestionSources; var sourceTexts = telemetryData.Suggestion?.SourceTexts; var maskedUserInput = CommandLineUtilities.MaskCommandLine(telemetryData.UserInput?.FindAll((ast) => ast is CommandAst, true).LastOrDefault() as CommandAst); if ((suggestions != null) && (sourceTexts != null)) { for (int i = 0; i < suggestions.Count; ++i) { _userAcceptedAndSuggestion[suggestions[i].SuggestionText] = sourceTexts[i]; } } var properties = CreateProperties(telemetryData); properties.Add("ClientId", telemetryData.ClientId); properties.Add("SuggestionSessionId", telemetryData != null ? telemetryData.SuggestionSessionId.ToString(CultureInfo.InvariantCulture) : string.Empty); properties.Add("UserInput", maskedUserInput ?? string.Empty); properties.Add("Suggestion", sourceTexts != null ? JsonSerializer.Serialize(sourceTexts.Zip(suggestionSource).Select((s) => Tuple.Create(s.First, s.Second)), JsonUtilities.TelemetrySerializerOptions) : string.Empty); properties.Add("IsCancelled", telemetryData.IsCancellationRequested.ToString(CultureInfo.InvariantCulture)); properties.Add("Exception", AzPredictorTelemetryClient.FormatException(telemetryData.Exception)); SendTelemetry($"{AzPredictorTelemetryClient.TelemetryEventPrefix}/GetSuggestion", properties); }
/// <summary> /// Sends the telemetry with the parameter map file loading information. /// </summary> private void SendTelemetry(ParameterMapTelemetryData telemetryData) { var properties = CreateProperties(telemetryData); properties.Add("Exception", AzPredictorTelemetryClient.FormatException(telemetryData.Exception)); SendTelemetry($"{AzPredictorTelemetryClient.TelemetryEventPrefix}/LoadParameterMap", properties); }
/// <summary> /// Sends the telemetry with the command line parsing information. /// </summary> private void SendTelemetry(CommandLineParsingTelemetryData telemetryData) { var properties = CreateProperties(telemetryData, client: null); properties.Add("Exception", AzPredictorTelemetryClient.FormatException(telemetryData.Exception)); properties.Add("Command", telemetryData.Command); SendTelemetry($"{TelemetryUtilities.TelemetryEventPrefix}/ParseCommandLineFailure", properties); }
/// <summary> /// Sends the telemetry with the commands for prediction. /// </summary> private void SendTelemetry(RequestPredictionTelemetryData telemetryData) { _userAcceptedAndSuggestion.Clear(); var properties = CreateProperties(telemetryData); properties.Add("Command", telemetryData.Commands ?? string.Empty); properties.Add("HttpRequestSent", telemetryData.HasSentHttpRequest.ToString(CultureInfo.InvariantCulture)); properties.Add("Exception", AzPredictorTelemetryClient.FormatException(telemetryData.Exception)); _telemetryClient.TrackEvent($"{AzPredictorTelemetryClient.TelemetryEventPrefix}/RequestPrediction", properties); }
/// <summary> /// Sends the telemetry with the commands for prediction. /// </summary> private void SendTelemetry(RequestPredictionTelemetryData telemetryData) { _userAcceptedAndSuggestion.Clear(); var properties = CreateProperties(telemetryData, telemetryData.Client); properties.Add("Command", telemetryData.Commands == null ? string.Empty : string.Join(AzPredictorConstants.CommandConcatenator, telemetryData.Commands)); properties.Add("HttpRequestSent", telemetryData.HasSentHttpRequest.ToString(CultureInfo.InvariantCulture)); properties.Add("Exception", AzPredictorTelemetryClient.FormatException(telemetryData.Exception)); SendTelemetry($"{TelemetryUtilities.TelemetryEventPrefix}/RequestPrediction", properties); }