* [bug#59081] fix bug for host metric.

This commit is contained in:
liyang
2025-01-09 13:30:54 +08:00
committed by 曹延义
parent 20cbf3c00c
commit 29bc4e51a9
2 changed files with 16 additions and 2 deletions
+14
View File
@@ -4746,3 +4746,17 @@ $config->bi->builtin->metrics[] = array
'desc' => '按系统统计的合并请求通过率是指已合并合并请求/总的合并请求数。通过统计在一定时间范围内提交的合并请求中合并的比例,团队能够有效监控其代码审查过程的健康状况,并及时识别潜在的改进空间。',
'definition' => "系统已合并合并请求/总的合并请求数\n不统计已删除的合并请求\n不统计已删除代码库里的合并请求\n"
);
$config->bi->builtin->metrics[] = array
(
'name' => '按系统统计主机总数',
'alias' => '主机总数',
'code' => 'count_of_host',
'purpose' => 'scale',
'scope' => 'system',
'object' => 'host',
'unit' => 'count',
'dateType' => 'nodate',
'desc' => '按系统统计的主机总数是指在禅道中的全部主机总数。',
'definition' => "所有主机的个数求和"
);
@@ -22,13 +22,13 @@ class count_of_host extends baseCalc
{
public $dataset = 'getHosts';
public $fieldList = array('id');
public $fieldList = array('id', 'type');
public $result = 0;
public function calculate($row)
{
$this->result += 1;
if($row->type == 'normal') $this->result += 1;
}
public function getResult($options = array())