コード例 #1
0
        internal void DumpCounters()
        {
            List <ICounter> allCounters = new List <ICounter>();

            CounterStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            IntValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            StringValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            FloatValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            AverageTimeSpanStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);

            foreach (var stat in allCounters.Where(cs => cs.Storage != CounterStorage.DontStore).OrderBy(cs => cs.Name))
            {
                WriteStatsLogEntry(stat.GetDisplayString());
            }
            List <ICounter> additionalCounters = GenerateAdditionalCounters();

            // NOTE: For now, we don't want to bother logging these counters -- AG 11/20/2012
            foreach (var stat in additionalCounters.OrderBy(cs => cs.Name))
            {
                WriteStatsLogEntry(stat.GetDisplayString());
            }
            WriteStatsLogEntry(null); // Write any remaining log data

            // Reset current value for counter that have delta.
            // Do it ONLY after all counters have been logged.
            foreach (ICounter stat in allCounters.Where(cs => cs.Storage != CounterStorage.DontStore).Union(additionalCounters).Where(cs => cs.IsValueDelta))
            {
                stat.ResetCurrent();
            }
        }
コード例 #2
0
 public static bool TryFind(StatisticName name, out AverageTimeSpanStatistic result)
 {
     lock (classLock)
     {
         return(registeredStatistics.TryGetValue(name.Name, out result));
     }
 }
コード例 #3
0
 ThrowIfNotConsistent(
     AverageTimeSpanStatistic expected,
     StatisticName name,
     CounterStorage storage)
 {
     if (storage != expected.Storage)
     {
         throw new ArgumentException(
                   $"Please verity that all invocations of AverageTimeSpanStatistic.FindOrCreate() for instance \"{name.Name}\" all specify the same storage type {Enum.GetName(typeof(CounterStorage), expected.Storage)}",
                   nameof(storage));
     }
 }
コード例 #4
0
 internal static void Init()
 {
     StorageReadTotal      = CounterStatistic.FindOrCreate(StatisticNames.STORAGE_READ_TOTAL);
     StorageWriteTotal     = CounterStatistic.FindOrCreate(StatisticNames.STORAGE_WRITE_TOTAL);
     StorageActivateTotal  = CounterStatistic.FindOrCreate(StatisticNames.STORAGE_ACTIVATE_TOTAL);
     StorageReadErrors     = CounterStatistic.FindOrCreate(StatisticNames.STORAGE_READ_ERRORS);
     StorageWriteErrors    = CounterStatistic.FindOrCreate(StatisticNames.STORAGE_WRITE_ERRORS);
     StorageActivateErrors = CounterStatistic.FindOrCreate(StatisticNames.STORAGE_ACTIVATE_ERRORS);
     StorageReadLatency    = AverageTimeSpanStatistic.FindOrCreate(StatisticNames.STORAGE_READ_LATENCY);
     StorageWriteLatency   = AverageTimeSpanStatistic.FindOrCreate(StatisticNames.STORAGE_WRITE_LATENCY);
     StorageClearTotal     = CounterStatistic.FindOrCreate(StatisticNames.STORAGE_CLEAR_TOTAL);
     StorageClearErrors    = CounterStatistic.FindOrCreate(StatisticNames.STORAGE_CLEAR_ERRORS);
     StorageClearLatency   = AverageTimeSpanStatistic.FindOrCreate(StatisticNames.STORAGE_CLEAR_LATENCY);
 }
コード例 #5
0
ファイル: LogStatistics.cs プロジェクト: wattsm/orleans
        internal async Task DumpCounters()
        {
            List <ICounter> allCounters = new List <ICounter>();

            CounterStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            IntValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            StringValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            FloatValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            AverageTimeSpanStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);

            foreach (var stat in allCounters.Where(cs => cs.Storage != CounterStorage.DontStore).OrderBy(cs => cs.Name))
            {
                WriteStatsLogEntry(stat.GetDisplayString());
            }
            List <ICounter> additionalCounters = GenerateAdditionalCounters();

            // NOTE: For now, we don't want to bother logging these counters -- AG 11/20/2012
            foreach (var stat in additionalCounters.OrderBy(cs => cs.Name))
            {
                WriteStatsLogEntry(stat.GetDisplayString());
            }
            WriteStatsLogEntry(null); // Write any remaining log data

            try
            {
                if (StatsTablePublisher != null && allCounters.Count > 0)
                {
                    await StatsTablePublisher.ReportStats(allCounters);
                }
            }
            catch (Exception exc)
            {
                var e = exc.GetBaseException();
                logger.Error(ErrorCode.AzureTable_35, "Exception occurred during Stats reporter.", e);
            }

            // Reset current value for counter that have delta.
            // Do it ONLY after all counters have been logged.
            foreach (ICounter stat in allCounters.Where(cs => cs.Storage != CounterStorage.DontStore).Union(additionalCounters).Where(cs => cs.IsValueDelta))
            {
                stat.ResetCurrent();
            }
        }
コード例 #6
0
 FindOrCreate(
     StatisticName name,
     CounterStorage storage = CounterStorage.LogOnly)
 {
     lock (classLock)
     {
         AverageTimeSpanStatistic result;
         if (TryFind(name, out result))
         {
             ThrowIfNotConsistent(result, name, storage);
             return(result);
         }
         else
         {
             var newOb = new AverageTimeSpanStatistic(name.Name, storage);
             registeredStatistics[name.Name] = newOb;
             return(newOb);
         }
     }
 }
コード例 #7
0
        internal void DumpCounters()
        {
            List <ICounter> allCounters = new List <ICounter>();

            CounterStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            IntValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            StringValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            FloatValueStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);
            AverageTimeSpanStatistic.AddCounters(allCounters, cs => cs.Storage != CounterStorage.DontStore);

            foreach (var stat in allCounters.Where(cs => cs.Storage != CounterStorage.DontStore).OrderBy(cs => cs.Name))
            {
                WriteStatsLogEntry(stat.GetDisplayString());
            }
            WriteStatsLogEntry(null); // Write any remaining log data

            // Reset current value for counter that have delta.
            // Do it ONLY after all counters have been logged.
            foreach (ICounter stat in allCounters.Where(cs => cs.Storage != CounterStorage.DontStore).Where(cs => cs.IsValueDelta))
            {
                stat.ResetCurrent();
            }
        }