protected override bool ShouldTrigger(PerfLogCounterTrigger.SurpassedThresholdContext context) { bool result = false; bool flag = base.ShouldTrigger(context); if (flag) { DiagnosticMeasurement measure = DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, OAuthAcsTimeoutTrigger.totalOAuthAcsTimeoutRequests.ObjectName, OAuthAcsTimeoutTrigger.totalOAuthAcsTimeoutRequests.CounterName, context.Counter.InstanceName); ValueStatistics valueStatistics; if (context.AdditionalData.TryGetValue(measure, out valueStatistics)) { float?last = valueStatistics.Last; float?num = this.lastValueOfTotalOAuthAcsTimeoutRequests; float?num2 = (last != null & num != null) ? new float?(last.GetValueOrDefault() - num.GetValueOrDefault()) : null; float?num3 = num2; if (num3.GetValueOrDefault() > 5f && num3 != null) { float?num4 = this.lastValueOfTotalOAuthAcsTimeoutRequests; if (num4.GetValueOrDefault() != 0f || num4 == null) { result = true; } } this.lastValueOfTotalOAuthAcsTimeoutRequests = valueStatistics.Last; } } return(result); }
internal static Dictionary <MailboxDatabase, List <MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue> > CreateCounters(IEnumerable <MailboxDatabase> databases) { if (databases == null) { throw new ArgumentNullException("databases"); } Dictionary <MailboxDatabase, List <MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue> > dictionary = new Dictionary <MailboxDatabase, List <MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue> >(); Dictionary <string, MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue> dictionary2 = new Dictionary <string, MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue>(StringComparer.OrdinalIgnoreCase); foreach (MailboxDatabase mailboxDatabase in databases) { if (!dictionary.ContainsKey(mailboxDatabase)) { List <MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue> list = new List <MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue>(MailboxDatabaseCalculatedCounters.CounterNames.Count * 2); foreach (string text in MailboxDatabaseCalculatedCounters.CounterNames) { DiagnosticMeasurement measure = DiagnosticMeasurement.GetMeasure(Environment.MachineName, "MSExchangeIS Store", text, mailboxDatabase.Name); list.Add(new MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue(measure)); MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue diagnosticMeasurementValue; if (!dictionary2.TryGetValue(text, out diagnosticMeasurementValue)) { measure = DiagnosticMeasurement.GetMeasure(Environment.MachineName, "MSExchangeIS Store", text, "_Total"); diagnosticMeasurementValue = new MailboxDatabaseCalculatedCounters.DiagnosticMeasurementValue(measure); dictionary2.Add(text, diagnosticMeasurementValue); } list.Add(diagnosticMeasurementValue); } dictionary.Add(mailboxDatabase, list); } } return(dictionary); }
public void OnLogLine(Dictionary <DiagnosticMeasurement, float?> countersAndValues, DateTime?timestamp = null) { Dictionary <string, Dictionary <int, double> > dictionary; if (this.GetCurrentCounters(out dictionary)) { lock (this.dictLock) { foreach (KeyValuePair <string, Dictionary <int, double> > keyValuePair in dictionary) { HashSet <int> hashSet = new HashSet <int>(); try { foreach (KeyValuePair <int, double> keyValuePair2 in keyValuePair.Value) { string empty = string.Empty; if (this.perfLogExt.PidToProcessName.TryGetValue((float)keyValuePair2.Key, out empty)) { DiagnosticMeasurement measure = DiagnosticMeasurement.GetMeasure(Environment.MachineName, ".NET CLR Memory", keyValuePair.Key, empty); int num = PerfLogExtension.CounterRemapType(measure); if (num >= 0) { this.perfLogExt.RemapInstance[num].AddCounter(measure, new float?((float)keyValuePair2.Value)); } else { countersAndValues[measure] = new float?((float)keyValuePair2.Value); } } else { hashSet.Add(keyValuePair2.Key); } } this.perfLogExt.RemapInstance[1].Process(countersAndValues); double num2 = (from a in keyValuePair.Value select a.Value).Sum(); DiagnosticMeasurement measure2 = DiagnosticMeasurement.GetMeasure(Environment.MachineName, ".NET CLR Memory", keyValuePair.Key, "_Global_"); countersAndValues.Add(measure2, new float?((float)num2)); this.RemovePidsOnExit(hashSet); } catch (Exception ex) { Log.LogErrorMessage("ClrGCCalculatedCounter.OnLogLine failed due to exception {0}.", new object[] { ex }); } } } } }
protected override bool ShouldTrigger(PerfLogCounterTrigger.SurpassedThresholdContext context) { if (base.ShouldTrigger(context)) { int num = 0; float num2 = 0f; string text = null; List <MailboxDatabase> list = null; this.allDatabasesOnLocalServer = this.GetAllDatabasesOnLocalServer(); if (this.allDatabasesOnLocalServer != null) { if (!string.IsNullOrWhiteSpace(context.Counter.InstanceName)) { text = this.GetDatabaseNameFromInstanceName(context.Counter.InstanceName); } if (!string.IsNullOrEmpty(text)) { string databaseGroupFromName = this.GetDatabaseGroupFromName(text); list = this.PopulateDatabasesOnSameDisk(databaseGroupFromName); } if (list != null && list.Count > 0) { foreach (MailboxDatabase mailboxDatabase in list) { DiagnosticMeasurement measure = DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, DatabaseDiskReadLatencyTrigger.readsAverageLatency.ObjectName, DatabaseDiskReadLatencyTrigger.readsAverageLatency.CounterName, string.Format("Information Store - {0}/_Total", mailboxDatabase.Name)); ValueStatistics valueStatistics; if (context.AdditionalData.TryGetValue(measure, out valueStatistics)) { num2 += valueStatistics.Mean.Value; num++; } } if (num > 0 && (double)(num2 / (float)num) <= 250.0) { return(false); } } } return(true); } return(false); }
protected override bool ShouldTrigger(PerfLogCounterTrigger.SurpassedThresholdContext context) { bool flag = false; bool flag2 = base.ShouldTrigger(context); if (flag2) { DiagnosticMeasurement measure = DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, OAuthRequestFailureTrigger.totalOAuthRequests.ObjectName, OAuthRequestFailureTrigger.totalOAuthRequests.CounterName, context.Counter.InstanceName); DiagnosticMeasurement measure2 = DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, OAuthRequestFailureTrigger.totalOAuthFailedRequests.ObjectName, OAuthRequestFailureTrigger.totalOAuthFailedRequests.CounterName, context.Counter.InstanceName); ValueStatistics valueStatistics; ValueStatistics valueStatistics2; if (context.AdditionalData.TryGetValue(measure2, out valueStatistics) && context.AdditionalData.TryGetValue(measure, out valueStatistics2)) { float?last = valueStatistics.Last; float?num = this.lastValueOftotalOAuthFailedRequests; float?num2 = (last != null & num != null) ? new float?(last.GetValueOrDefault() - num.GetValueOrDefault()) : null; float?last2 = valueStatistics2.Last; float?num3 = this.lastValueOfTotalRequests; float?num4 = (last2 != null & num3 != null) ? new float?(last2.GetValueOrDefault() - num3.GetValueOrDefault()) : null; float?num5 = num2; if (num5.GetValueOrDefault() > 100f && num5 != null) { float?num6 = num4; if (num6.GetValueOrDefault() > 100f && num6 != null) { float?num7 = num2; float?num8 = num4; float?num9 = (num7 != null & num8 != null) ? new float?(num7.GetValueOrDefault() / num8.GetValueOrDefault()) : null; float?num10 = (num9 != null) ? new float?(num9.GetValueOrDefault() * 100f) : null; if (num10.GetValueOrDefault() > 20f && num10 != null) { flag = true; } } } this.lastValueOfTotalRequests = valueStatistics2.Last; this.lastValueOftotalOAuthFailedRequests = valueStatistics.Last; } } return(flag2 && flag); }
protected override bool ShouldTrigger(PerfLogCounterTrigger.SurpassedThresholdContext context) { bool flag = false; bool flag2 = base.ShouldTrigger(context); if (flag2) { DiagnosticMeasurement measure = DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, StoreRpcAverageLatencyTrigger.rpcOperationPerSecond.ObjectName, StoreRpcAverageLatencyTrigger.rpcOperationPerSecond.CounterName, context.Counter.InstanceName); ValueStatistics valueStatistics; if (context.AdditionalData.TryGetValue(measure, out valueStatistics)) { double rpcOperationPerSecondThreshold = ((StoreRpcAverageLatencyTrigger.MbxConfiguration)base.Configuration).RpcOperationPerSecondThreshold; float? last = valueStatistics.Last; double num = rpcOperationPerSecondThreshold; if ((double)last.GetValueOrDefault() >= num && last != null) { flag = true; } } } return(flag2 && flag); }
protected override bool ShouldTrigger(PerfLogCounterTrigger.SurpassedThresholdContext context) { bool flag = false; bool flag2 = base.ShouldTrigger(context); if (flag2) { DiagnosticMeasurement measure = DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, this.requestsPerSecondMeasurement.ObjectName, this.requestsPerSecondMeasurement.CounterName, context.Counter.InstanceName); ValueStatistics valueStatistics; if (context.AdditionalData.TryGetValue(measure, out valueStatistics)) { double requestsPerSecondThreshold = ((CASTriggerBase.CasConfiguration)base.Configuration).RequestsPerSecondThreshold; float? last = valueStatistics.Last; double num = requestsPerSecondThreshold; if ((double)last.GetValueOrDefault() >= num && last != null) { flag = true; } Log.LogInformationMessage("[CASTriggerBase.ShouldTrigger] Decision is {0} trigger, {1}/s {2} {3}/s for {4}", new object[] { flag ? "will" : "won't", valueStatistics.Last, flag ? ">=" : "<", requestsPerSecondThreshold, context.Counter.ToString() }); } else { Log.LogWarningMessage("[CASTriggerBase.ShouldTrigger] Couldn't find requests per second measurement for {0} (currentMeasurement = {1})", new object[] { context.Counter.ToString(), measure.ToString() }); } } return(flag2 && flag); }
protected override DiagnosticMeasurement AdditionalDiagnosticMeasurement(PerfLogCounterTrigger.SurpassedThresholdContext context) { return(DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, MessagesCompletingCategorizationTrigger.gatingCounter.ObjectName, MessagesCompletingCategorizationTrigger.gatingCounter.CounterName, MessagesCompletingCategorizationTrigger.gatingCounter.InstanceName)); }
protected override DiagnosticMeasurement AdditionalDiagnosticMeasurement(PerfLogCounterTrigger.SurpassedThresholdContext context) { return(DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, E2ETransportLatencyHighTrigger.gatingCounter.ObjectName, E2ETransportLatencyHighTrigger.gatingCounter.CounterName, E2ETransportLatencyHighTrigger.gatingCounter.InstanceName)); }
protected override DiagnosticMeasurement AdditionalDiagnosticMeasurement(PerfLogCounterTrigger.SurpassedThresholdContext context) { return(DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, BootloaderOutstandingItemsTrigger.GatingCounter.ObjectName, BootloaderOutstandingItemsTrigger.GatingCounter.CounterName, BootloaderOutstandingItemsTrigger.GatingCounter.InstanceName)); }