mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
28 lines
1.5 KiB
PHP
28 lines
1.5 KiB
PHP
<?php
|
||
|
||
use think\migration\Migrator;
|
||
|
||
/**
|
||
* XHProf 性能日志 - 函数监控规则表
|
||
*
|
||
* regex 为 PCRE 正则,导入任务按被调用(callee)函数名匹配,命中边聚合到 run_watch 表。
|
||
*/
|
||
class XhprofWatch extends Migrator
|
||
{
|
||
public function change()
|
||
{
|
||
$table = $this->table('xhprof_watch', ['id' => false, 'primary_key' => ['id']])
|
||
->setComment('XHProf 函数监控规则')
|
||
->addColumn('id', 'integer', ['limit' => 11, 'null' => false, 'signed' => false, 'identity' => true, 'comment' => '主键ID'])
|
||
->addColumn('name', 'string', ['limit' => 100, 'null' => false, 'comment' => '规则名称(人读)'])
|
||
->addColumn('regex', 'string', ['limit' => 255, 'null' => false, 'comment' => 'PCRE 正则(对被调用函数名匹配)'])
|
||
->addColumn('note', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '备注'])
|
||
->addColumn('threshold_ms', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '比对阈值(毫秒),0=不比对'])
|
||
->addColumn('status', 'tinyinteger', ['limit' => 4, 'default' => 1, 'comment' => '状态:1=启用,0=禁用'])
|
||
->addColumn('create_time', 'integer', ['limit' => 11, 'comment' => '创建时间戳', 'signed' => false])
|
||
->addColumn('update_time', 'integer', ['limit' => 11, 'comment' => '更新时间戳', 'signed' => false])
|
||
->addIndex(['regex'], ['unique' => true, 'name' => 'uniq_regex'])
|
||
->create();
|
||
}
|
||
}
|