com.codahale.metrics.jmx.JmxReporter#start ( )源码实例Demo

下面列出了com.codahale.metrics.jmx.JmxReporter#start ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: cxf   文件: CodahaleMetricsProvider.java
public static void setupJMXReporter(Bus b, MetricRegistry reg) {
    InstrumentationManager im = b.getExtension(InstrumentationManager.class);
    if (im != null) {
        JmxReporter reporter = JmxReporter.forRegistry(reg).registerWith(im.getMBeanServer())
            .inDomain("org.apache.cxf")
            .createsObjectNamesWith(new ObjectNameFactory() {
                public ObjectName createName(String type, String domain, String name) {
                    try {
                        return new ObjectName(name);
                    } catch (MalformedObjectNameException e) {
                        throw new RuntimeException(e);
                    }
                }
            })
            .build();
        reporter.start();
    }
}
 
源代码2 项目: ambry   文件: DumpDataTool.java
public static void main(String args[]) throws Exception {
  VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
  MetricRegistry registry = new MetricRegistry();
  StoreToolsMetrics metrics = new StoreToolsMetrics(registry);
  JmxReporter reporter = null;
  try {
    reporter = JmxReporter.forRegistry(registry).build();
    reporter.start();
    DumpDataTool dumpDataTool = new DumpDataTool(verifiableProperties, metrics);
    dumpDataTool.doOperation();
  } finally {
    if (reporter != null) {
      reporter.stop();
    }
  }
}
 
源代码3 项目: ambry   文件: DumpLogTool.java
public static void main(String args[]) throws Exception {
  VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
  MetricRegistry registry = new MetricRegistry();
  StoreToolsMetrics metrics = new StoreToolsMetrics(registry);
  JmxReporter reporter = null;
  try {
    reporter = JmxReporter.forRegistry(registry).build();
    reporter.start();
    DumpLogTool dumpLogTool = new DumpLogTool(verifiableProperties, metrics);
    dumpLogTool.doOperation();
  } finally {
    if (reporter != null) {
      reporter.stop();
    }
  }
}
 
源代码4 项目: Bats   文件: DrillMetrics.java
private static JmxReporter getJmxReporter() {
  if (METRICS_JMX_OUTPUT_ENABLED) {
    JmxReporter reporter = JmxReporter.forRegistry(REGISTRY).build();
    reporter.start();

    return reporter;
  }
  return null;
}
 
源代码5 项目: ja-micro   文件: InjectionModule.java
public InjectionModule(ServiceProperties serviceProperties) {
    this.serviceProperties = serviceProperties;
    metricRegistry = new MetricRegistry();
    JmxReporter reporter = JmxReporter.forRegistry(metricRegistry).build();
    reporter.start();
    httpClient = createHttpClient();
}
 
源代码6 项目: replicator   文件: JMXMetrics.java
@Override
protected JmxReporter getReporter(Map<String, Object> configuration, MetricRegistry registry) {
    JmxReporter reporter = JmxReporter.forRegistry(registry).build();

    reporter.start();

    return reporter;
}
 
源代码7 项目: xio   文件: ApplicationState.java
public ApplicationState(ApplicationConfig config, XioTracing tracing) {
  this.config = config;
  this.tracing = tracing;
  this.metricRegistry = new MetricRegistry();
  JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
  jmxReporter.start();
  this.channelConfiguration = config.serverChannelConfig();
  this.ipFilterConfig = new AtomicReference<>(new IpFilterConfig());
  this.http1FilterConfig = new AtomicReference<>(new Http1FilterConfig());
}
 
源代码8 项目: FATE-Serving   文件: ServingServer.java
private void start(String[] args) throws Exception {
    this.initialize();
    applicationContext = SpringApplication.run(SpringConfig.class, args);
    ApplicationHolder.applicationContext = applicationContext;
    int port = Integer.parseInt(Configuration.getProperty(Dict.PROPERTY_SERVER_PORT));
    //TODO: Server custom configuration

    int processors = Runtime.getRuntime().availableProcessors();

    Integer corePoolSize = Configuration.getPropertyInt("serving.core.pool.size", processors);
    Integer maxPoolSize = Configuration.getPropertyInt("serving.max.pool.size", processors * 2);
    Integer aliveTime = Configuration.getPropertyInt("serving.pool.alive.time", 1000);
    Integer queueSize = Configuration.getPropertyInt("serving.pool.queue.size", 10);
    Executor executor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, aliveTime.longValue(), TimeUnit.MILLISECONDS,
            new SynchronousQueue(), new NamedThreadFactory("ServingServer", true));

    FateServerBuilder serverBuilder = (FateServerBuilder) ServerBuilder.forPort(port);
    serverBuilder.keepAliveTime(100,TimeUnit.MILLISECONDS);
    serverBuilder.executor(executor);
    //new ServiceOverloadProtectionHandle()
    serverBuilder.addService(ServerInterceptors.intercept(applicationContext.getBean(InferenceService.class), new ServiceExceptionHandler(), new ServiceOverloadProtectionHandle()), InferenceService.class);
    serverBuilder.addService(ServerInterceptors.intercept(applicationContext.getBean(ModelService.class), new ServiceExceptionHandler(), new ServiceOverloadProtectionHandle()), ModelService.class);
    serverBuilder.addService(ServerInterceptors.intercept(applicationContext.getBean(ProxyService.class), new ServiceExceptionHandler(), new ServiceOverloadProtectionHandle()), ProxyService.class);
    server = serverBuilder.build();
    logger.info("server started listening on port: {}, use configuration: {}", port, this.confPath);
    server.start();
    String userRegisterString = Configuration.getProperty(Dict.USE_REGISTER,"true");
    useRegister = Boolean.valueOf(userRegisterString);
    if(useRegister) {
        logger.info("serving-server is using register center");
    }
    else{
        logger.warn("serving-server not use register center");
    }
    if (useRegister) {
        ZookeeperRegistry zookeeperRegistry = applicationContext.getBean(ZookeeperRegistry.class);
        zookeeperRegistry.subProject(Dict.PROPERTY_PROXY_ADDRESS);
        zookeeperRegistry.subProject(Dict.PROPERTY_FLOW_ADDRESS);

        BaseModel.routerService = applicationContext.getBean(RouterService.class);
        FateServer.serviceSets.forEach(servie -> {
            try {
                String serviceName = servie.serviceName();
                String weightKey = serviceName + ".weight";
                HashMap properties = Configuration.getProperties();
                if (properties.get(weightKey) != null) {
                    int weight = Integer.valueOf(properties.get(weightKey).toString());
                    if (weight > 0) {
                        zookeeperRegistry.getServieWeightMap().put(weightKey, weight);
                    }
                }
            } catch (Throwable e) {
                logger.error("parse interface weight error", e);
            }

        });

        zookeeperRegistry.register(FateServer.serviceSets);

    }

    ModelService modelService = applicationContext.getBean(ModelService.class);
    modelService.restore();

    ConsoleReporter reporter = applicationContext.getBean(ConsoleReporter.class);
    reporter.start(1, TimeUnit.MINUTES);

    JmxReporter jmxReporter = applicationContext.getBean(JmxReporter.class);
    jmxReporter.start();

    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
            logger.info("*** shutting down gRPC server since JVM is shutting down");
            ServingServer.this.stop();
            logger.info("*** server shut down");
        }
    });
}
 
源代码9 项目: JuniperBot   文件: MetricsConfiguration.java
@Bean(destroyMethod = "stop")
public JmxReporter jmxReporter() {
    JmxReporter reporter = JmxReporter.forRegistry(metricRegistry).build();
    reporter.start();
    return reporter;
}
 
private void startJmxReporter() {
  JmxReporter reporter = JmxReporter.forRegistry(registry).build();
  reporter.start();
}
 
源代码11 项目: Singularity   文件: SingularityS3UploaderMetrics.java
private void startJmxReporter() {
  JmxReporter reporter = JmxReporter.forRegistry(registry).build();
  reporter.start();
}
 
 同类方法