当前位置: 首页>>代码示例>>Java>>正文


Java HystrixMetricsStreamServlet类代码示例

本文整理汇总了Java中com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet的典型用法代码示例。如果您正苦于以下问题:Java HystrixMetricsStreamServlet类的具体用法?Java HystrixMetricsStreamServlet怎么用?Java HystrixMetricsStreamServlet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HystrixMetricsStreamServlet类属于com.netflix.hystrix.contrib.metrics.eventstream包,在下文中一共展示了HystrixMetricsStreamServlet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
public void start() {

        final int port   = ConfigurationManager.getConfigInstance().getInt(RSSConstants.JETTY_HTTP_PORT, Integer.MIN_VALUE);

        final Context context = new Context(jettyServer, "/", Context.SESSIONS);
        context.setResourceBase(RSSConstants.WEBAPPS_DIR);
        context.setClassLoader(Thread.currentThread().getContextClassLoader());
        context.addServlet(JspServlet.class, "*.jsp");

        // Enable hystrix.stream
        context.addServlet(HystrixMetricsStreamServlet.class, RSSConstants.HYSTRIX_STREAM_PATH);

        final Server server = new Server(port);
        server.setHandler(context);

        try {
            karyonServer.start();
            server.start();
        } catch (Exception exc) {
            throw new RuntimeException("Cannot start karyon server ...", exc);
        }
    }
 
开发者ID:Netflix,项目名称:recipes-rss,代码行数:23,代码来源:BaseJettyServer.java

示例2: servletRegistrationBean

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean(name = "hystrixRegistrationBean")
public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(
            new HystrixMetricsStreamServlet(), "/hystrix.stream");
    registration.setName("hystrixServlet");
    registration.setLoadOnStartup(1);
    return registration;
}
 
开发者ID:rsdomingues,项目名称:netflixmicroservices-tdc2017,代码行数:9,代码来源:HystrixConfig.java

示例3: registration

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean registration(HystrixMetricsStreamServlet servlet) {
    ServletRegistrationBean registrationBean = new ServletRegistrationBean();
    registrationBean.setServlet(servlet);
    registrationBean.setEnabled(true);
    registrationBean.addUrlMappings("/hystrix.stream");
    return registrationBean;
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:9,代码来源:MonitorAutoconfiguration.java

示例4: hystrixServletRegistrationBean

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
/**
 * Registers HystrixMetricsStream Servlet that handles Hystrix Metrics
 *
 * @return ServletRegistrationBean
 */
@Bean
public ServletRegistrationBean hystrixServletRegistrationBean() {
    HystrixMetricsStreamServlet hystrixServlet = new HystrixMetricsStreamServlet();
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(hystrixServlet, monitoringServletsPath + "/hystrix.stream");
    LOGGER.info("HystrixMetricsStreamServlet registered");
    return servletRegistrationBean;
}
 
开发者ID:andrewharmellaw,项目名称:springboot-camel-metrics-publisher,代码行数:13,代码来源:MetricsServletConfiguration.java

示例5: run

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Override
public void run(Configuration conf, Environment env) throws Exception {
   env.jersey().register(TestResource.class);

   env.servlets()
      .addServlet("hystrix-metrics-stream-servlet", HystrixMetricsStreamServlet.class)
      .addMapping("/hystrix.stream");
}
 
开发者ID:eivindw,项目名称:akka-hystrix,代码行数:9,代码来源:WebApp.java

示例6: addTenacityResources

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
protected void addTenacityResources(Environment environment,
                                    TenacityPropertyKeyFactory keyFactory,
                                    Collection<TenacityPropertyKey> tenacityPropertyKeys) {
    final String tenacityMetricsStream = "/tenacity/metrics.stream";
    final TenacityConfigurationResource configurationResource = new TenacityConfigurationResource(keyFactory);
    final TenacityCircuitBreakersResource circuitBreakersResource =
            new TenacityCircuitBreakersResource(tenacityPropertyKeys, keyFactory);
    final TenacityPropertyKeysResource propertyKeysResource = new TenacityPropertyKeysResource(tenacityPropertyKeys);

    if (usingAdminPort) {
        environment.admin()
                .addServlet(tenacityMetricsStream, new HystrixMetricsStreamServlet())
                .addMapping(tenacityMetricsStream);
        environment.admin()
                .addServlet(TenacityPropertyKeysResource.PATH,
                        new TenacityPropertyKeysServlet(environment.getObjectMapper(), propertyKeysResource))
                .addMapping(TenacityPropertyKeysResource.PATH);
        environment.admin()
                .addServlet(TenacityConfigurationResource.PATH,
                        new TenacityConfigurationServlet(environment.getObjectMapper(), configurationResource))
                .addMapping(TenacityConfigurationResource.PATH + "/*");
        environment.admin()
                .addServlet(TenacityCircuitBreakersResource.PATH,
                        new TenacityCircuitBreakersServlet(environment.getObjectMapper(), circuitBreakersResource))
                .addMapping(TenacityCircuitBreakersResource.PATH + "/*");
    } else {
        environment.servlets()
                .addServlet(tenacityMetricsStream, new HystrixMetricsStreamServlet())
                .addMapping(tenacityMetricsStream);
        environment.jersey().register(propertyKeysResource);
        environment.jersey().register(configurationResource);
        environment.jersey().register(circuitBreakersResource);
    }
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:35,代码来源:TenacityConfiguredBundle.java

示例7: buildDeploymentInfo

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
private DeploymentInfo buildDeploymentInfo(JbootServerClassloader classloader) {
    DeploymentInfo deploymentInfo = Servlets.deployment()
            .setClassLoader(classloader)
            .setResourceManager(new ClassPathResourceManager(classloader))
            .setContextPath(config.getContextPath())
            .setDeploymentName("jboot" + StringUtils.uuid())
            .setEagerFilterInit(true); //设置启动的时候,初始化servlet或filter


    JbootShiroConfig shiroConfig = Jboot.config(JbootShiroConfig.class);
    if (shiroConfig.isConfigOK()) {
        deploymentInfo.addListeners(Servlets.listener(EnvironmentLoaderListener.class));
        deploymentInfo.addFilter(
                Servlets.filter("shiro", ShiroFilter.class))
                .addFilterUrlMapping("shiro", "/*", DispatcherType.REQUEST);
    }


    deploymentInfo.addFilter(
            Servlets.filter("jfinal", JFinalFilter.class)
                    .addInitParam("configClass", Jboot.me().getJbootConfig().getJfinalConfig()))
            .addFilterUrlMapping("jfinal", "/*", DispatcherType.REQUEST);


    JbootHystrixConfig hystrixConfig = Jboot.config(JbootHystrixConfig.class);
    if (StringUtils.isNotBlank(hystrixConfig.getUrl())) {
        deploymentInfo.addServlets(
                Servlets.servlet("HystrixMetricsStreamServlet", HystrixMetricsStreamServlet.class)
                        .addMapping(hystrixConfig.getUrl()));
    }


    JbootMetricConfig metricsConfig = Jboot.config(JbootMetricConfig.class);
    if (StringUtils.isNotBlank(metricsConfig.getUrl())) {
        deploymentInfo.addServlets(
                Servlets.servlet("MetricsAdminServlet", AdminServlet.class)
                        .addMapping(metricsConfig.getUrl()));

        deploymentInfo.addListeners(Servlets.listener(JbootMetricServletContextListener.class));
        deploymentInfo.addListeners(Servlets.listener(JbootHealthCheckServletContextListener.class));
    }


    io.jboot.server.Servlets jbootServlets = new io.jboot.server.Servlets();
    ContextListeners listeners = new ContextListeners();

    JbootAppListenerManager.me().onJbootDeploy(jbootServlets, listeners);


    for (Map.Entry<String, io.jboot.server.Servlets.ServletInfo> entry : jbootServlets.getServlets().entrySet()) {
        ServletInfo servletInfo = Servlets.servlet(entry.getKey(), entry.getValue().getServletClass()).addMappings(entry.getValue().getUrlMapping());
        deploymentInfo.addServlet(servletInfo);
    }

    for (Class<? extends ServletContextListener> listenerClass : listeners.getListeners()) {
        deploymentInfo.addListeners(Servlets.listener(listenerClass));
    }


    deploymentInfo.addServlets(
            Servlets.servlet("JbootResourceServlet", JbootResourceServlet.class)
                    .addMapping("/*"));

    return deploymentInfo;
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:66,代码来源:UnderTowServer.java

示例8: initJettyServer

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
private void initJettyServer() {
    InetSocketAddress address = new InetSocketAddress(config.getHost(), config.getPort());
    jettyServer = new Server(address);

    handler = new ServletContextHandler();
    handler.setContextPath(config.getContextPath());
    handler.setClassLoader(new JbootServerClassloader(JettyServer.class.getClassLoader()));
    handler.setResourceBase(getRootClassPath());

    JbootShiroConfig shiroConfig = Jboot.config(JbootShiroConfig.class);
    if (shiroConfig.isConfigOK()) {
        handler.addEventListener(new EnvironmentLoaderListener());
        handler.addFilter(ShiroFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
    }

    //JFinal
    FilterHolder jfinalFilter = handler.addFilter(JFinalFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
    jfinalFilter.setInitParameter("configClass", Jboot.me().getJbootConfig().getJfinalConfig());

    JbootHystrixConfig hystrixConfig = Jboot.config(JbootHystrixConfig.class);
    if (StringUtils.isNotBlank(hystrixConfig.getUrl())) {
        handler.addServlet(HystrixMetricsStreamServlet.class, hystrixConfig.getUrl());
    }


    JbootMetricConfig metricsConfig = Jboot.config(JbootMetricConfig.class);
    if (StringUtils.isNotBlank(metricsConfig.getUrl())) {
        handler.addEventListener(new JbootMetricServletContextListener());
        handler.addEventListener(new JbootHealthCheckServletContextListener());
        handler.addServlet(AdminServlet.class, metricsConfig.getUrl());
    }

    io.jboot.server.Servlets jbootServlets = new io.jboot.server.Servlets();
    ContextListeners listeners = new ContextListeners();

    JbootAppListenerManager.me().onJbootDeploy(jbootServlets, listeners);


    for (Map.Entry<String, io.jboot.server.Servlets.ServletInfo> entry : jbootServlets.getServlets().entrySet()) {
        for (String path : entry.getValue().getUrlMapping()) {
            handler.addServlet(entry.getValue().getServletClass(), path);
        }
    }


    for (Class<? extends ServletContextListener> listenerClass : listeners.getListeners()) {
        handler.addEventListener(ClassKits.newInstance(listenerClass));
    }

    jettyServer.setHandler(handler);
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:52,代码来源:JettyServer.java

示例9: hystrixMetricsStreamServlet

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean
public HystrixMetricsStreamServlet hystrixMetricsStreamServlet() {
    return new HystrixMetricsStreamServlet();
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:5,代码来源:MonitorAutoconfiguration.java

示例10: jerseyServlet

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean jerseyServlet() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new HystrixMetricsStreamServlet(), "/hystrix.stream");
    return registration;
}
 
开发者ID:redhat-helloworld-msa,项目名称:ola,代码行数:6,代码来源:HystrixServletConfiguration.java

示例11: contextInitialized

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent sce) {
    sce.getServletContext()
        .addServlet("HystrixMetricsStreamServlet", HystrixMetricsStreamServlet.class)
        .addMapping("/hystrix.stream");
}
 
开发者ID:redhat-helloworld-msa,项目名称:hola,代码行数:7,代码来源:HystrixServlet.java

示例12: createHystrixMetricsStreamServlet

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean createHystrixMetricsStreamServlet() {
  return new ServletRegistrationBean(new HystrixMetricsStreamServlet(), "/hystrix.stream");
}
 
开发者ID:achwie,项目名称:hystrix-demo,代码行数:5,代码来源:FrontendStarter.java

示例13: main

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  final QueuedThreadPool threadPool =
      new QueuedThreadPool(JETTY_MAX_THREADS, JETTY_MIN_THREADS, JETTY_THREAD_IDLE_TIMEOUT);
  threadPool.setName("jetty-io-worker");

  final Server server = new Server(threadPool);


  final ServerConnector connector = new ServerConnector(server);
  connector.setPort(9000);
  connector.setHost("0.0.0.0");
  server.setConnectors(new Connector[] { connector });

  // Create a servlet context and add the jersey servlet.
  final ServletContextHandler context = new ServletContextHandler(server, "/");

  // Add our Guice listener that includes our bindings
  context.addEventListener(new GuiceServletConfig());
  context.addEventListener(new JavaUtilLoggerRedirector());

  context.addFilter(RequestLogFilter.class, "/*", null);

  // Then add GuiceFilter and configure the server to
  // reroute all requests through this filter.
  //context.addFilter(GuiceFilter.class, "/*", null);

  context.addServlet(DefaultServlet.class, "/");

  context.addServlet(new ServletHolder(new GeneralServlet(ScalaWebService.apply())), "/video/*");
  //
  context.addServlet(new ServletHolder(FaultTolerantServlet.apply()), "/io/*");

  //curl http://localhost:9000/hystrix.stream
  context.addServlet(HystrixMetricsStreamServlet.class, "/hystrix.stream");

  server.setStopAtShutdown(true);

  // Start the server
  Runtime.getRuntime().addShutdownHook(new Thread(() -> { server.getStopAtShutdown(); }));
  server.start();
  server.join();
}
 
开发者ID:haghard,项目名称:jetty-jersey-guice-rxjava-scala,代码行数:43,代码来源:BootstrapService.java

示例14: get

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Override
public EndpointServlet get() {
    return new EndpointServlet(HystrixMetricsStreamServlet.class)
            .withInitParameters(this.initParameters);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:6,代码来源:HystrixStreamEndpoint.java

示例15: hystrixStreamFeature

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean
public HasFeatures hystrixStreamFeature() {
	return HasFeatures.namedFeature("Hystrix Stream Servlet", HystrixMetricsStreamServlet.class);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:5,代码来源:HystrixAutoConfiguration.java


注:本文中的com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。