我有:
img = imnoise(img/1e3,'poisson')*1e3;
并且:
plugins {
id 'org.springframework.boot' version '2.0.3.RELEASE'
}
我安排了应该每1小时执行一次的任务,并将特定指标从服务导出到InfluxDB:
compile 'org.springframework.boot:spring-boot-devtools'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'io.micrometer:micrometer-registry-influx:1.0.5'
当我检查日志时,发现它们每分钟都被导出:
@Profile("!test")
@Component
public class ExportMetricsTask {
@Autowired
private MetricsService metricsService;
@Autowired
private MeterRegistry meterRegistry;
@Scheduled(initialDelayString = "1000", fixedDelayString="3600000")
public void exportMetricsTask() {
metricsService.getSomeMetrics().forEach(response -> {
List<Tag> tags = Arrays.asList(Tag.of("country.iso2", response.getIso2()));
meterRegistry.gauge("countries.by.coverage.km",tags, response.getCoverageKm());
});
}
}
仅在执行计划任务时如何使指标导出到InfluxDB?
答案 0 :(得分:1)
您可以使用management.metrics.export.influx.step
属性更改报告频率,如下所示:
management.metrics.export.influx.step=1h