本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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");
}
示例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);
}
}
示例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;
}
示例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);
}
示例9: hystrixMetricsStreamServlet
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean
public HystrixMetricsStreamServlet hystrixMetricsStreamServlet() {
return new HystrixMetricsStreamServlet();
}
示例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;
}
示例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");
}
示例12: createHystrixMetricsStreamServlet
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean createHystrixMetricsStreamServlet() {
return new ServletRegistrationBean(new HystrixMetricsStreamServlet(), "/hystrix.stream");
}
示例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();
}
示例14: get
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Override
public EndpointServlet get() {
return new EndpointServlet(HystrixMetricsStreamServlet.class)
.withInitParameters(this.initParameters);
}
示例15: hystrixStreamFeature
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; //导入依赖的package包/类
@Bean
public HasFeatures hystrixStreamFeature() {
return HasFeatures.namedFeature("Hystrix Stream Servlet", HystrixMetricsStreamServlet.class);
}