TarsCloud / Tars

Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
BSD 3-Clause "New" or "Revised" License
9.78k stars 2.08k forks source link

[BUG]设置 tars.tarsstat 服务日志按天切后, tars.tarsquerystat 服务查询报错 #864

Closed imjakey closed 7 months ago

imjakey commented 2 years ago

What version of TARS and what language are you using? web:2.4.16 framework:2.4.13 php

What operating system (Linux, Windows, ...) and version? [e.g. CentOS 7.8] CentOS Linux release 7.9.2009 (Core)

What runtime/compiler are you using? [e.g. JDK version or version of gcc] tars in docker

Describe the bug tars统计服务设置按天拆分后,由于统计查询服务没有识别切割参数,还是会按照小时切割的规则去拼接sql,会报table不存在的错误。 错误信息如下: 错误: query stat info code:0 ret: -1, msg: iDb:0|exception:[TC_Mysql::execute]: mysql_query: [ select sum(succ_count), sum(timeout_count), sum(exce_count), sum(total_time),f_tflag from tars_stat_2021091800 where 1=1 and slave_name like 'OAMicro.ScenarioServ' group by f_tflag order by null; ] :Table 'tars_stat.tars_stat_2021091800' doesn't exist

查看QueryStatServer/DbProxy.cpp 源码发现取table name的时候,没有支持 cutType 参数。 sTbName = sTbNamePre + day + tflag.substr(0,2);

To Reproduce Steps to reproduce the behavior:

  1. 运维管理 -> 模板管理 -> 编辑 tars.tarsstat 模板 -> 在 配置下面新增 CutType=day
  2. 重启 tars.tarsstat 服务
  3. 服务管理 -> 服务监控 -> 复现报错

Additional context Add any other context about the problem here.

ruanshudong commented 2 years ago

能改一下, 提交pr?