-
Notifications
You must be signed in to change notification settings - Fork 543
InfluxDB_
LinShunkang edited this page Jul 16, 2018
·
18 revisions
MyPerf4J默认支持使用InfluxDB进行数据存储
- MyPerf4J通过InfluxDBLoggerProcessor向用户指定的日志文件中写入LineProtocol格式的性能统计数据
- 通过日志收集器Telegraf从日志文件中读取数据并导入InfluxDB中。
具体步骤如下:
-
项目依赖和配置
-
在pom.xml中添加
MyPerf4J-Extension
依赖<dependency> <groupId>MyPerf4J</groupId> <artifactId>MyPerf4J-Extension</artifactId> <version>${MyPerf4J-version}</version> </dependency>
-
配置
Logbak
/Log4j
等日志框架的依赖,下面以Logback
为例进行配置- 在pom.xml中添加
Logback
依赖
<dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>${logback-classic-version}</version> </dependency>
- 配置logback.xml
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="30 seconds"> <appender name="metrics" class="ch.qos.logback.core.rolling.RollingFileAppender"> <Append>true</Append> <file>/data/logs/MyPerf4J/metrics.log</file> <encoder> <pattern>%msg%n</pattern> <charset>UTF-8</charset> </encoder> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>/data/logs/MyPerf4J/metrics.log.%d{yyyy-MM-dd}</FileNamePattern> <MaxHistory>7</MaxHistory> </rollingPolicy> </appender> <appender name="metrics-async" class="ch.qos.logback.classic.AsyncAppender"> <queueSize>1024</queueSize> <appender-ref ref="metrics"/> </appender> <logger name="cn.myperf4j.ext.psp.InfluxDBLoggerProcessor" additivity="false"> <level value="INFO"/> <appender-ref ref="metrics-async"/> </logger> <root> <level value="ERROR"/> </root> </configuration>
- 在pom.xml中添加
-
在
MyPerf4JPropFile
配置文件中指定:PerfStatsProcessor=cn.myperf4j.ext.psp.InfluxDBLoggerProcessor
-
-
InfluxDB
* Home
- Chinese-Doc
-
English Doc
- MyPerf4J
- Time Series Database
- Log Collector
- Visualization Platform