文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
系统监控
监控
- 应用状态
- 系统状态
Metrics
dependencies {
compile 'org.springframework:spring-context:4.2.4.RELEASE'
compile 'org.springframework.data:spring-data-mongodb:1.8.4.RELEASE'
compile 'io.dropwizard.metrics:metrics-core:3.1.2'
compile 'io.dropwizard.metrics:metrics-jvm:3.1.2'
compile 'io.dropwizard.metrics:metrics-graphite:3.1.2'
compile 'com.ryantenney.metrics:metrics-spring:3.1.3'
}
@Configuration
@EnableMetrics
public class MetricsConfig extends MetricsConfigurerAdapter {
@Override
public void configureReporters(MetricRegistry metricRegistry) {
Graphite graphite = new Graphite(new InetSocketAddress("192.168.99.100", 2003));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.prefixedWith("juntao-laptop")
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
registerReporter(graphiteReporter);
graphiteReporter.start(1, TimeUnit.MINUTES);
metricRegistry.registerAll(new MemoryUsageGaugeSet());
metricRegistry.registerAll(new ThreadStatesGaugeSet());
}
}
@RestController
public class PersonController {
@Autowired
private PersonRepository personRepository;
@Metered(absolute = true, name = "metered.people.get.all")
@Timed(absolute = true, name = "people.get.all")
@RequestMapping(value ="/people", method = RequestMethod.GET)
public List<Person> findAll() {
return personRepository.findAll();
}
}
Graphite
Grafana
collectd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论