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); }
private static IAppBuilder UseThreadDumpV2Components(IAppBuilder builder, IThreadDumpOptions options, IThreadDumper threadDumper, ILoggerFactory loggerFactory) { var endpoint = new ThreadDumpEndpoint_v2(options, threadDumper, loggerFactory?.CreateLogger <ThreadDumpEndpoint_v2>()); var logger = loggerFactory?.CreateLogger <EndpointOwinMiddleware <ThreadDumpResult> >(); var mgmtOptions = ManagementOptions.Get(); return(builder.Use <EndpointOwinMiddleware <ThreadDumpResult> >(endpoint, mgmtOptions, new List <HttpMethod> { HttpMethod.Get }, true, logger)); }