Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grafana没有数据,怎么排查influxdb是否写入成功? #100

Closed
bruce256 opened this issue Oct 12, 2023 · 9 comments
Closed

grafana没有数据,怎么排查influxdb是否写入成功? #100

bruce256 opened this issue Oct 12, 2023 · 9 comments
Labels
question Further information is requested

Comments

@bruce256
Copy link

问题描述
应用启动成功,grafana没有数据,日志正常,不知道哪一步的问题。怎么看是否influxdb数据写入正常

运行环境

  • MyPerf4J 版本号,3.4.0
  • JDK 版本号,JDK8
  • 运行容器和框架,SpringBoot
  • 操作系统,MacOS
  • influxdb, 2.7.1

JVM启动参数

-javaagent:/Users/**/work/develop_tools/MyPerf4J-ASM-3.4.0-SNAPSHOT/MyPerf4J-ASM-3.4.0-SNAPSHOT.jar 
-DMyPerf4JPropFile=/Users/**/work/develop_tools/MyPerf4J-ASM-3.4.0-SNAPSHOT/MyPerf4J.properties

配置文件

# MyPerf4J 所有配置请参考:https://github.com/LinShunKang/MyPerf4J/wiki/%E9%85%8D%E7%BD%AE

# 配置监控应用的名称
app_name = MyApp

debug = true

###############################################################################
#                           Metrics Configuration                             #
###############################################################################

# 配置 MetricsExporter 类型
#	log.stdout: 	以标准格式化结构输出到 stdout.log
#	log.standard: 	以标准格式化结构输出到磁盘
#	log.influxdb: 	以 InfluxDB LineProtocol 格式输出到磁盘
#	http.influxdb: 	以 InfluxDB LineProtocol 格式发送至 InfluxDB server,需要另行增加 influxdb 的配置
metrics.exporter = http.influxdb: 

# 配置各项监控指标日志的文件路径
# 如果 metrics.exporter 配置为 log.influxdb,建议把所有的 metrics.log.* 路径配置成一样以方便 Telegraf 收集
metrics.log.method = /data/logs/MyPerf4J/metrics.log
metrics.log.class_loading = /data/logs/MyPerf4J/metrics.log
metrics.log.gc = /data/logs/MyPerf4J/metrics.log
metrics.log.memory = /data/logs/MyPerf4J/metrics.log
metrics.log.buff_pool = /data/logs/MyPerf4J/metrics.log
metrics.log.thread = /data/logs/MyPerf4J/metrics.log
metrics.log.file_desc = /data/logs/MyPerf4J/metrics.log
metrics.log.compilation = /data/logs/MyPerf4J/metrics.log


###############################################################################
#                           Filter Configuration                              #
###############################################################################

# 配置需要监控的package,可配置多个,用英文';'分隔
#   com.demo.p1 代表包含以 com.demo.p1 为前缀的所有包和类
#   [] 表示集合的概念:例如,com.demo.[p1,p2,p3] 代表包含以 com.demo.p1、com.demo.p2 和 com.demo.p3 为前缀的所有包和类,等价于 com.demo.p1;com.demo.p2;com.demo.p3
#   * 表示通配符:可以指代零个或多个字符,例如,com.*.demo.*
filter.packages.include = cn.perf4j.demo;

# 配置不需要监控的package,可配置多个,用英文';'分隔
filter.packages.exclude = cn.perf4j.demo.dao.DemoDAOImpl


###############################################################################
#                           InfluxDB Configuration                              #
###############################################################################
influxdb.version=2.7.1
influxdb.orgName=root #根据实际配置修改
influxdb.host = 127.0.0.1
influxdb.port = 8086
influxdb.database = myperf4j
influxdb.username = root
influxdb.password = 12345678
influxdb.conn_timeout =	3000
influxdb.read_timeout = 5000


异常堆栈

Connected to the target VM, address: '127.0.0.1:56032', transport: 'socket'
2023-10-12 09:38:34.414 [MyPerf4J] INFO [main] Thanks sincerely for using MyPerf4J.
2023-10-12 09:38:34.482 [MyPerf4J] INFO [main] http.server.port is not configured, so use '2048,2000,2040' as default.
2023-10-12 09:38:34.491 [MyPerf4J] INFO [main] ClassLevelMapping is blank, so use default mappings.
2023-10-12 09:38:34.627 [MyPerf4J] INFO [main] Use 2048 as HttpServer port.
2023-10-12 09:38:34.661 [MyPerf4J] INFO [pool-1-thread-1] SimpleHttpServer listen on 0:0:0:0:0:0:0:0:2048
2023-10-12 09:38:34.669 [MyPerf4J] INFO [main] 
    __  ___      ____            ______ __      __
   /  |/  /_  __/ __ \___  _____/ __/ // /     / /
  / /|_/ / / / / /_/ / _ \/ ___/ /_/ // /___  / / 
 / /  / / /_/ / ____/  __/ /  / __/__  __/ /_/ /  
/_/  /_/\__, /_/    \___/_/  /_/    /_/  \____/   
       /____/                                     v3.4.0-SNAPSHOT

2023-10-12 09:38:34.669 [MyPerf4J] INFO [main] AbstractBootstrap doInitial() SUCCESS!!!

grafana

@bruce256 bruce256 added the question Further information is requested label Oct 12, 2023
@LinShunKang
Copy link
Owner

你登录 InfluxDB 看看里面有没有数据就知道了

@bruce256
Copy link
Author

myperf4j有没有关键日志可以判断? 我登陆了influxdb管理台,我的bucket里面貌似只有influxdb自己的数据,没有监控相关的

influxdb

@LinShunKang
Copy link
Owner

myperf4j有没有关键日志可以判断? 我登陆了influxdb管理台,我的bucket里面貌似只有influxdb自己的数据,没有监控相关的

influxdb

你可以把 MyPerf4J.properties 里的 debug 配置为 true:debug = true

@bruce256
Copy link
Author

myperf4j有没有关键日志可以判断? 我登陆了influxdb管理台,我的bucket里面貌似只有influxdb自己的数据,没有监控相关的
influxdb

你可以把 MyPerf4J.properties 里的 debug 配置为 true:debug = true

已经配置了,用“influxdb”搜索系统启动日志,没看到太多关键的日志

@LinShunKang
Copy link
Owner

myperf4j有没有关键日志可以判断? 我登陆了influxdb管理台,我的bucket里面貌似只有influxdb自己的数据,没有监控相关的
influxdb

你可以把 MyPerf4J.properties 里的 debug 配置为 true:debug = true

已经配置了,用“influxdb”搜索系统启动日志,没看到太多关键的日志

你搜索 MyPerf4J

@bruce256
Copy link
Author

myperf4j有没有关键日志可以判断? 我登陆了influxdb管理台,我的bucket里面貌似只有influxdb自己的数据,没有监控相关的
influxdb

你可以把 MyPerf4J.properties 里的 debug 配置为 true:debug = true

已经配置了,用“influxdb”搜索系统启动日志,没看到太多关键的日志

你搜索 MyPerf4J

MyPerf4j相关的日志我贴出来了,并没有显示influxdb相关的

2023-10-18 09:05:06.622 [MyPerf4J] INFO [main] Thanks sincerely for using MyPerf4J.
2023-10-18 09:05:06.748 [MyPerf4J] INFO [main] http.server.port is not configured, so use '2048,2000,2040' as default.
2023-10-18 09:05:06.772 [MyPerf4J] INFO [main] ClassLevelMapping is blank, so use default mappings.
2023-10-18 09:05:06.870 [MyPerf4J] INFO [main] AutoRollingFileWriter.rollingFile(Wed Oct 18 09:05:06 CST 2023): rename /data/logs/MyPerf4J/metrics.log to metrics.log.2023-10-16 success
2023-10-18 09:05:07.053 [MyPerf4J] INFO [main] Use 2048 as HttpServer port.
2023-10-18 09:05:07.109 [MyPerf4J] INFO [main]
__ ___ ____ ______ __ __
/ |/ /_ / __ _ __/ / // / / /
/ /|/ / / / / // / _ / / // // /
/ /
/ / / / // / / __/ / / / __/ // /
/
/ /
/_
, /
/ _
// // // _
/
/____/ v3.4.0-SNAPSHOT

2023-10-18 09:05:07.109 [MyPerf4J] INFO [main] AbstractBootstrap doInitial() SUCCESS!!!
2023-10-18 09:05:07.171 [MyPerf4J] INFO [pool-1-thread-1] SimpleHttpServer listen on 0:0:0:0:0:0:0:0:2048
2023-10-18 09:06:52.634 [MyPerf4J] INFO [main] ProfilingTransformer.transform(sun.misc.Launcher$AppClassLoader, com/alibaba/dubbo/rpc/proxy/InvokerInvocationHandler, classBeingRedefined, protectionDomain, 2149)...
2023-10-18 09:06:52.652 [MyPerf4J] DEBUG [main] ProfilingClassAdapter.visit(50, 33, com/alibaba/dubbo/rpc/proxy/InvokerInvocationHandler, null, java/lang/Object, [java/lang/reflect/InvocationHandler])
2023-10-18 09:06:52.658 [MyPerf4J] DEBUG [main] ProfilingClassAdapter.visitMethod(1, invoke, (Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;, null, [java/lang/Throwable]), innerClassName=com/alibaba/dubbo/rpc/proxy/InvokerInvocationHandler
023-10-18 09:06:53.682 [MyPerf4J] INFO [main] ProfilingTransformer.transform(sun.misc.Launcher$AppClassLoader, org/apache/ibatis/binding/MapperProxyFactory, classBeingRedefined, protectionDomain, 2433)...
2023-10-18 09:06:53.683 [MyPerf4J] DEBUG [main] ProfilingClassAdapter.visit(52, 33, org/apache/ibatis/binding/MapperProxyFactory, <T:Ljava/lang/Object;>Ljava/lang/Object;, java/lang/Object, [])
2023-10-18 09:06:53.683 [MyPerf4J] DEBUG [main] ProfilingClassAdapter.visitMethod(4, newInstance, (Lorg/apache/ibatis/binding/MapperProxy;)Ljava/lang/Object;, (Lorg/apache/ibatis/binding/MapperProxy<TT;>;)TT;, null), innerClassName=org/apache/ibatis/binding/MapperProxyFactory
2023-10-18 09:06:53.686 [MyPerf4J] DEBUG [main] ProfilingClassAdapter.visitMethod(1, newInstance, (Lorg/apache/ibatis/session/SqlSession;)Ljava/lang/Object;, (Lorg/apache/ibatis/session/SqlSession;)TT;, null), innerClassName=org/apache/ibatis/binding/MapperProxyFactory
2023-10-18 09:06:53.903 [MyPerf4J] INFO [main] ProfilingTransformer.transform(sun.misc.Launcher$AppClassLoader, org/apache/ibatis/binding/MapperProxy, classBeingRedefined, protectionDomain, 7348)...
2023-10-18 09:06:53.904 [MyPerf4J] DEBUG [main] ProfilingClassAdapter.visit(52, 33, org/apache/ibatis/binding/MapperProxy, <T:Ljava/lang/Object;>Ljava/lang/Object;Ljava/lang/reflect/InvocationHandler;Ljava/io/Serializable;, java/lang/Object, [java/lang/reflect/InvocationHandler, java/io/Serializable])
2023-10-18 09:06:53.904 [MyPerf4J] DEBUG [main] ProfilingClassAdapter.visitMethod(1, invoke, (Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;, null, [java/lang/Throwable]), innerClassName=org/apache/ibatis/binding/MapperProxy
2023-10-18 09:07:00.006 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-0] LightWeightScheduler.runTask(ProfilingFileGenerator, 1697591160003) cost: 2ms
2023-10-18 09:07:00.006 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-0] RecorderMaintainer.nextRecorders(long, long) curIndex=1
2023-10-18 09:07:00.009 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-0] LightWeightScheduler.runTask(RecorderMaintainer, 1697591160006) cost: 3ms
2023-10-18 09:07:00.017 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-1] LightWeightScheduler.runTask(JvmMetricsCollector, 1697591160001) cost: 16ms
2023-10-18 09:07:00.030 [MyPerf4J] DEBUG [MyPerf4J-BackgroundExecutor_0] ExportMetricsTask.run() finished!!! cost: 9ms
2023-10-18 09:08:00.002 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-1] LightWeightScheduler.runTask(JvmMetricsCollector, 1697591220000) cost: 2ms
2023-10-18 09:08:00.002 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-0] LightWeightScheduler.runTask(ProfilingFileGenerator, 1697591220002) cost: 0ms
2023-10-18 09:08:00.005 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-1] RecorderMaintainer.nextRecorders(long, long) curIndex=0
2023-10-18 09:08:00.006 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-1] LightWeightScheduler.runTask(RecorderMaintainer, 1697591220005) cost: 1ms
2023-10-18 09:08:00.020 [MyPerf4J] DEBUG [MyPerf4J-BackgroundExecutor_0] ExportMetricsTask.run() finished!!! cost: 2ms

@LinShunKang
Copy link
Owner

把 'metrics.exporter = http.influxdb:' 改为 'metrics.exporter = http.influxdb'

@bruce256
Copy link
Author

bruce256 commented Oct 19, 2023

把 'metrics.exporter = http.influxdb:' 改为 'metrics.exporter = http.influxdb'

metrics.exporter = http.influxdb 这个配置项改好了,好隐蔽的问题。现在向influxdb发请求报400错误。

2023-10-19 09:42:21.758 [MyPerf4J] INFO [main] Thanks sincerely for using MyPerf4J.
2023-10-19 09:42:21.845 [MyPerf4J] INFO [main] http.server.port is not configured, so use '2048,2000,2040' as default.
2023-10-19 09:42:21.854 [MyPerf4J] INFO [main] ClassLevelMapping is blank, so use default mappings.
2023-10-19 09:42:22.188 [MyPerf4J] INFO [main] InfluxDbV2Client login response.status=HttpRespStatus{code=204, phrase='No Content'}
2023-10-19 09:42:22.189 [MyPerf4J] INFO [main] Loading .MyApp_SysGenProfilingFile to init profiling params.
2023-10-19 09:42:22.283 [MyPerf4J] INFO [main] Use 2048 as HttpServer port.
2023-10-19 09:42:22.327 [MyPerf4J] INFO [main] 

2023-10-19 09:43:00.073 [MyPerf4J] DEBUG [MyPerf4J-BackgroundExecutor_0] ExportMetricsTask.run() finished!!! cost: 54ms
2023-10-19 09:43:00.082 [MyPerf4J] DEBUG [MyPerf4J-LightWeightScheduler-0] LightWeightScheduler.runTask(JvmMetricsCollector, 1697679720005) cost: 77ms
2023-10-19 09:43:00.092 [MyPerf4J] WARN [MyPerf4J-InfluxDbV2Client_0] InfluxDbV2Client.writeMetricsSync(): respStatus='400 Bad Request', reqBody=jvm_class_metrics,AppName=MyApp,host=lvsheng1-Mac666.local Total=19897i,Loaded=19897i,Unloaded=0i 1697679720005000000
2023-10-19 09:43:00.093 [MyPerf4J] WARN [MyPerf4J-InfluxDbV2Client_0] InfluxDbV2Client.writeMetricsSync(): respStatus='400 Bad Request', reqBody=jvm_gc_metrics_v2,AppName=MyApp,host=lvsheng1-Mac666.local YoungGcCount=14i,YoungGcTime=161i,AvgYoungGcTime=11.50,FullGcCount=4i,FullGcTime=281i,ZGcTime=0i,ZGcCount=0i,AvgZGcTime=0.00,ZGcCyclesTime=0i,ZGcCyclesCount=0i,AvgZGcCyclesTime=0.00,ZGcPausesTime=0i,ZGcPausesCount=0i,AvgZGcPausesTime=0.00 1697679720005000000
2023-10-19 09:43:00.094 [MyPerf4J] WARN [MyPerf4J-InfluxDbV2Client_0] InfluxDbV2Client.writeMetricsSync() catch IOException: Connection reset
2023-10-19 09:43:00.095 [MyPerf4J] WARN [MyPerf4J-InfluxDbV2Client_0] InfluxDbV2Client.writeMetricsSync(): respStatus='400 Bad Request', reqBody=jvm_memory_metrics_v2,AppName=MyApp,host=lvsheng1-Mac666.local HeapUsed=683538i,HeapUsedPercent=18.33,NonHeapUsed=163047i,NonHeapUsedPercent=0.00,PermGenUsed=0i,PermGenUsedPercent=0.00,MetaspaceUsed=110665i,MetaspaceUsedPercent=0.00,CodeCacheUsed=38841i,CodeCacheUsedPercent=29.63,OldGenUsed=70154i,OldGenUsedPercent=2.51,EdenUsed=613384i,EdenUsedPercent=45.88,SurvivorUsed=0i,SurvivorUsedPercent=0.0 1697679720005000000
2023-10-19 09:43:00.098 [MyPerf4J] WARN [MyPerf4J-InfluxDbV2Client_0] InfluxDbV2Client.writeMetricsSync(): respStatus='400 Bad Request', reqBody=jvm_buffer_pool_metrics_v2,AppName=MyApp,PoolName=direct,host=lvsheng1-Mac666.local Count=6i,MemoryUsed=52i,MemoryCapacity=52i 1697679720005000000
jvm_buffer_pool_metrics_v2,AppName=MyApp,PoolName=mapped,host=lvsheng1-Mac666.local Count=0i,MemoryUsed=0i,MemoryCapacity=0i 1697679720005000000
2023-10-19 09:43:00.099 [MyPerf4J] WARN [MyPerf4J-InfluxDbV2Client_0] InfluxDbV2Client.writeMetricsSync(): respStatus='400 Bad Request', reqBody=jvm_thread_metrics,AppName=MyApp,host=lvsheng1-Mac666.local TotalStarted=144i,Active=117i,Peak=117i,Daemon=77i,New=0i,Runnable=21i,Blocked=0i,Waiting=57i,TimedWaiting=39i,Terminated=0i 1697679720005000000
2023-10-19 09:43:00.100 [MyPerf4J] WARN [MyPerf4J-InfluxDbV2Client_0] InfluxDbV2Client.writeMetricsSync(): respStatus='400 Bad Request', reqBody=jvm_compilation_metrics,AppName=MyApp,host=lvsheng1-Mac666.local Time=27539i,TotalTime=27539i 1697679720005000000
2023-10-19 09:43:00.100 [MyPerf4J] WARN [MyPerf4J-InfluxDbV2Client_0] InfluxDbV2Client.writeMetricsSync(): respStatus='400 Bad Request', reqBody=jvm_file_descriptor_metrics,AppName=MyApp,host=lvsheng1-Mac666.local OpenCount=423i,OpenPercent=4.130859375 1697679720005000000

查influxdb的官方文档,https://docs.influxdata.com/influxdb/cloud/write-data/troubleshoot/ 提示数据格式不正确?

@bruce256
Copy link
Author

https://brucelee.blog.csdn.net/article/details/133940727 OK了,我把我的接入经验写了一篇帖子

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants