Exemplo n.º 1
0
 internal static void ParseStatistics(IStatisticsConfiguration config, XmlElement root, string nodeName)
 {
     if (root.HasAttribute("ProviderType"))
     {
         config.StatisticsProviderName = root.GetAttribute("ProviderType");
     }
     if (root.HasAttribute("MetricsTableWriteInterval"))
     {
         config.StatisticsMetricsTableWriteInterval = ParseTimeSpan(root.GetAttribute("MetricsTableWriteInterval"),
                                                                    "Invalid TimeSpan value for Statistics.MetricsTableWriteInterval attribute on Statistics element for " + nodeName);
     }
     if (root.HasAttribute("PerfCounterWriteInterval"))
     {
         config.StatisticsPerfCountersWriteInterval = ParseTimeSpan(root.GetAttribute("PerfCounterWriteInterval"),
                                                                    "Invalid TimeSpan value for Statistics.PerfCounterWriteInterval attribute on Statistics element for " + nodeName);
     }
     if (root.HasAttribute("LogWriteInterval"))
     {
         config.StatisticsLogWriteInterval = ParseTimeSpan(root.GetAttribute("LogWriteInterval"),
                                                           "Invalid TimeSpan value for Statistics.LogWriteInterval attribute on Statistics element for " + nodeName);
     }
     if (root.HasAttribute("WriteLogStatisticsToTable"))
     {
         config.StatisticsWriteLogStatisticsToTable = ParseBool(root.GetAttribute("WriteLogStatisticsToTable"),
                                                                "Invalid bool value for Statistics.WriteLogStatisticsToTable attribute on Statistics element for " + nodeName);
     }
     if (root.HasAttribute("StatisticsCollectionLevel"))
     {
         config.StatisticsCollectionLevel = ConfigUtilities.ParseEnum <StatisticsLevel>(root.GetAttribute("StatisticsCollectionLevel"),
                                                                                        "Invalid value of for Statistics.StatisticsCollectionLevel attribute on Statistics element for " + nodeName);
     }
 }
Exemplo n.º 2
0
 internal static void CopyStatisticsOptions(IStatisticsConfiguration configuration, StatisticsOptions options)
 {
     options.MetricsTableWriteInterval = configuration.StatisticsMetricsTableWriteInterval;
     options.PerfCountersWriteInterval = configuration.StatisticsPerfCountersWriteInterval;
     options.LogWriteInterval          = configuration.StatisticsLogWriteInterval;
     options.WriteLogStatisticsToTable = configuration.StatisticsWriteLogStatisticsToTable;
     options.CollectionLevel           = configuration.StatisticsCollectionLevel;
 }
Exemplo n.º 3
0
        private static bool ShouldUseExternalMetricsProvider(
            Silo silo,
            IStatisticsConfiguration nodeConfig,
            out bool useAzureTable)
        {
            useAzureTable = silo.GlobalConfig.LivenessType == GlobalConfiguration.LivenessProviderType.AzureTable &&
                            !string.IsNullOrEmpty(silo.GlobalConfig.DeploymentId) &&
                            !string.IsNullOrEmpty(silo.GlobalConfig.DataConnectionString);

            return(!string.IsNullOrEmpty(nodeConfig.StatisticsProviderName));
        }
Exemplo n.º 4
0
        internal static string IStatisticsConfigurationToString(IStatisticsConfiguration config)
        {
            var sb = new StringBuilder();

            sb.Append("   Statistics: ").AppendLine();
            sb.Append("     PerfCounterWriteInterval: ").Append(config.StatisticsPerfCountersWriteInterval).AppendLine();
            sb.Append("     LogWriteInterval: ").Append(config.StatisticsLogWriteInterval).AppendLine();
            sb.Append("     StatisticsCollectionLevel: ").Append(config.StatisticsCollectionLevel).AppendLine();

            return(sb.ToString());
        }
Exemplo n.º 5
0
        private bool ShouldUseExternalMetricsProvider(
            Silo silo,
            IStatisticsConfiguration nodeConfig,
            out bool useAzureTable)
        {
            // TODO: use DI to configure this and don't rely on GlobalConfiguration nor NodeConfiguration
            useAzureTable = silo.GlobalConfig.LivenessType == GlobalConfiguration.LivenessProviderType.AzureTable &&
                            !string.IsNullOrEmpty(this.siloOptions.ClusterId) &&
                            !string.IsNullOrEmpty(silo.GlobalConfig.DataConnectionString);

            return(!string.IsNullOrEmpty(nodeConfig.StatisticsProviderName));
        }
Exemplo n.º 6
0
        internal static string IStatisticsConfigurationToString(IStatisticsConfiguration config)
        {
            var sb = new StringBuilder();

            sb.Append("   Statistics: ").AppendLine();
            sb.Append("     PerfCounterWriteInterval: ").Append(config.StatisticsPerfCountersWriteInterval).AppendLine();
            sb.Append("     LogWriteInterval: ").Append(config.StatisticsLogWriteInterval).AppendLine();
            sb.Append("     StatisticsCollectionLevel: ").Append(config.StatisticsCollectionLevel).AppendLine();
#if TRACK_DETAILED_STATS
            sb.Append("     TRACK_DETAILED_STATS: true").AppendLine();
#endif
            return(sb.ToString());
        }
Exemplo n.º 7
0
 internal static void ParseStatistics(IStatisticsConfiguration config, XmlElement root, string nodeName)
 {
     if (root.HasAttribute("PerfCounterWriteInterval"))
     {
         config.StatisticsPerfCountersWriteInterval = ParseTimeSpan(root.GetAttribute("PerfCounterWriteInterval"),
                                                                    "Invalid TimeSpan value for Statistics.PerfCounterWriteInterval attribute on Statistics element for " + nodeName);
     }
     if (root.HasAttribute("LogWriteInterval"))
     {
         config.StatisticsLogWriteInterval = ParseTimeSpan(root.GetAttribute("LogWriteInterval"),
                                                           "Invalid TimeSpan value for Statistics.LogWriteInterval attribute on Statistics element for " + nodeName);
     }
     if (root.HasAttribute("StatisticsCollectionLevel"))
     {
         config.StatisticsCollectionLevel = ConfigUtilities.ParseEnum <StatisticsLevel>(root.GetAttribute("StatisticsCollectionLevel"),
                                                                                        "Invalid value of for Statistics.StatisticsCollectionLevel attribute on Statistics element for " + nodeName);
     }
 }
Exemplo n.º 8
0
        internal static string IStatisticsConfigurationToString(IStatisticsConfiguration config)
        {
            var sb = new StringBuilder();

            sb.Append("   Statistics: ").AppendLine();
            sb.Append("     MetricsTableWriteInterval: ").Append(config.StatisticsMetricsTableWriteInterval).AppendLine();
            sb.Append("     PerfCounterWriteInterval: ").Append(config.StatisticsPerfCountersWriteInterval).AppendLine();
            sb.Append("     LogWriteInterval: ").Append(config.StatisticsLogWriteInterval).AppendLine();
            sb.Append("     WriteLogStatisticsToTable: ").Append(config.StatisticsWriteLogStatisticsToTable).AppendLine();
            sb.Append("     StatisticsCollectionLevel: ").Append(config.StatisticsCollectionLevel).AppendLine();
#if TRACK_DETAILED_STATS
            sb.Append("     TRACK_DETAILED_STATS: true").AppendLine();
#endif
            if (!string.IsNullOrEmpty(config.StatisticsProviderName))
            {
                sb.Append("     StatisticsProviderName:").Append(config.StatisticsProviderName).AppendLine();
            }
            return(sb.ToString());
        }
Exemplo n.º 9
0
 public static void Initialize(IStatisticsConfiguration config)
 {
     StatisticsCollectionLevel = config.StatisticsCollectionLevel;
 }
Exemplo n.º 10
0
 internal ClientStatisticsManager(IStatisticsConfiguration config)
 {
     runtimeStats  = new RuntimeStatisticsGroup();
     logStatistics = new LogStatistics(config.StatisticsLogWriteInterval, false);
 }
Exemplo n.º 11
0
 internal ClientStatisticsManager(IStatisticsConfiguration config)
 {
     runtimeStats = new RuntimeStatisticsGroup();
     logStatistics = new LogStatistics(config.StatisticsLogWriteInterval, false);
     logger = TraceLogger.GetLogger(GetType().Name);
 }
Exemplo n.º 12
0
        private static bool ShouldUseExternalMetricsProvider(
            Silo silo,
            IStatisticsConfiguration nodeConfig,
            out bool useAzureTable)
        {
            useAzureTable = silo.GlobalConfig.LivenessType == GlobalConfiguration.LivenessProviderType.AzureTable
                                 && !string.IsNullOrEmpty(silo.GlobalConfig.DeploymentId)
                                 && !string.IsNullOrEmpty(silo.GlobalConfig.DataConnectionString);

            return !string.IsNullOrEmpty(nodeConfig.StatisticsProviderName);
        }
Exemplo n.º 13
0
 public static void Initialize(IStatisticsConfiguration config)
 {
     StatisticsCollectionLevel = config.StatisticsCollectionLevel;
 }
Exemplo n.º 14
0
 internal ClientStatisticsManager(IStatisticsConfiguration config)
 {
     runtimeStats  = new RuntimeStatisticsGroup();
     logStatistics = new LogStatistics(config.StatisticsLogWriteInterval, false);
     logger        = TraceLogger.GetLogger(GetType().Name);
 }