コード例 #1
0
        public virtual void ResetMetrics(out Dictionary <string, decimal> metrics, out List <string> logs)
        {
            metrics = null;
            logs    = null;
            try
            {
                lock (SyncLock)
                {
                    metrics = this.Generator.Metrics;
                    logs    = this.Generator.Logs;

                    HealthReportGenerator extractGenerator = new HealthReportGenerator(this.IFoundation, logs, metrics);
                    foreach (var item in this.Extractors)
                    {
                        try
                        {
                            item.ExtractHealthMetrics(extractGenerator);
                        }
                        catch
                        {
                            //gulp
                        }
                    }

                    this.Generator = new HealthReportGenerator(this.IFoundation, new List <string>(), new Dictionary <string, decimal>());
                }
            }
            catch (Exception ex)
            {
                base.IFoundation.LogError(ex, "ResetMetrics");
            }
        }
コード例 #2
0
 public void ExtractHealthMetrics(HealthReportGenerator generator)
 {
     try
     {
         // extract cache size
         using (Process process = Process.GetCurrentProcess())
         {
             process.Refresh();
             int mbMemory = (int)((process.WorkingSet64 / 1024m) / 1024m);
             generator.UpdateMetric(HealthTrackType.Count, string.Format(HealthReporter.SERVER_MEMORY_SIZE, "private"), 0, mbMemory);
         }
     }
     catch (Exception ex)
     {
         this.IFoundation.LogError(ex, "ExtractHealthMetrics");
     }
 }