public void Constructor_SetsupStream() { var stream = HystrixDashboardStream.GetInstance(); var options = new OptionsWrapper <HystrixMetricsStreamOptions>() { Value = new HystrixMetricsStreamOptions() }; var publisher = new HystrixMetricsStreamPublisher(options, stream); Assert.NotNull(publisher.SampleSubscription); publisher.SampleSubscription.Dispose(); }
protected void Application_Start() { ILoggerFactory factory = new LoggerFactory(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ServerConfig.RegisterConfig("development"); // Add Console logging provider var settings = new ConfigurationConsoleLoggerSettings(ServerConfig.Configuration.GetSection("Logging")); factory.AddProvider(new ConsoleLoggerProvider(settings)); ILogger <MvcApplication> logger = factory.CreateLogger <MvcApplication>(); logger.LogInformation("Starting to build container"); var builder = new ContainerBuilder(); // Register all the controllers with Autofac builder.RegisterControllers(typeof(MvcApplication).Assembly); // Register logger factory builder.RegisterLoggingFactory(factory); // Register IDiscoveryClient, etc. builder.RegisterDiscoveryClient(ServerConfig.Configuration, factory); // Register FortuneService Hystrix command builder.RegisterHystrixCommand <IFortuneService, FortuneService>("fortuneService", ServerConfig.Configuration); // Register Hystrix Metrics/Monitoring stream builder.RegisterHystrixMetricsStream(ServerConfig.Configuration); // Create the Autofac container var container = builder.Build(); DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); logger.LogInformation("Finished container build, starting background services"); // Start the Discovery client background thread _client = container.Resolve <IDiscoveryClient>(); // Start the Hystrix Metrics stream _publisher = container.Resolve <HystrixMetricsStreamPublisher>(); logger.LogInformation("Finished starting background services"); }