예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
0
        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);
        }
예제 #4
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);
        }