方法列表

注意,下文的TrackerManager::getInstance()调用模式需要自行增加,trace介绍有说明

getTrackerToken()

获取链追踪器token

TrackerManager::getInstance()->getTracker()->getTrackerToken()
TrackerManager::getInstance()->getTracker(\Swoole\Coroutine::getuid())->getTrackerToken()

addAttribute()

添加追踪器标签

TrackerManager::getInstance()->getTracker()->addAttribute('user','用户名1');
TrackerManager::getInstance()->getTracker()->addAttribute('name','这是昵称');

getAttribute()

获取追踪器标签

TrackerManager::getInstance()->getTracker()->getAttribute('user');
TrackerManager::getInstance()->getTracker()->getAttribute('name');

getAttributes()

获取追踪器全部标签

TrackerManager::getInstance()->getTracker()->getAttribute()

getPointStacks()

获取调用栈

TrackerManager::getInstance()->getTracker()->getPointStacks()

setPoint()

设置一个调用点,返回TrackerPoint对象

 $trackerPoint = TrackerManager::getInstance()->getTracker()->setPoint('CurlBaiDu',['wd'=>'easyswoole'],'test1');
 $trackerPoint->endPoint($trackerPoint::STATUS_FAIL,['msg'=>'失败了']);//结束调用,记录状态以及结束参数
 //使用TrackerPoint对象endPoint方法结束

endPoint()

结束一个调用点

 $trackerPoint = TrackerManager::getInstance()->getTracker()->setPoint('CurlBaiDu',['wd'=>'easyswoole'],'test1');
 TrackerManager::getInstance()->getTracker()->endPoint('CurlBaiDu',$caller::STATUS_SUCCESS,['msg'=>'调用成功'.time()]);
 //使用Tracker对象endPoint方法结束

__toString()

字符串输出对象

toString()

按分类转为字符串

TrackerManager::getInstance()->getTracker()->toString()

stackToString()

调用栈转为字符串

TrackerManager::getInstance()->getTracker()->stackToString()

results matching ""

    No results matching ""