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


Java ClassLoadingGaugeSet类代码示例

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


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

示例1: JvmMetricSet

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
public JvmMetricSet() {
  registerSet("jvm.buffers", new BufferPoolMetricSet(getPlatformMBeanServer()));
  registerSet("jvm.classloading", new ClassLoadingGaugeSet());
  registerSet("jvm.fd", new FileDescriptorMetrics());
  registerSet("jvm.gc", new GarbageCollectorMetricSet());
  registerSet("jvm.memory", new MemoryUsageGaugeSet());
  registerSet("jvm.thread", new CachedThreadStatesGaugeSet(60, TimeUnit.SECONDS));

  metrics.put("jvm.uptime", new UptimeGauge());

  try {
    metrics.put("jvm.processCPU", new ProcessCpuTicksGauge());
  } catch (ClassNotFoundException | IOException e) {
    LOGGER.error("Error fetching process CPU usage metrics.", e);
  }
}
 
开发者ID:ApptuitAI,项目名称:JInsight,代码行数:17,代码来源:JvmMetricSet.java

示例2: build

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
public CloudWatchReporter build() {

            if (withJvmMetrics) {
                metricRegistry.register("jvm.uptime", (Gauge<Long>) () -> ManagementFactory.getRuntimeMXBean().getUptime());
                metricRegistry.register("jvm.current_time", (Gauge<Long>) clock::getTime);
                metricRegistry.register("jvm.classes", new ClassLoadingGaugeSet());
                metricRegistry.register("jvm.fd_usage", new FileDescriptorRatioGauge());
                metricRegistry.register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
                metricRegistry.register("jvm.gc", new GarbageCollectorMetricSet());
                metricRegistry.register("jvm.memory", new MemoryUsageGaugeSet());
                metricRegistry.register("jvm.thread-states", new ThreadStatesGaugeSet());
            }

            cwRateUnit = toStandardUnit(rateUnit);
            cwDurationUnit = toStandardUnit(durationUnit);

            return new CloudWatchReporter(this);
        }
 
开发者ID:azagniotov,项目名称:codahale-aggregated-metrics-cloudwatch-reporter,代码行数:19,代码来源:CloudWatchReporter.java

示例3: addJVMMetrics

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
private void addJVMMetrics(Map<String, Object> configuration) {
    if (!configuration.containsKey("jvm")) {
        return;
    }
    Set<String> jvmMetrics = new HashSet<String>((List<String>)configuration.get("jvm"));
    if (jvmMetrics.contains("gc")) {
        registry.register("gc", new GarbageCollectorMetricSet());
    }

    if (jvmMetrics.contains("threads")) {
        registry.register("threads", new CachedThreadStatesGaugeSet(10, TimeUnit.SECONDS));
    }

    if (jvmMetrics.contains("memory")) {
        registry.register("memory", new MemoryUsageGaugeSet());
    }

    if (jvmMetrics.contains("classloader")) {
        registry.register("memory", new ClassLoadingGaugeSet());
    }
}
 
开发者ID:willfleury,项目名称:metrics-agent,代码行数:22,代码来源:DropwizardMetricSystem.java

示例4: configureJvmMetrics

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
private static void configureJvmMetrics(MetricRegistry registry) {
  MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
  registry.register("jvm.buffer-pool", new BufferPoolMetricSet(mBeanServer));
  registry.register("jvm.class-loading", new ClassLoadingGaugeSet());
  registry.register("jvm.file-descriptor-ratio", new FileDescriptorRatioGauge());
  registry.register("jvm.gc", new GarbageCollectorMetricSet());
  registry.register("jvm.memory", new MemoryUsageGaugeSet());
  registry.register("jvm.threads", new ThreadStatesGaugeSet());
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:10,代码来源:MonitoringModule.java

示例5: init

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
@PostConstruct
	public void init() {
		//		ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metricRegistry)
		//				.convertRatesTo(TimeUnit.SECONDS)
		//				.convertDurationsTo(TimeUnit.MILLISECONDS)
		//				.build();
		//
		//		consoleReporter.start(10, TimeUnit.SECONDS);

//		Graphite graphite = new Graphite(new InetSocketAddress("192.168.99.100", 2003));
//		GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
//				.prefixedWith("com.packt.microservices.geolocation")
//				.convertRatesTo(TimeUnit.SECONDS)
//				.convertDurationsTo(TimeUnit.MILLISECONDS)
//				.filter(MetricFilter.ALL)
//				.build(graphite);
//		graphiteReporter.start(60, TimeUnit.SECONDS);


		geolocationWriteRequestCount = metricRegistry.counter("geolocationWriteRequestCount");
		metricRegistry.register("geolocationLastWriteTime", new Gauge<Long>() {
			@Override
			public Long getValue() {
				return geolocationLastWriteTime;
			}
		});

		metricRegistry.registerAll(new MetricSet() {
			@Override
			public Map<String, Metric> getMetrics() {

				Map<String, Metric> metrics = new HashMap<>();
				metrics.put("geolocationMemoryUsage", new MemoryUsageGaugeSet());
				metrics.put("geolocationClassLoading", new ClassLoadingGaugeSet());
				metrics.put("geolocationGarbageCollector", new GarbageCollectorMetricSet());
				return metrics;
			}
		});
	}
 
开发者ID:PacktPublishing,项目名称:Microservices-Deployment-Cookbook,代码行数:40,代码来源:MetricSystem.java

示例6: run

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
@Override
public void run(String... strings) throws Exception {
    // JVM metrics ala Dropwizard metrics-jvm
    metricRegistry.registerAll(new MemoryUsageGaugeSet());
    metricRegistry.registerAll(new ThreadStatesGaugeSet());
    metricRegistry.registerAll(new GarbageCollectorMetricSet());
    metricRegistry.registerAll(new ClassLoadingGaugeSet());
    // start collecting w/ statsd via ReadyTalk client
    reporter.start(statsdSettings.getPublishingIntervalInMillis(), TimeUnit.MILLISECONDS);
}
 
开发者ID:fastnsilver,项目名称:xlator,代码行数:11,代码来源:StatsdRunner.java

示例7: start

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
@Override
public void start() {

    String applicationName = settings.getApplicationName();

    // Register optional metrics
    if (settings.getBoolean(Settings.Setting.metrics_jvm_enabled, false)) {
        registerAll("jvm.gc", new GarbageCollectorMetricSet());
        registerAll("jvm.memory", new MemoryUsageGaugeSet());
        registerAll("jvm.threads", new ThreadStatesGaugeSet());
        registerAll("jvm.classes", new ClassLoadingGaugeSet());

        log.debug("Registered JVM-Metrics integration");
    }

    // MBeans for VisualVM, JConsole, or JMX
    if (settings.getBoolean(Settings.Setting.metrics_mbeans_enabled, false)) {
        JmxReporter reporter = JmxReporter.forRegistry(metricRegistry).inDomain(applicationName).build();
        reporter.start();
        reporters.add(reporter);

        log.debug("Started metrics MBeans reporter");
    }

    // Add classpath reporters
    ServiceLocator.locateAll(MetricsReporter.class).forEach((reporter) -> {
        if (RequireUtil.allowInstance(settings, reporter)) {
            reporter.start(settings, metricRegistry);
            reporters.add(reporter);
        }
    });
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:33,代码来源:Metrics.java

示例8: run

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
/**
 * @see io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)
 */
public void run(SPQRNodeServerConfiguration configuration, Environment environment) throws Exception {
	
	// initialize log4j environment using the settings provided via node configuration 
	initializeLog4j(configuration.getSpqrNode().getLog4jConfiguration());
	
	// check which type of resource management is requested via configuration 
	if(configuration.getResourceManagerConfiguration().getMode() == ResourceManagerMode.REMOTE) {

		// prepare for use remote resource management: fetch configuration  
		SPQRResourceManagerConfiguration resManCfg = configuration.getResourceManagerConfiguration();
		logger.info("[resource manager [mode="+ResourceManagerMode.REMOTE+", protocol="+resManCfg.getProtocol()+", host="+resManCfg.getHost()+", port="+resManCfg.getPort()+"]");

		// initialize client to use for remote communication
		this.resourceManagerClient = new SPQRResourceManagerClient(resManCfg.getProtocol(), resManCfg.getHost(), resManCfg.getPort(), new JerseyClientBuilder(environment).using(configuration.getHttpClient()).build("resourceManagerClient"));
		
		// finally: register node with remote resource manager
		this.nodeId = registerProcessingNode(configuration.getSpqrNode().getProtocol(), configuration.getSpqrNode().getHost(), configuration.getSpqrNode().getServicePort(), 
				configuration.getSpqrNode().getAdminPort(), this.resourceManagerClient);
		logger.info("node successfully registered [id="+nodeId+", proto="+configuration.getSpqrNode().getProtocol()+", host="+configuration.getSpqrNode().getHost()+", servicePort="+configuration.getSpqrNode().getServicePort()+", adminPort="+configuration.getSpqrNode().getAdminPort()+"]");
		
	} else {
		this.nodeId = "standalone";
		this.resourceManagerClient = null;
		logger.info("resource manager [mode="+ResourceManagerMode.LOCAL+"]");
	}

	// initialize the micro pipeline manager
	this.microPipelineManager = new MicroPipelineManager(this.nodeId, loadAndDeployApplicationRepository(configuration.getSpqrNode().getComponentRepositoryFolder()), configuration.getSpqrNode().getNumOfThreads());
	logger.info("pipeline manager initialized [threads="+configuration.getSpqrNode().getNumOfThreads()+", repo="+configuration.getSpqrNode().getComponentRepositoryFolder()+"]");

	// register exposed resources
	environment.jersey().register(new MicroPipelineResource(this.microPipelineManager));
	
	// register shutdown handler
	Runtime.getRuntime().addShutdownHook(new SPQRNodeShutdownHandler(this.microPipelineManager, this.resourceManagerClient, nodeId));
	
	// register metrics handler
	MetricsHandler handler = new MetricsHandler();
	if(configuration.getSpqrNode().getSpqrMetrics() != null) {
		final SPQRNodeMetricsConfiguration metricsCfg = configuration.getSpqrNode().getSpqrMetrics();
		
		if(metricsCfg.getMetricsReporter() != null && !metricsCfg.getMetricsReporter().isEmpty()) {
			
			if(metricsCfg.isAttachClassLoadingMetricCollector()) {
				handler.register(new ClassLoadingGaugeSet());
			}
			if(metricsCfg.isAttachFileDescriptorMetricCollector()) {
				handler.register("fs", new FileDescriptorRatioGauge());		
			}
			if(metricsCfg.isAttachGCMetricCollector()) {
				handler.register(new GarbageCollectorMetricSet());		
			}
			if(metricsCfg.isAttachMemoryUsageMetricCollector()) {
				handler.register(new MemoryUsageGaugeSet());		
			}
			if(metricsCfg.isAttachThreadStateMetricCollector()) {
				handler.register(new ThreadStatesGaugeSet());		
			}
		
			MetricsReporterFactory.attachReporters(handler, metricsCfg.getMetricsReporter());
			
			logger.info("metrics[classloader="+metricsCfg.isAttachClassLoadingMetricCollector()+
						       ",fileSystem="+metricsCfg.isAttachFileDescriptorMetricCollector()+
						       ",gc="+metricsCfg.isAttachGCMetricCollector()+
						       ",memory="+metricsCfg.isAttachMemoryUsageMetricCollector()+
						       ",threadState="+metricsCfg.isAttachThreadStateMetricCollector()+"]");
			
			StringBuffer buf = new StringBuffer();
			for(final MicroPipelineMetricsReporterConfiguration mr : metricsCfg.getMetricsReporter()) {
				buf.append("(id=").append(mr.getId()).append(", type=").append(mr.getType()).append(")");
			}
			logger.info("metricReporters["+buf.toString()+"]");
		}
	} else {
		logger.info("no metrics and metric reporters configured for processing node '"+nodeId+"'");
	}
}
 
开发者ID:ottogroup,项目名称:SPQR,代码行数:81,代码来源:SPQRNodeServer.java

示例9: registerMetrics

import com.codahale.metrics.jvm.ClassLoadingGaugeSet; //导入依赖的package包/类
private void registerMetrics( Application application, MetricRegistry metrics )
{
    Config config = application.config().atKey( "metrics" );

    // JVM Meters
    if( config.bool( "jvm.bufferpools.enabled" ) )
    {
        metrics.register( "jvm.bufferpools", new BufferPoolMetricSet( getPlatformMBeanServer() ) );
    }
    if( config.bool( "jvm.threadstates.enabled" ) )
    {
        metrics.register( "jvm.threadstates", new ThreadStatesGaugeSet() );
    }
    if( config.bool( "jvm.classloading.enabled" ) )
    {
        metrics.register( "jvm.classloading", new ClassLoadingGaugeSet() );
    }
    if( config.bool( "jvm.garbagecollection.enabled" ) )
    {
        metrics.register( "jvm.garbagecollection", new GarbageCollectorMetricSet() );
    }
    if( config.bool( "jvm.memory.enabled" ) )
    {
        metrics.register( "jvm.memory", new MemoryUsageGaugeSet() );
    }
    if( config.bool( "jvm.filedescriptors.enabled" ) )
    {
        metrics.register( "jvm.filedescriptors.ratio", new FileDescriptorRatioGauge() );
    }

    // Connection & HTTP Metrics
    requestTimers = new ConcurrentHashMap<>();
    eventRegistration = application.events().registerListener(
        new EventListener(
            metrics,
            requestTimers,
            config.bool( "http.connections.enabled" ),
            config.bool( "http.requests.enabled" ),
            config.bool( "http.success.enabled" ),
            config.bool( "http.redirections.enabled" ),
            config.bool( "http.client_errors.enabled" ),
            config.bool( "http.server_errors.enabled" ),
            config.bool( "http.unknown.enabled" )
        )
    );
}
 
开发者ID:werval,项目名称:werval,代码行数:47,代码来源:MetricsPlugin.java


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