public static Task <string> GetNumberOfLogEntries(string severity, TimeSpan?timePeriod = null, string period = null) { string logLevel = $"customMetrics%2FSitecore.System%5CLogging%20%7C%20{severity}%20Logged%20%2F%20sec?aggregation=unique"; period = period ?? (timePeriod != null ? DateConversionUtil.ToInsightsTimespan(timePeriod.Value) : null); return(GetMetricValue(logLevel, period, json => json.value[$"customMetrics/Sitecore.System\\Logging | {severity} Logged / sec"].unique)); }
public async Task FailedRequestExceptionQuery(IDialogContext context, LuisResult result) { //Retrieve Count if it exists int count = 10; EntityRecommendation entity = result.Entities.FirstOrDefault(x => x.Type == "builtin.number"); if (entity != null) { int.TryParse(entity.Resolution?.Values.FirstOrDefault(), out count); } string query = string.Empty; var dateEntity = result.Entities.FirstOrDefault(x => x.Type.StartsWith(TimePeriodEntityPrefix)); if (dateEntity != null) { switch (dateEntity.Type) { case "builtin.datetime.duration": string queryTimeInterval = DateConversionUtil.ToInsightsQueryTimeInterval(dateEntity.Resolution.FirstOrDefault().Value); query = await AppInsightsService.GetFailedRequestExceptions(queryTimeInterval, count); break; case "builtin.datetime.date": string startDateTime = dateEntity.Resolution.FirstOrDefault().Value; DateTime dateTime; if (DateTime.TryParse(startDateTime, out dateTime)) { query = await AppInsightsService.GetFailedRequestExceptions(dateTime, count); } break; } } else { query = await AppInsightsService.GetFailedRequestExceptions(count : count); } var message = context.MakeMessage(); message.Text = query; message.TextFormat = "markdown"; await context.PostAsync(message); context.Wait(MessageReceived); }