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)); }
public DiagnosticApiMiddleware( [NotNull] RequestDelegate next, [NotNull] IVostokHostExtensions extensions, [NotNull] IOptions <DiagnosticApiSettings> options, [NotNull] ILog log) { this.next = next ?? throw new ArgumentNullException(nameof(next)); this.extensions = extensions ?? throw new ArgumentNullException(nameof(extensions)); this.options = (options ?? throw new ArgumentNullException(nameof(options))).Value; this.log = (log ?? throw new ArgumentNullException(nameof(log))).ForContext <DiagnosticApiMiddleware>(); pathPrefix = this.options.PathPrefix.TrimEnd('/'); }
private void LogHostExtensions(IVostokHostExtensions extensions) => log.Info("Registered host extensions: {HostExtensions}.", extensions.GetAll().Select(pair => pair.Item1.Name).ToArray());
private void LogHostExtensions(IVostokHostExtensions extensions) => log.Info("Registered host extensions: {HostExtensions}.", extensions.GetAll() .Select(pair => pair.Item1.Name) .Concat(extensions is HostExtensions hostExtensions ? hostExtensions.GetAllKeyed().Select(pair => $"{pair.Item1}({pair.Item2.Name})") : Array.Empty <string>())
public static IVostokHostMutableExtensions AsMutable([NotNull] this IVostokHostExtensions extensions) => extensions as IVostokHostMutableExtensions ?? throw new InvalidOperationException($"Host extensions of type '{extensions.GetType().Name}' are not mutable.");
public static object Get(this IVostokHostExtensions extensions, Type type, string key) => GetMethod.MakeGenericMethod(type).Invoke(extensions, new object[] { key });