Beispiel #1
0
        public static void UseLoggerActuator(IConfiguration configuration, ILoggerProvider loggerProvider, ILoggerFactory loggerFactory = null)
        {
            var ep      = new LoggersEndpoint(new LoggersOptions(configuration), loggerProvider as IDynamicLoggerProvider, CreateLogger <LoggersEndpoint>(loggerFactory));
            var handler = new LoggersHandler(ep, SecurityService, CreateLogger <LoggersHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #2
0
        public static void UseThreadDumpActuator(IConfiguration configuration, MediaTypeVersion version, IThreadDumper threadDumper = null, ILoggerFactory loggerFactory = null)
        {
            var options = new ThreadDumpEndpointOptions(configuration);

            if (version == MediaTypeVersion.V2 && options.Id == "dump")
            {
                options.Id = "threaddump";
            }

            _mgmtOptions.RegisterEndpointOptions(configuration, options);
            threadDumper = threadDumper ?? new ThreadDumper(options);
            IActuatorHandler handler;

            switch (version)
            {
            case MediaTypeVersion.V1:
                var ep = new ThreadDumpEndpoint(options, threadDumper, CreateLogger <ThreadDumpEndpoint>(loggerFactory));
                handler = new ThreadDumpHandler(ep, SecurityServices, _mgmtOptions, CreateLogger <ThreadDumpHandler>(loggerFactory));
                break;

            default:
                var ep2 = new ThreadDumpEndpoint_v2(options, threadDumper, CreateLogger <ThreadDumpEndpoint_v2>(loggerFactory));
                handler = new ThreadDumpHandler_v2(ep2, SecurityServices, _mgmtOptions, CreateLogger <ThreadDumpHandler_v2>(loggerFactory));
                break;
            }

            ConfiguredHandlers.Add(handler);
        }
Beispiel #3
0
        public static void UseRefreshActuator(IConfiguration configuration, ILoggerFactory loggerFactory = null)
        {
            var ep      = new RefreshEndpoint(new RefreshOptions(configuration), configuration, CreateLogger <RefreshEndpoint>(loggerFactory));
            var handler = new RefreshHandler(ep, SecurityService, CreateLogger <RefreshHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #4
0
        public static void UseMappingsActuator(IConfiguration configuration, IApiExplorer apiExplorer = null, ILoggerFactory loggerFactory = null)
        {
            var options = new MappingsOptions(configuration);
            var handler = new MappingsHandler(options, SecurityService, apiExplorer, CreateLogger <MappingsHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #5
0
        public static void UseHypermediaActuator(IConfiguration configuration, ILoggerFactory loggerFactory = null)
        {
            var options           = new HypermediaEndpointOptions(configuration);
            var managementOptions = _mgmtOptions.OfType <ActuatorManagementOptions>().SingleOrDefault();

            if (managementOptions == null)
            {
                managementOptions = new ActuatorManagementOptions(configuration);
                _mgmtOptions.Add(managementOptions);
            }

            managementOptions.EndpointOptions.Add(options);

            var ep      = new ActuatorEndpoint(options, _mgmtOptions, CreateLogger <ActuatorEndpoint>(loggerFactory));
            var handler = new ActuatorHypermediaHandler(ep, SecurityServices, _mgmtOptions, CreateLogger <ActuatorHypermediaHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);

            if (ConfiguredHandlers.OfType <CloudFoundryCorsHandler>().Any())
            {
                return;
            }

            var handler2 = new CloudFoundryCorsHandler(options, SecurityServices, _mgmtOptions, CreateLogger <CloudFoundryCorsHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler2);
        }
Beispiel #6
0
        public static void UseThreadDumpActuator(IConfiguration configuration, IThreadDumper threadDumper = null, ILoggerFactory loggerFactory = null)
        {
            var options = new ThreadDumpOptions(configuration);

            threadDumper = threadDumper ?? new ThreadDumper(options);
            var ep      = new ThreadDumpEndpoint(options, threadDumper, CreateLogger <ThreadDumpEndpoint>(loggerFactory));
            var handler = new ThreadDumpHandler(ep, SecurityService, CreateLogger <ThreadDumpHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #7
0
        public static void UseEnvActuator(IConfiguration configuration, IHostingEnvironment hostingEnvironment = null, ILoggerFactory loggerFactory = null)
        {
            var options = new EnvOptions(configuration);

            hostingEnvironment = hostingEnvironment ?? new DefaultHostingEnvironment("development");
            var ep      = new EnvEndpoint(options, configuration, hostingEnvironment, CreateLogger <EnvEndpoint>(loggerFactory));
            var handler = new EnvHandler(ep, SecurityService, CreateLogger <EnvHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #8
0
        public static void UseMappingsActuator(IConfiguration configuration, IApiExplorer apiExplorer = null, ILoggerFactory loggerFactory = null)
        {
            var options = new MappingsEndpointOptions(configuration);

            _mgmtOptions.RegisterEndpointOptions(configuration, options);
            var ep      = new MappingsEndpoint(options, CreateLogger <MappingsEndpoint>(loggerFactory));
            var handler = new MappingsHandler(ep, SecurityServices, apiExplorer, _mgmtOptions, CreateLogger <MappingsHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #9
0
        public static void UseRefreshActuator(IConfiguration configuration, ILoggerFactory loggerFactory = null)
        {
            var options = new RefreshEndpointOptions(configuration);

            _mgmtOptions.RegisterEndpointOptions(configuration, options);
            var ep      = new RefreshEndpoint(options, configuration, CreateLogger <RefreshEndpoint>(loggerFactory));
            var handler = new RefreshHandler(ep, SecurityServices, _mgmtOptions, CreateLogger <RefreshHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
        public static void ConfigureHeapDumpEndpoint(IConfiguration configuration, IHeapDumper heapDumper = null, ILoggerFactory loggerFactory = null)
        {
            var options = new HeapDumpOptions(configuration);

            heapDumper = heapDumper ?? new HeapDumper(options);
            var ep      = new HeapDumpEndpoint(options, heapDumper, CreateLogger <HeapDumpEndpoint>(loggerFactory));
            var handler = new HeapDumpHandler(ep, SecurityService, CreateLogger <HeapDumpHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #11
0
        public static void UseTraceActuator(IConfiguration configuration, ITraceRepository traceRepository = null, ILoggerFactory loggerFactory = null)
        {
            var options = new TraceOptions(configuration);

            traceRepository = traceRepository ?? new TraceDiagnosticObserver(options, CreateLogger <TraceDiagnosticObserver>(loggerFactory));
            DiagnosticsManager.Instance.Observers.Add((IDiagnosticObserver)traceRepository);
            var ep      = new TraceEndpoint(options, traceRepository, CreateLogger <TraceEndpoint>(loggerFactory));
            var handler = new TraceHandler(ep, SecurityService, CreateLogger <TraceHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #12
0
        public static void UseCloudFoundryActuator(IConfiguration configuration, ILoggerFactory loggerFactory = null)
        {
            var options = new CloudFoundryOptions(configuration);
            var ep      = new CloudFoundryEndpoint(options, CreateLogger <CloudFoundryEndpoint>(loggerFactory));
            var handler = new CloudFoundryHandler(ep, SecurityService, CreateLogger <CloudFoundryHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
            var handler2 = new CloudFoundryCorsHandler(options, SecurityService, CreateLogger <CloudFoundryCorsHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler2);
        }
Beispiel #13
0
        private static void UseTraceActuatorComponents(IConfiguration configuration, ITraceRepository traceRepository, ILoggerFactory loggerFactory)
        {
            var options = new TraceEndpointOptions(configuration);

            _mgmtOptions.RegisterEndpointOptions(configuration, options);
            traceRepository = traceRepository ?? new TraceDiagnosticObserver(options, CreateLogger <TraceDiagnosticObserver>(loggerFactory));
            DiagnosticsManager.Instance.Observers.Add((IDiagnosticObserver)traceRepository);
            var ep      = new TraceEndpoint(options, traceRepository, CreateLogger <TraceEndpoint>(loggerFactory));
            var handler = new TraceHandler(ep, SecurityServices, _mgmtOptions, CreateLogger <TraceHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #14
0
        public static void UseInfoActuator(IConfiguration configuration, IEnumerable <IInfoContributor> contributors = null, ILoggerFactory loggerFactory = null)
        {
            var options = new InfoOptions(configuration);

            contributors = contributors ?? new List <IInfoContributor>()
            {
                new GitInfoContributor(), new AppSettingsInfoContributor(configuration)
            };
            var ep      = new InfoEndpoint(options, contributors, CreateLogger <InfoEndpoint>(loggerFactory));
            var handler = new InfoHandler(ep, SecurityService, CreateLogger <InfoHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #15
0
        public static void UseHealthActuator(IConfiguration configuration, IHealthAggregator healthAggregator = null, IEnumerable <IHealthContributor> contributors = null, ILoggerFactory loggerFactory = null)
        {
            var options = new HealthOptions(configuration);

            healthAggregator = healthAggregator ?? new DefaultHealthAggregator();
            contributors     = contributors ?? new List <IHealthContributor>()
            {
                new DiskSpaceContributor(new DiskSpaceContributorOptions(configuration))
            };
            var ep      = new HealthEndpoint(options, healthAggregator, contributors, CreateLogger <HealthEndpoint>(loggerFactory));
            var handler = new HealthHandler(ep, SecurityService, CreateLogger <HealthHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #16
0
        public static void UseMetricsActuator(IConfiguration configuration, ILoggerFactory loggerFactory)
        {
            var options = new MetricsOptions(configuration);

            var hostObserver = new AspNetHostingObserver(options, OpenCensusStats.Instance, OpenCensusTags.Instance, CreateLogger <AspNetHostingObserver>(loggerFactory));
            var clrObserver  = new CLRRuntimeObserver(options, OpenCensusStats.Instance, OpenCensusTags.Instance, CreateLogger <CLRRuntimeObserver>(loggerFactory));

            DiagnosticsManager.Instance.Observers.Add((IDiagnosticObserver)hostObserver);
            DiagnosticsManager.Instance.Observers.Add((IDiagnosticObserver)clrObserver);

            var clrSource = new CLRRuntimeSource();

            DiagnosticsManager.Instance.Sources.Add(clrSource);
            var ep      = new MetricsEndpoint(options, OpenCensusStats.Instance, CreateLogger <MetricsEndpoint>(loggerFactory));
            var handler = new MetricsHandler(ep, SecurityService, CreateLogger <MetricsHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Beispiel #17
0
        public static void UseCloudFoundryActuator(IConfiguration configuration, ILoggerFactory loggerFactory = null)
        {
            var options           = new CloudFoundryEndpointOptions(configuration);
            var managementOptions = _mgmtOptions.OfType <CloudFoundryManagementOptions>().SingleOrDefault();

            if (managementOptions == null)
            {
                managementOptions = new CloudFoundryManagementOptions(configuration, Platform.IsCloudFoundry);
                _mgmtOptions.Add(managementOptions);
            }

            managementOptions.EndpointOptions.Add(options);
            var ep      = new CloudFoundryEndpoint(options, _mgmtOptions, CreateLogger <CloudFoundryEndpoint>(loggerFactory));
            var handler = new CloudFoundryHandler(ep, SecurityServices, _mgmtOptions, CreateLogger <CloudFoundryHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
            var handler2 = new CloudFoundryCorsHandler(options, SecurityServices, _mgmtOptions, CreateLogger <CloudFoundryCorsHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler2);
        }