public ApplicationInfoProvider(
     IVostokApplicationIdentity identity,
     IVostokApplicationLimits limits,
     Func <IVostokApplicationReplicationInfo> replication)
 {
     this.identity    = identity;
     this.limits      = limits;
     this.replication = replication;
 }
        internal VostokHostingEnvironment(
            [NotNull] HostingShutdown hostingShutdown,
            [NotNull] ApplicationShutdown applicationShutdown,
            [NotNull] IVostokApplicationIdentity applicationIdentity,
            [NotNull] IVostokApplicationLimits applicationLimits,
            [NotNull] Func <IVostokApplicationReplicationInfo> replicationInfoProvider,
            [NotNull] IVostokApplicationMetrics metrics,
            [NotNull] IVostokApplicationDiagnostics diagnostics,
            [NotNull] ILog log,
            [NotNull] ITracer tracer,
            [NotNull] IHerculesSink herculesSink,
            [NotNull] IConfigurationSource configurationSource,
            [NotNull] IConfigurationSource secretConfigurationSource,
            [NotNull] IConfigurationProvider configurationProvider,
            [NotNull] IConfigurationProvider secretConfigurationProvider,
            [NotNull] IClusterConfigClient clusterConfigClient,
            [NotNull] IServiceBeacon serviceBeacon,
            [CanBeNull] int?port,
            [NotNull] IServiceLocator serviceLocator,
            [NotNull] IContextGlobals contextGlobals,
            [NotNull] IContextProperties contextProperties,
            [NotNull] IContextConfiguration contextConfiguration,
            [NotNull] IDatacenters datacenters,
            [NotNull] IVostokHostExtensions hostExtensions,
            [NotNull] Action onDispose)
        {
            this.hostingShutdown         = hostingShutdown ?? throw new ArgumentNullException(nameof(hostingShutdown));
            this.applicationShutdown     = applicationShutdown ?? throw new ArgumentNullException(nameof(applicationShutdown));
            this.replicationInfoProvider = replicationInfoProvider ?? throw new ArgumentNullException(nameof(replicationInfoProvider));
            this.onDispose = onDispose ?? throw new ArgumentNullException(nameof(onDispose));

            ApplicationIdentity = applicationIdentity ?? throw new ArgumentNullException(nameof(applicationIdentity));
            ApplicationLimits   = applicationLimits ?? throw new ArgumentNullException(nameof(applicationLimits));
            Metrics             = metrics ?? throw new ArgumentNullException(nameof(metrics));
            Diagnostics         = diagnostics ?? throw new ArgumentNullException(nameof(diagnostics));
            Log                         = log ?? throw new ArgumentNullException(nameof(log));
            Tracer                      = tracer ?? throw new ArgumentNullException(nameof(tracer));
            HerculesSink                = herculesSink ?? throw new ArgumentNullException(nameof(herculesSink));
            ConfigurationSource         = configurationSource ?? throw new ArgumentNullException(nameof(configurationSource));
            ConfigurationProvider       = configurationProvider ?? throw new ArgumentNullException(nameof(configurationProvider));
            SecretConfigurationSource   = secretConfigurationSource ?? throw new ArgumentNullException(nameof(secretConfigurationSource));
            SecretConfigurationProvider = secretConfigurationProvider ?? throw new ArgumentNullException(nameof(secretConfigurationProvider));
            ClusterConfigClient         = clusterConfigClient ?? throw new ArgumentNullException(nameof(clusterConfigClient));
            ServiceBeacon               = serviceBeacon ?? throw new ArgumentNullException(nameof(serviceBeacon));
            Port                        = port;
            ServiceLocator              = serviceLocator ?? throw new ArgumentNullException(nameof(serviceLocator));
            ContextGlobals              = contextGlobals ?? throw new ArgumentNullException(nameof(contextGlobals));
            ContextProperties           = contextProperties ?? throw new ArgumentNullException(nameof(contextProperties));
            ContextConfiguration        = contextConfiguration ?? throw new ArgumentNullException(nameof(contextConfiguration));
            Datacenters                 = datacenters ?? throw new ArgumentNullException(nameof(datacenters));
            HostExtensions              = hostExtensions ?? throw new ArgumentNullException(nameof(hostExtensions));
        }
Beispiel #3
0
        public DynamicThreadPoolTracker(
            Func <IConfigurationProvider, ThreadPoolSettings> settingsProvider,
            IConfigurationProvider configProvider,
            IVostokApplicationLimits limits,
            ILog log)
        {
            this.log              = log.ForContext <DynamicThreadPoolTracker>();
            this.configProvider   = configProvider;
            applicationLimits     = limits;
            this.settingsProvider = settingsProvider ?? throw new ArgumentNullException(nameof(settingsProvider));

            threadPoolUpdate = new PeriodicalAction(CheckAndUpdate, LogOnException, () => ChecksPeriod);
            threadPoolUpdate.Start();
        }
Beispiel #4
0
 private void LogApplicationLimits(IVostokApplicationLimits limits) =>
 log.Info(
     "Application limits: {CpuLimit} CPU, {MemoryLimit} memory.",
     limits.CpuUnits?.ToString("F2") ?? "unlimited",
     limits.MemoryBytes.HasValue ? new DataSize(limits.MemoryBytes.Value).ToString() : "unlimited");