internal ClientTableStatistics(IMessageCenter mc, IClientMetricsDataPublisher metricsDataPublisher, RuntimeStatisticsGroup runtime) { this.mc = mc; this.metricsDataPublisher = metricsDataPublisher; runtimeStats = runtime; reportFrequency = TimeSpan.Zero; connectedGatewayCount = IntValueStatistic.Find(StatisticNames.CLIENT_CONNECTED_GATEWAY_COUNT); }
internal ClientTableStatistics(IMessageCenter mc, IClientMetricsDataPublisher metricsDataPublisher, RuntimeStatisticsGroup runtime) { this.mc = mc; this.metricsDataPublisher = metricsDataPublisher; runtimeStats = runtime; reportFrequency = TimeSpan.Zero; connectedGatewayCount = IntValueStatistic.Find(StatisticNames.CLIENT_CONNECTED_GATEWAY_COUNT); }
internal ClientTableStatistics(IMessageCenter mc, IClientMetricsDataPublisher metricsDataPublisher, RuntimeStatisticsGroup runtime, ILoggerFactory loggerFactory) { this.mc = mc; this.metricsDataPublisher = metricsDataPublisher; this.logger = loggerFactory.CreateLogger <ClientTableStatistics>(); //async timer created through current class all share this logger for perf reasons this.timerLogger = loggerFactory.CreateLogger <AsyncTaskSafeTimer>(); runtimeStats = runtime; reportFrequency = TimeSpan.Zero; connectedGatewayCount = IntValueStatistic.Find(StatisticNames.CLIENT_CONNECTED_GATEWAY_COUNT); }
internal async Task Start(IMessageCenter transport, GrainId clientId) { IClientMetricsDataPublisher metricsDataPublisher = this.serviceProvider.GetService <IClientMetricsDataPublisher>(); if (metricsDataPublisher != null) { var configurableMetricsDataPublisher = metricsDataPublisher as IConfigurableClientMetricsDataPublisher; if (configurableMetricsDataPublisher != null) { configurableMetricsDataPublisher.AddConfiguration( this.clusterClientOptions.ClusterId, config.DNSHostName, clientId.ToString(), transport.MyAddress.Endpoint.Address); } tableStatistics = new ClientTableStatistics(transport, metricsDataPublisher, this.hostEnvironmentStatistics, this.appEnvironmentStatistics, this.loggerFactory) { MetricsTableWriteInterval = statisticsOptions.MetricsTableWriteInterval }; } else if (config.UseAzureSystemStore) { // Hook up to publish client metrics to Azure storage table var publisher = AssemblyLoader.LoadAndCreateInstance <IClientMetricsDataPublisher>(Constants.ORLEANS_STATISTICS_AZURESTORAGE, logger, this.serviceProvider); await publisher.Init(config, transport.MyAddress.Endpoint.Address, clientId.ToParsableString()); tableStatistics = new ClientTableStatistics(transport, publisher, this.hostEnvironmentStatistics, this.appEnvironmentStatistics, this.loggerFactory) { MetricsTableWriteInterval = statisticsOptions.MetricsTableWriteInterval }; } // Configure Statistics if (statisticsOptions.WriteLogStatisticsToTable) { IStatisticsPublisher statsProvider = this.serviceProvider.GetService <IStatisticsPublisher>(); if (statsProvider != null) { logStatistics.StatsTablePublisher = statsProvider; // Note: Provider has already been Init-ialized above. } else if (config.UseAzureSystemStore) { var statsDataPublisher = AssemblyLoader.LoadAndCreateInstance <IStatisticsPublisher>(Constants.ORLEANS_STATISTICS_AZURESTORAGE, logger, this.serviceProvider); await statsDataPublisher.Init(false, config.DataConnectionString, this.clusterClientOptions.ClusterId, transport.MyAddress.Endpoint.ToString(), clientId.ToParsableString(), config.DNSHostName); logStatistics.StatsTablePublisher = statsDataPublisher; } } logStatistics.Start(); }