Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public DiagnosticMeasurementValue(DiagnosticMeasurement measure)
 {
     if (measure == null)
     {
         throw new ArgumentNullException("measure");
     }
     this.measure = measure;
 }
Exemplo n.º 4
0
        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
                            });
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
 public override void OnLogLine(Dictionary <DiagnosticMeasurement, float?> countersAndValues, DateTime?timestamp = null)
 {
     foreach (KeyValuePair <string, DiagnosticMeasurement[]> keyValuePair in base.Instances)
     {
         string key = keyValuePair.Key;
         if (this.ShouldCalculateForInstance(key))
         {
             float?num  = countersAndValues[keyValuePair.Value[0]];
             float?num2 = countersAndValues[keyValuePair.Value[1]];
             DiagnosticMeasurement key2 = keyValuePair.Value[2];
             if (num2 != null && num != null)
             {
                 CounterValueHistory counterValueHistory = this.GetCounterValueHistory(key);
                 counterValueHistory.AddCounterValues(new float[]
                 {
                     num.Value,
                     num2.Value
                 });
                 DateTime dateTime = DateTime.UtcNow - this.timeRange;
                 float[]  array;
                 DateTime d;
                 if (!counterValueHistory.TryGetClosestCounterValues(dateTime, out array, out d) || Math.Abs((d - dateTime).TotalMinutes) > (double)this.counterValueMinuteGapAllowed)
                 {
                     break;
                 }
                 float num3 = 0f;
                 float num4 = 0f;
                 if (num.Value >= array[0] && num2.Value >= array[1])
                 {
                     num3 = array[0];
                     num4 = array[1];
                 }
                 float num5 = num.Value - num3;
                 float num6 = num2.Value - num4;
                 float num7 = num5 + num6;
                 if (num7 < (float)this.minimumProcessedCountNeeded)
                 {
                     break;
                 }
                 float value = 0f;
                 if (num7 > 0f)
                 {
                     value = num6 / num7 * 100f;
                 }
                 countersAndValues.Add(key2, new float?(value));
             }
         }
     }
 }
Exemplo n.º 6
0
 protected override bool ShouldMonitorCounter(DiagnosticMeasurement counter)
 {
     if (!base.ShouldMonitorCounter(counter))
     {
         return(false);
     }
     foreach (string value in base.ExcludedInstances)
     {
         if (counter.InstanceName.Contains(value))
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 7
0
        protected override string CollectAdditionalInformation(PerfLogCounterTrigger.SurpassedThresholdContext context)
        {
            StringBuilder         stringBuilder         = new StringBuilder();
            DiagnosticMeasurement diagnosticMeasurement = this.AdditionalDiagnosticMeasurement(context);
            ValueStatistics       valueStatistics;

            if (diagnosticMeasurement != null && context.AdditionalData.TryGetValue(diagnosticMeasurement, out valueStatistics))
            {
                string arg    = DiagnosticMeasurement.FormatMeasureName(diagnosticMeasurement.MachineName, diagnosticMeasurement.ObjectName, diagnosticMeasurement.CounterName, diagnosticMeasurement.InstanceName);
                string format = "Secondary performance counter '{0}' value is '{1}'";
                stringBuilder.AppendFormat(format, arg, valueStatistics.Last);
            }
            if (stringBuilder.Length != 0)
            {
                return(stringBuilder.ToString());
            }
            return(base.CollectAdditionalInformation(context));
        }
 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);
 }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 protected override void OutputDataInternal()
 {
     foreach (KeyValuePair <DiagnosticMeasurement, ValueStatistics> keyValuePair in base.CurrentValues)
     {
         DiagnosticMeasurement key   = keyValuePair.Key;
         ValueStatistics       value = keyValuePair.Value;
         if (value.SampleCount > 0 && !this.devices.Contains(key.MachineName))
         {
             MachineInformationSource.MachineInformation machineInformation = new MachineInformationSource.MachineInformation(key.MachineName, this.defaultInformation.ForestName, this.defaultInformation.SiteName, "LoadBalancer", this.defaultInformation.MaintenanceStatus, this.defaultInformation.MachineVersion);
             OutputStream outputStream = base.Job.GetOutputStream(this, "MachineInformation");
             string       text         = DateTimeUtils.Floor(DateTime.UtcNow, TimeSpan.FromMinutes(5.0)).ToString("O");
             outputStream.WriteLine("{0},{1}", new object[]
             {
                 text,
                 machineInformation.ToString()
             });
             this.devices.Add(key.MachineName);
         }
     }
     base.OutputDataInternal();
 }
        protected override bool ShouldTrigger(PerfLogCounterTrigger.SurpassedThresholdContext context)
        {
            bool flag  = false;
            bool flag2 = base.ShouldTrigger(context);

            if (flag2)
            {
                DiagnosticMeasurement diagnosticMeasurement = this.AdditionalDiagnosticMeasurement(context);
                ValueStatistics       valueStatistics;
                if (diagnosticMeasurement != null && context.AdditionalData.TryGetValue(diagnosticMeasurement, out valueStatistics))
                {
                    float? last = valueStatistics.Last;
                    double gatingCounterThreshold = base.GatingCounterThreshold;
                    if ((double)last.GetValueOrDefault() >= gatingCounterThreshold && last != null)
                    {
                        flag = true;
                    }
                }
            }
            return(flag2 && flag);
        }
 public override void OnLogLine(Dictionary <DiagnosticMeasurement, float?> countersAndValues, DateTime?timestamp)
 {
     if (!this.isEnabled)
     {
         return;
     }
     if (timestamp == null)
     {
         return;
     }
     foreach (KeyValuePair <string, DiagnosticMeasurement[]> keyValuePair in base.Instances)
     {
         float?num = countersAndValues[keyValuePair.Value[0]];
         DiagnosticMeasurement key = keyValuePair.Value[1];
         if (num != null && !"_total".Equals(keyValuePair.Key, StringComparison.OrdinalIgnoreCase) && Math.Abs((timestamp.Value - this.previousTimestamp).TotalMilliseconds) > 900.0)
         {
             float?value = new float?((float)((int)num.Value << (int)(timestamp.Value.Ticks % this.stepDuration.Ticks / this.perfSampleIntervalTickes)));
             countersAndValues.Add(key, value);
         }
     }
     this.previousTimestamp = timestamp.Value;
 }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        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));
 }
Exemplo n.º 16
0
 protected override DiagnosticMeasurement AdditionalDiagnosticMeasurement(PerfLogCounterTrigger.SurpassedThresholdContext context)
 {
     return(DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, BootloaderOutstandingItemsTrigger.GatingCounter.ObjectName, BootloaderOutstandingItemsTrigger.GatingCounter.CounterName, BootloaderOutstandingItemsTrigger.GatingCounter.InstanceName));
 }
Exemplo n.º 17
0
 private CASTriggerBase(IJob job, string counterNamePattern, CASTriggerBase.CasConfiguration configuration, HashSet <DiagnosticMeasurement> additionalCounters, DiagnosticMeasurement requestsPerSecondMeasurement) : base(job, counterNamePattern, additionalCounters, configuration)
 {
     this.requestsPerSecondMeasurement = requestsPerSecondMeasurement;
 }
Exemplo n.º 18
0
 protected CASTriggerBase(IJob job, string counterNamePattern, PerfLogCounterTrigger.TriggerConfiguration configuration, DiagnosticMeasurement requestsPerSecondMeasurement, double requestsPerSecondThreshold, HashSet <DiagnosticMeasurement> additionalCounters, HashSet <string> excludedInstances) : this(job, counterNamePattern, new CASTriggerBase.CasConfiguration(requestsPerSecondThreshold, configuration, excludedInstances), additionalCounters, requestsPerSecondMeasurement)
 {
 }
 protected override DiagnosticMeasurement AdditionalDiagnosticMeasurement(PerfLogCounterTrigger.SurpassedThresholdContext context)
 {
     return(DiagnosticMeasurement.GetMeasure(context.Counter.MachineName, E2ETransportLatencyHighTrigger.gatingCounter.ObjectName, E2ETransportLatencyHighTrigger.gatingCounter.CounterName, E2ETransportLatencyHighTrigger.gatingCounter.InstanceName));
 }