Пример #1
0
 public ClientStatisticsManager(
     ILoggerFactory loggerFactory,
     IOptions <StatisticsOptions> statisticsOptions)
 {
     this.logStatistics = new LogStatistics(statisticsOptions.Value.LogWriteInterval, false, loggerFactory);
     MessagingStatisticsGroup.Init();
     NetworkingStatisticsGroup.Init();
 }
Пример #2
0
 public ClientStatisticsManager(
     SerializationStatisticsGroup serializationStatistics,
     ILoggerFactory loggerFactory,
     IOptions <StatisticsOptions> statisticsOptions)
 {
     this.statisticsOptions = statisticsOptions.Value;
     this.logStatistics     = new LogStatistics(this.statisticsOptions.LogWriteInterval, false, serializationStatistics, loggerFactory);
     MessagingStatisticsGroup.Init(false);
     NetworkingStatisticsGroup.Init(false);
 }
Пример #3
0
        internal ClientStatisticsManager(ClientConfiguration config)
        {
            this.config   = config;
            runtimeStats  = new RuntimeStatisticsGroup();
            logStatistics = new LogStatistics(config.StatisticsLogWriteInterval, false);
            logger        = LogManager.GetLogger(GetType().Name);

            MessagingStatisticsGroup.Init(false);
            NetworkingStatisticsGroup.Init(false);
            ApplicationRequestsStatisticsGroup.Init(config.ResponseTimeout);
        }
Пример #4
0
 public ClientStatisticsManager(ClientConfiguration config, SerializationManager serializationManager, IServiceProvider serviceProvider, ILoggerFactory loggerFactory)
 {
     this.config          = config;
     this.serviceProvider = serviceProvider;
     runtimeStats         = new RuntimeStatisticsGroup(loggerFactory);
     logStatistics        = new LogStatistics(config.StatisticsLogWriteInterval, false, serializationManager, loggerFactory);
     logger             = new LoggerWrapper <ClientStatisticsManager>(loggerFactory);
     this.loggerFactory = loggerFactory;
     MessagingStatisticsGroup.Init(false);
     NetworkingStatisticsGroup.Init(false);
     ApplicationRequestsStatisticsGroup.Init(config.ResponseTimeout);
 }
Пример #5
0
        public ClientStatisticsManager(ClientConfiguration config, SerializationManager serializationManager, IServiceProvider serviceProvider)
        {
            this.config          = config;
            this.serviceProvider = serviceProvider;
            runtimeStats         = new RuntimeStatisticsGroup();
            logStatistics        = new LogStatistics(config.StatisticsLogWriteInterval, false, serializationManager);
            logger = LogManager.GetLogger(GetType().Name);

            MessagingStatisticsGroup.Init(false);
            NetworkingStatisticsGroup.Init(false);
            ApplicationRequestsStatisticsGroup.Init(config.ResponseTimeout);
        }
Пример #6
0
 public ClientStatisticsManager(ClientConfiguration config, SerializationManager serializationManager, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, IOptions <StatisticsOptions> statisticsOptions, IOptions <ClusterClientOptions> clusterClientOptions)
 {
     this.config               = config;
     this.statisticsOptions    = statisticsOptions.Value;
     this.serviceProvider      = serviceProvider;
     this.clusterClientOptions = clusterClientOptions.Value;
     runtimeStats              = new RuntimeStatisticsGroup(loggerFactory);
     logStatistics             = new LogStatistics(this.statisticsOptions.LogWriteInterval, false, serializationManager, loggerFactory);
     logger             = loggerFactory.CreateLogger <ClientStatisticsManager>();
     this.loggerFactory = loggerFactory;
     MessagingStatisticsGroup.Init(false);
     NetworkingStatisticsGroup.Init(false);
     ApplicationRequestsStatisticsGroup.Init(config.ResponseTimeout);
 }
Пример #7
0
 public ClientStatisticsManager(
     IOptions <MonitoringStorageOptions> storageOptions,
     SerializationManager serializationManager,
     IServiceProvider serviceProvider,
     ILoggerFactory loggerFactory,
     IOptions <ClientStatisticsOptions> statisticsOptions,
     IOptions <ClusterClientOptions> clusterClientOptions)
 {
     this.statisticsOptions    = statisticsOptions.Value;
     this.storageOptions       = storageOptions.Value;
     this.serviceProvider      = serviceProvider;
     this.clusterClientOptions = clusterClientOptions.Value;
     logStatistics             = new LogStatistics(this.statisticsOptions.LogWriteInterval, false, serializationManager, loggerFactory);
     logger = loggerFactory.CreateLogger <ClientStatisticsManager>();
     MessagingStatisticsGroup.Init(false);
     NetworkingStatisticsGroup.Init(false);
     ApplicationRequestsStatisticsGroup.Init();
     this.dnsHostName = Dns.GetHostName();
 }
Пример #8
0
        internal async Task Start(ClientConfiguration config, StatisticsProviderManager statsManager, IMessageCenter transport, Guid clientId)
        {
            MessagingStatisticsGroup.Init(false);
            NetworkingStatisticsGroup.Init(false);
            ApplicationRequestsStatisticsGroup.Init(config.ResponseTimeout);

            runtimeStats.Start();

            // Configure Metrics
            IProvider statsProvider = null;

            if (!string.IsNullOrEmpty(config.StatisticsProviderName))
            {
                var extType = config.StatisticsProviderName;
                statsProvider = statsManager.GetProvider(extType);
                var metricsDataPublisher = statsProvider as IClientMetricsDataPublisher;
                if (metricsDataPublisher == null)
                {
                    var msg = String.Format("Trying to create {0} as a metrics publisher, but the provider is not configured."
                                            , extType);
                    throw new ArgumentException(msg, "ProviderType (configuration)");
                }
                var configurableMetricsDataPublisher = metricsDataPublisher as IConfigurableClientMetricsDataPublisher;
                if (configurableMetricsDataPublisher != null)
                {
                    configurableMetricsDataPublisher.AddConfiguration(
                        config.DeploymentId, config.DNSHostName, clientId.ToString(), transport.MyAddress.Endpoint.Address);
                }
                tableStatistics = new ClientTableStatistics(transport, metricsDataPublisher, runtimeStats)
                {
                    MetricsTableWriteInterval = config.StatisticsMetricsTableWriteInterval
                };
            }
            else if (config.UseAzureSystemStore)
            {
                // Hook up to publish client metrics to Azure storage table
                var publisher = await ClientMetricsTableDataManager.GetManager(config, transport.MyAddress.Endpoint.Address, clientId);

                tableStatistics = new ClientTableStatistics(transport, publisher, runtimeStats)
                {
                    MetricsTableWriteInterval = config.StatisticsMetricsTableWriteInterval
                };
            }

            // Configure Statistics
            if (config.StatisticsWriteLogStatisticsToTable)
            {
                if (statsProvider != null)
                {
                    logStatistics.StatsTablePublisher = statsProvider as IStatisticsPublisher;
                    // Note: Provider has already been Init-ialized above.
                }
                else if (config.UseAzureSystemStore)
                {
                    var statsDataPublisher = await StatsTableDataManager.GetManager(false, config.DataConnectionString, config.DeploymentId, transport.MyAddress.Endpoint.ToString(), clientId.ToString(), config.DNSHostName);

                    logStatistics.StatsTablePublisher = statsDataPublisher;
                }
            }
            logStatistics.Start();
        }