hyj1991/easy-monitor

[求助]本地部署:启动后应用显示【您的应用下尚未连接任何实例,请参照文档进行部署】

maple5233 opened this issue · 8 comments

想请教下如何自查

xprofiler-console 输出

$ egg-bin dev --port=8443
[egg-ts-helper] create typings/app/extend/application.d.ts (5ms)
[egg-ts-helper] create typings/app/extend/context.d.ts (6ms)
[egg-ts-helper] create typings/app/controller/index.d.ts (3ms)
[egg-ts-helper] create typings/app/middleware/index.d.ts (2ms)
[egg-ts-helper] create typings/config/index.d.ts (22ms)
[egg-ts-helper] create typings/config/plugin.d.ts (1ms)
[egg-ts-helper] create typings/app/service/index.d.ts (2ms)
[egg-ts-helper] create typings/app/index.d.ts (0ms)
2021-11-29 17:45:44,331 INFO 49327 [master] node version v14.18.1
2021-11-29 17:45:44,332 INFO 49327 [master] egg version 2.32.0
2021-11-29 17:45:45,123 INFO 49338 [RemoteConfig] loading remote config and save to ~/code/easy-monitor/xprofiler-console/run/remote_config.json
2021-11-29 17:45:45,128 INFO 49327 [master] agent_worker#1:49338 started (794ms)
2021-11-29 17:45:45,833 INFO 49340 [RemoteConfig] loading remote config from ~/code/easy-monitor/xprofiler-console/run/remote_config.json
2021-11-29 17:45:46,087 INFO 49327 [master] egg started on http://127.0.0.1:8443 (1755ms)

xtransit-manager 输出

$ egg-bin dev --port=8543
[egg-ts-helper] create typings/app/extend/application.d.ts (3ms)
[egg-ts-helper] create typings/app/extend/context.d.ts (4ms)
[egg-ts-helper] create typings/app/controller/index.d.ts (2ms)
[egg-ts-helper] create typings/app/middleware/index.d.ts (1ms)
[egg-ts-helper] create typings/config/index.d.ts (17ms)
[egg-ts-helper] create typings/config/plugin.d.ts (1ms)
[egg-ts-helper] create typings/app/service/index.d.ts (3ms)
[egg-ts-helper] create typings/app/index.d.ts (1ms)
2021-11-29 17:45:45,957 INFO 49337 [master] node version v14.18.1
2021-11-29 17:45:45,958 INFO 49337 [master] egg version 2.32.0
2021-11-29 17:45:46,771 INFO 49347 [RemoteConfig] loading remote config and save to ~/code/easy-monitor/xtransit-manager/run/remote_config.json
2021-11-29 17:45:46,776 INFO 49337 [master] agent_worker#1:49347 started (816ms)
2021-11-29 17:45:47,514 INFO 49348 [RemoteConfig] loading remote config from ~/code/easy-monitor/xtransit-manager/run/remote_config.json
2021-11-29 17:45:47,931 INFO 49337 [master] egg started on http://127.0.0.1:8543 (1973ms)

xtransit-server 输出

$ nodemon dispatch.js
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node dispatch.js`
websockt server listening at 9090...

mysql 无任何数据

mysql> SELECT SUM(TABLE_ROWS)       FROM INFORMATION_SCHEMA.TABLES
  WHERE TABLE_SCHEMA ='xprofiler_logs';
+-----------------+
| SUM(TABLE_ROWS) |
+-----------------+
|               0 |
+-----------------+
1 row in set (0.14 sec)

tmp目录下日志正常

tail /tmp/xprofiler-20211129.log
[2021-11-29 19:01:45] [info] [cpu] [51499] [1.2.6] cpu_usage(%) cpu_now: 0.000000, cpu_15: 0.000000, cpu_30: 0.000000, cpu_60: 0.000000
[2021-11-29 19:01:45] [info] [memory] [51499] [1.2.6] memory_usage(byte) rss: 33492992, heap_used: 13485600, heap_available: 4332586464, heap_total: 14512128, heap_limit: 4345298944, heap_executeable: 573440, total_physical_size: 14047304, malloced_memory: 8192, amount_of_external_allocated_memory: 1613229, new_space_size: 1048576, new_space_used: 841088, new_space_available: 206336, new_space_committed: 842144, old_space_size: 10383360, old_space_used: 10317912, old_space_available: 22920, old_space_committed: 10364016, code_space_size: 360448, code_space_used: 180544, code_space_available: 14464, code_space_committed: 211008, map_space_size: 1052672, map_space_used: 541512, map_space_available: 508504, map_space_committed: 963936, lo_space_size: 1466368, lo_space_used: 1451272, lo_space_available: 0, lo_space_committed: 1466368, read_only_space_size: 151552, read_only_space_used: 150392, read_only_space_available: 0, read_only_space_committed: 150680, new_lo_space_size: 0, new_lo_space_used: 0, new_lo_space_available: 1047424, new_lo_space_committed: 0, code_lo_space_size: 49152, code_lo_space_used: 2880, code_lo_space_available: 0, code_lo_space_committed: 49152,
[2021-11-29 19:01:45] [info] [gc] [51499] [1.2.6] uptime: 2427, total_gc_times: 18, total_gc_duration: 7, total_scavange_duration: 0, total_marksweep_duration: 7, total_incremental_marking_duration: 0, gc_time_during_last_record: 0, scavange_duration_last_record: 0, marksweep_duration_last_record: 0, incremental_marking_duration_last_record: 0
[2021-11-29 19:01:45] [info] [uv] [51499] [1.2.6] active_handles: 1, active_file_handles: 0, active_and_ref_file_handles: 0, active_tcp_handles: 1, active_and_ref_tcp_handles: 1, active_udp_handles: 0, active_and_ref_udp_handles: 0, active_timer_handles: 0, active_and_ref_timer_handles: 0
[2021-11-29 19:01:45] [info] [http] [51499] [1.2.6] live_http_request: 0, http_response_close: 0, http_response_sent: 0, http_request_timeout: 0, http_patch_timeout: 30, http_rt: 0.00
[2021-11-29 19:01:55] [info] [cpu] [51499] [1.2.6] cpu_usage(%) cpu_now: 0.000000, cpu_15: 0.000000, cpu_30: 0.000000, cpu_60: 0.000000
[2021-11-29 19:01:55] [info] [memory] [51499] [1.2.6] memory_usage(byte) rss: 33492992, heap_used: 13485656, heap_available: 4332586408, heap_total: 14512128, heap_limit: 4345298944, heap_executeable: 573440, total_physical_size: 14047360, malloced_memory: 8192, amount_of_external_allocated_memory: 1613229, new_space_size: 1048576, new_space_used: 841144, new_space_available: 206280, new_space_committed: 842200, old_space_size: 10383360, old_space_used: 10317912, old_space_available: 22920, old_space_committed: 10364016, code_space_size: 360448, code_space_used: 180544, code_space_available: 14464, code_space_committed: 211008, map_space_size: 1052672, map_space_used: 541512, map_space_available: 508504, map_space_committed: 963936, lo_space_size: 1466368, lo_space_used: 1451272, lo_space_available: 0, lo_space_committed: 1466368, read_only_space_size: 151552, read_only_space_used: 150392, read_only_space_available: 0, read_only_space_committed: 150680, new_lo_space_size: 0, new_lo_space_used: 0, new_lo_space_available: 1047424, new_lo_space_committed: 0, code_lo_space_size: 49152, code_lo_space_used: 2880, code_lo_space_available: 0, code_lo_space_committed: 49152,
[2021-11-29 19:01:55] [info] [gc] [51499] [1.2.6] uptime: 2437, total_gc_times: 18, total_gc_duration: 7, total_scavange_duration: 0, total_marksweep_duration: 7, total_incremental_marking_duration: 0, gc_time_during_last_record: 0, scavange_duration_last_record: 0, marksweep_duration_last_record: 0, incremental_marking_duration_last_record: 0
[2021-11-29 19:01:55] [info] [uv] [51499] [1.2.6] active_handles: 1, active_file_handles: 0, active_and_ref_file_handles: 0, active_tcp_handles: 1, active_and_ref_tcp_handles: 1, active_udp_handles: 0, active_and_ref_udp_handles: 0, active_timer_handles: 0, active_and_ref_timer_handles: 0
[2021-11-29 19:01:55] [info] [http] [51499] [1.2.6] live_http_request: 0, http_response_close: 0, http_response_sent: 0, http_request_timeout: 0, http_patch_timeout: 30, http_rt: 0.00

node代码

require('xprofiler').start({
  log_level: 2,
  enable_log_uv_handles: true,
  log_dir: '/tmp',
  log_format_alinode: false,
  log_interval: 10
});
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
}
bootstrap();

看文档,xtransit 都没接入怎么会有实例。

可以参考文档里的架构图,xprofiler 只是一个生成性能日志的插件,xtransit 是一个类似 agent 一样的客户端,负责将实例接入监控服务端中,并且定时上报日志。

看文档,xtransit 都没接入怎么会有实例。

感谢回答 @hyj1991 xtransit是有接入的

$ xtransit list
|- App ID -|- PID -|---- Start Time -----|--- Config Path ------------------------------------|
|        1 | 52623 | 2021-11-29 18:47:19 |  code/shopee/easy-monitor/config.js |
|----------|-------|---------------------|----------------------------------------------------|
// config.js

module.exports = {
    // I. 必须的配置(一定要写)
    server: `ws://127.0.0.1:9090`, // 填写前一节中部署的 xtransit-server 地址
    appId: 1, // 创建应用得到的应用 ID
    appSecret: '这个copy了', // 创建应用得到的应用 Secret
    
    // III. 不是很重要的可选的配置(不知道怎么配置的别传任何值)
    logDir: '/tmp', // xprofiler 插件生成性能日志文件的目录,默认两者均为 os.tmpdir()
 
  };

xtransit-server 也换个端口 9091,然后 xtransit 那边配置也改下

有些机器上 9090 端口被代理占用掉了

xtransit-server 也换个端口 9091,然后 xtransit 那边配置也改下

好了 感谢~~~

可以加钉钉群,有问题在那响应会快一些

可以加钉钉群,有问题在那响应会快一些

已经加啦