public ScheduledActionsBuilder(ILog log, ITracer tracer, IVostokApplicationDiagnostics diagnostics)
        {
            this.log         = log.ForContext("Scheduler");
            this.tracer      = tracer;
            this.diagnostics = diagnostics;

            actions = new List <ScheduledAction>();
        }
Exemple #2
0
        private void RegisterDiagnostics(IVostokApplicationDiagnostics diagnostics)
        {
            var info         = GetInfo();
            var infoEntry    = new DiagnosticEntry("scheduled", info.Name);
            var infoProvider = new ScheduledActionsInfoProvider(GetInfo);
            var healthCheck  = new ScheduledActionsHealthCheck(GetInfo);

            diagnosticInfoRegistration = diagnostics.Info.RegisterProvider(infoEntry, infoProvider);
            healthCheckRegistration    = diagnostics.HealthTracker.RegisterCheck($"scheduled ({info.Name})", healthCheck);
        }
        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));
        }
Exemple #4
0
        public ScheduledActionsDynamicRunner(
            IReadOnlyList <ScheduledAction> staticActions,
            IVostokApplicationDiagnostics diagnostics,
            ITracer tracer,
            ILog log,
            ScheduledActionsDynamicOptions options)
        {
            this.staticActions = staticActions;
            this.diagnostics   = diagnostics;
            this.tracer        = tracer;
            this.log           = log;

            actualizationRunner = new ScheduledActionRunner(ConfigureActualizationAction(options), log, tracer, diagnostics);
            userRunners         = new ConcurrentDictionary <string, UserActionRunner>();
        }
Exemple #5
0
        public ScheduledActionRunner(ScheduledAction action, ILog log, ITracer tracer, IVostokApplicationDiagnostics diagnostics)
        {
            this.action = action;
            this.tracer = tracer;
            this.log    = log;

            if (diagnostics != null)
            {
                RegisterDiagnostics(diagnostics);
            }
        }