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


Java MetricWriter类代码示例

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


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

示例1: flush

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
private void flush(GaugeWriter writer) {
	if (writer instanceof CompositeMetricWriter) {
		for (MetricWriter child : (CompositeMetricWriter) writer) {
			flush(child);
		}
	}
	try {
		if (ClassUtils.isPresent("java.io.Flushable", null)) {
			if (writer instanceof Flushable) {
				((Flushable) writer).flush();
				return;
			}
		}
		Method method = ReflectionUtils.findMethod(writer.getClass(), "flush");
		if (method != null) {
			ReflectionUtils.invokeMethod(method, writer);
		}
	}
	catch (Exception ex) {
		logger.warn("Could not flush MetricWriter: " + ex.getClass() + ": "
				+ ex.getMessage());
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:24,代码来源:MetricCopyExporter.java

示例2: provideAdditionalWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Test
public void provideAdditionalWriter() {
	this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
			MetricRepositoryAutoConfiguration.class,
			MetricExportAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	GaugeService gaugeService = this.context.getBean(GaugeService.class);
	assertThat(gaugeService).isNotNull();
	gaugeService.submit("foo", 2.7);
	MetricExporters exporters = this.context.getBean(MetricExporters.class);
	MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
			.get("writer");
	exporter.setIgnoreTimestamps(true);
	exporter.export();
	MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
	Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:MetricExportAutoConfigurationTests.java

示例3: flush

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
private void flush(MetricWriter writer) {
	if (writer instanceof CompositeMetricWriter) {
		for (MetricWriter child : (CompositeMetricWriter) writer) {
			flush(child);
		}
	}
	try {
		if (ClassUtils.isPresent("java.io.Flushable", null)) {
			if (writer instanceof Flushable) {
				((Flushable) writer).flush();
				return;
			}
		}
		Method method = ReflectionUtils.findMethod(writer.getClass(), "flush");
		if (method != null) {
			ReflectionUtils.invokeMethod(method, writer);
		}
	}
	catch (Exception ex) {
		logger.warn("Could not flush MetricWriter: " + ex.getClass() + ": "
				+ ex.getMessage());
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:24,代码来源:MetricCopyExporter.java

示例4: provideAdditionalWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Test
public void provideAdditionalWriter() {
	this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
			MetricRepositoryAutoConfiguration.class,
			MetricExportAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	GaugeService gaugeService = this.context.getBean(GaugeService.class);
	assertNotNull(gaugeService);
	gaugeService.submit("foo", 2.7);
	MetricExporters exporters = this.context.getBean(MetricExporters.class);
	MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
			.get("writer");
	exporter.setIgnoreTimestamps(true);
	exporter.export();
	MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
	Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:MetricExportAutoConfigurationTests.java

示例5: metricsFlushAutomatically

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Test
public void metricsFlushAutomatically() throws Exception {
	this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
			MetricRepositoryAutoConfiguration.class,
			MetricExportAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	GaugeService gaugeService = this.context.getBean(GaugeService.class);
	assertThat(gaugeService).isNotNull();
	gaugeService.submit("foo", 2.7);
	MetricExporters flusher = this.context.getBean(MetricExporters.class);
	flusher.close(); // this will be called by Spring on shutdown
	MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
	Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:MetricExportAutoConfigurationTests.java

示例6: getExporter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
private MetricCopyExporter getExporter(MetricWriter writer,
		TriggerProperties trigger) {
	MetricCopyExporter exporter = new MetricCopyExporter(this.reader, writer);
	exporter.setIncludes(trigger.getIncludes());
	exporter.setExcludes(trigger.getExcludes());
	exporter.setSendLatest(trigger.isSendLatest());
	return exporter;
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:9,代码来源:MetricExporters.java

示例7: openTsdbMetricWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Bean
@ConfigurationProperties("metrics.export")
@ExportMetricWriter
public MetricWriter openTsdbMetricWriter() {
	OpenTsdbMetricWriter writer = new OpenTsdbMetricWriter();
	writer.setNamingStrategy(namingStrategy());
	return writer;
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:9,代码来源:SampleOpenTsdbExportApplication.java

示例8: primaryMetricWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Bean
@Primary
@ConditionalOnMissingClass("org.springframework.messaging.MessageChannel")
@ConditionalOnMissingBean(name = "primaryMetricWriter")
public MetricWriter primaryMetricWriter(List<MetricWriter> writers) {
  return new CompositeMetricWriter(writers);
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:8,代码来源:SpectatorConfiguration.java

示例9: primaryMetricWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Bean(name = "primaryMetricWriter")
@Primary
static public MetricWriter primaryMetricWriter(List<MetricWriter> writers) {
	// Normally the Metrics are written asynchronously to Spring Boot's repository. In tests we need to do it synchronously to be able to verify
	// the correct output.
	MetricWriter compositeMetricWriter = new CompositeMetricWriter(writers);
	return compositeMetricWriter;
}
 
开发者ID:codecentric,项目名称:spring-boot-starter-batch-web,代码行数:9,代码来源:MetricsTestApplication.java

示例10: metricWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Bean
@ExportMetricWriter
/*
 * Prometheus is not capable to scrape json metrics so we need to expose the actuator metrics to jmx. Every
 * counter and gauge metrics are exposed too.
 */
public MetricWriter metricWriter(MBeanExporter exporter) {
    return new JmxMetricWriter(exporter);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:10,代码来源:AppConfig.java

示例11: metricWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:7,代码来源:MetricsConfiguration.java

示例12: metricWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
/**
 * Exports actuator metrics to JMX.
 */
@Bean
@ExportMetricWriter
public MetricWriter metricWriter(MBeanExporter exporter) {
    return new JmxMetricWriter(exporter);
}
 
开发者ID:oneops,项目名称:secrets-proxy,代码行数:9,代码来源:MgmtConfig.java

示例13: metricWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
/**
 * Export a new {@link StatfulMetricWriter} metrics writer.
 * @return {@link MetricWriter}
 */
@Bean
@ExportMetricWriter
MetricWriter metricWriter() {
    return new StatfulMetricWriter();
}
 
开发者ID:statful,项目名称:statful-client-springboot,代码行数:10,代码来源:SpringbootClientConfiguration.java

示例14: metricWriter

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
@Bean
@ExportMetricWriter
public MetricWriter metricWriter(MetricExportProperties export) {
    return new RedisMetricRepository(redisConnectionFactory,
            export.getRedis().getPrefix(), export.getRedis().getKey());
}
 
开发者ID:Catalysts,项目名称:cat-boot,代码行数:7,代码来源:ClusterMetricsConfig.java

示例15: LegacyMetricServicesConfiguration

import org.springframework.boot.actuate.metrics.writer.MetricWriter; //导入依赖的package包/类
LegacyMetricServicesConfiguration(@ActuatorMetricWriter MetricWriter writer) {
	this.writer = writer;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:4,代码来源:MetricRepositoryAutoConfiguration.java


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