metrics+spring+influxdb整合
1.在maven项目的pom.xml引入metrics-spring和metrics-influxdb两个jar包
<dependency>
<groupId>com.ryantenney.metrics</groupId>
<artifactId>metrics-spring</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>com.github.davidb</groupId>
<artifactId>metrics-influxdb</artifactId>
<version>0.9.3</version>
</dependency>
2.配置InfluxdbReporter
import java.util.concurrent.TimeUnit; import org.springframework.context.annotation.Configuration; import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricFilter;
import com.codahale.metrics.MetricRegistry;
import com.ryantenney.metrics.spring.config.annotation.EnableMetrics;
import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter; import metrics_influxdb.HttpInfluxdbProtocol;
import metrics_influxdb.InfluxdbReporter; @Configuration
@EnableMetrics
public class SpringConfiguringClass extends MetricsConfigurerAdapter { @Override
public void configureReporters(MetricRegistry metricRegistry) {
// registerReporter allows the MetricsConfigurerAdapter to
// shut down the reporter when the Spring context is closed
//输出度量数据至控制台
registerReporter(ConsoleReporter.forRegistry(metricRegistry).build()).start(5, TimeUnit.SECONDS);
//输出度数数据到influxdb
InfluxdbReporter.forRegistry(metricRegistry)
.protocol(new HttpInfluxdbProtocol("your influxdb server IP address", 8086, "test", "test"))
.convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL)
.skipIdleMetrics(false).tag("server", "127.0.0.1").build().start(1, TimeUnit.SECONDS);
} }
3.在需要监控的代码方法体上引入相关注解
note:方法必须为public方法
4.参考文档
Metrics官网 https://metrics.dropwizard.io/4.0.0/getting-started.html
metrics-spring官网 https://github.com/ryantenney/metrics-spring
metrics-influxdb官网 https://github.com/davidB/metrics-influxdb
grafana官网文档 http://docs.grafana.org/features/panels/graph/
5.整合influxdb+grafana+metrics,可参考
https://blog.csdn.net/qq_35981283/article/details/76887173
metrics+spring+influxdb整合的更多相关文章
- metrics+spring+influxdb
https://www.cnblogs.com/lixyu/p/9337055.html
- struts2 spring mybatis 整合(test)
这几天搭了个spring+struts2+mybatis的架子,练练手,顺便熟悉熟悉struts2. 环境:myEclipse10+tomcat7+jdk1.6(1.8的jre报错,所以换成了1.6) ...
- 【Java EE 学习 79 下】【动态SQL】【mybatis和spring的整合】
一.动态SQL 什么是动态SQL,就是在不同的条件下,sql语句不相同的意思,曾经在“酒店会员管理系统”中写过大量的多条件查询,那是在SSH的环境中,所以只能在代码中进行判断,以下是其中一个多条件查询 ...
- 3.springMVC+spring+Mybatis整合Demo(单表的增删该查,这里主要是贴代码,不多解释了)
前面给大家讲了整合的思路和整合的过程,在这里就不在提了,直接把springMVC+spring+Mybatis整合的实例代码(单表的增删改查)贴给大家: 首先是目录结构: 仔细看看这个目录结构:我不详 ...
- 由“单独搭建Mybatis”到“Mybatis与Spring的整合/集成”
在J2EE领域,Hibernate与Mybatis是大家常用的持久层框架,它们各有特点,在持久层框架中处于领导地位. 本文主要介绍Mybatis(对于较小型的系统,特别是报表较多的系统,个人偏向Myb ...
- spring+websocket整合
java-websocket的搭建非常之容易,没用框架的童鞋可以在这里下载撸主亲自调教好的java-websocket程序: Apach Tomcat 8.0.3+MyEclipse+maven+JD ...
- Hibernate 与 Spring 的整合
刚刚学习了hibernate和Spring的整合,现在来总结一下. 以实现一个功能为例,与大家分享一下整个过程. 需要实现的功能:建立一个Person类,该类包括name,sex,age,birtha ...
- Spring与Struts2整合VS Spring与Spring MVC整合
Spring与Struts2整合,struts.xml在src目录下 1.在web.xml配置监听器 web.xml <!-- 配置Spring的用于初始化ApplicationContext的 ...
- struts2+hibernate-jpa+Spring+maven 整合(1)
1.0.0 struts2 与 spring 的整合. 1.1.0 新建maven工程 , 编写pom.xml ,这里只需要简单的添加 一个组件就够了: 在myeclipse 生成的pom.xml 添 ...
随机推荐
- Windows10下安装MySQL8.0
1:首先去官网下载安装包 下载地址:https://dev.mysql.com/downloads/mysql/ 这是我下载版本 2:将解压文件解压到你安装的目录:E:\mysql-8.0.11-wi ...
- CCF-Markdown-201703-3
这道题不存在递归结构 比如区块之间的相互嵌套 还有"[ [] ]" 链接的相互嵌套, 所以直接处理就好了 还可以 #include <bits/stdc++.h> us ...
- Flex布局-项目的属性
Flex项目有以下6个属性: order flex-grow flex-shrink flex-basis flex align-self order属性定义项目的排列顺序.数值越小,排列越靠前,默认 ...
- Opensource Licenses
协议列表https://www.gnu.org/licenses/license-list.htmlhttps://opensource.org/licenses/alphabetical 协议选择参 ...
- LeetCode - Fruit Into Baskets
In a row of trees, the i-th tree produces fruit with type tree[i]. You start at any tree of your cho ...
- Vue的理解:Vue.js新手入门指南----转
最近在逛各大网站,论坛,以及像SegmentFault等编程问答社区,发现Vue.js异常火爆,重复性的提问和内容也很多,楼主自己也趁着这个大前端的热潮,着手学习了一段时间的Vue.js,目前用它正在 ...
- react使用ant-design组件库
新建项目并引入组件 1,全局安装脚手架 npm install -g create-react-app 2,新建项目 create-react-app reactantd 3,安装组件 npm ins ...
- Oracle中,如何将String插入到BLOB类型字段
1,String插入到BLOB类型字段,(这里的字符串以生成的XML为例): String XML = document.asXML(); //使用dom4j写成的xml是String类型,记得st ...
- 安装ORACLE高可用RAC集群11g执行root脚本的输出信息
安装ORACLE高可用RAC集群11g执行root脚本的输出信息 作者:Eric 微信:loveoracle11g [root@node1 ~]# /u01/app/oraInventory/orai ...
- Java 里面各种类型之间的相互转换
1.整形与字符型之间的数据类型转换: 一.int转换成char有两种方法: ① 是利用char的unicode编码 例:int num1 = 8; char ch1 = (char) (num1 + ...