mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +01:00
Clean up some service profiler behavior in Conduit futures
Summary: Correct two minor Conduit future issues: - FutureAgent shows up in the trace log as "<mystery>". Since it isn't doing anything useful, solve the mystery and drop it from the log. - Simply the ConduitFuture code for interacting with the service profiler now that a more structured integration is available. Test Plan: Ran "arc branches --trace", saw conduit calls and no more "<mystery>" clutter. Differential Revision: https://secure.phabricator.com/D21388
This commit is contained in:
parent
b8a5191e3b
commit
01e91dc260
3 changed files with 20 additions and 20 deletions
|
@ -5,7 +5,6 @@ final class ConduitFuture extends FutureProxy {
|
||||||
private $client;
|
private $client;
|
||||||
private $engine;
|
private $engine;
|
||||||
private $conduitMethod;
|
private $conduitMethod;
|
||||||
private $profilerCallID;
|
|
||||||
|
|
||||||
public function setClient(ConduitClient $client, $method) {
|
public function setClient(ConduitClient $client, $method) {
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
|
@ -13,29 +12,19 @@ final class ConduitFuture extends FutureProxy {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isReady() {
|
protected function getServiceProfilerStartParameters() {
|
||||||
if ($this->profilerCallID === null) {
|
return array(
|
||||||
$profiler = PhutilServiceProfiler::getInstance();
|
'type' => 'conduit',
|
||||||
|
'method' => $this->conduitMethod,
|
||||||
|
'size' => $this->getProxiedFuture()->getHTTPRequestByteLength(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->profilerCallID = $profiler->beginServiceCall(
|
protected function getServiceProfilerResultParameters() {
|
||||||
array(
|
return array();
|
||||||
'type' => 'conduit',
|
|
||||||
'method' => $this->conduitMethod,
|
|
||||||
'size' => $this->getProxiedFuture()->getHTTPRequestByteLength(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::isReady();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function didReceiveResult($result) {
|
protected function didReceiveResult($result) {
|
||||||
if ($this->profilerCallID !== null) {
|
|
||||||
$profiler = PhutilServiceProfiler::getInstance();
|
|
||||||
$profiler->endServiceCall(
|
|
||||||
$this->profilerCallID,
|
|
||||||
array());
|
|
||||||
}
|
|
||||||
|
|
||||||
list($status, $body, $headers) = $result;
|
list($status, $body, $headers) = $result;
|
||||||
if ($status->isError()) {
|
if ($status->isError()) {
|
||||||
throw $status;
|
throw $status;
|
||||||
|
|
|
@ -35,4 +35,11 @@ abstract class FutureAgent
|
||||||
return $sockets;
|
return $sockets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getServiceProfilerStartParameters() {
|
||||||
|
// At least today, the agent construct doesn't add anything interesting
|
||||||
|
// to the trace and the underlying futures always show up in the trace
|
||||||
|
// themselves.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,10 @@ abstract class Future extends Phobject {
|
||||||
|
|
||||||
$params = $this->getServiceProfilerStartParameters();
|
$params = $this->getServiceProfilerStartParameters();
|
||||||
|
|
||||||
|
if ($params === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$profiler = PhutilServiceProfiler::getInstance();
|
$profiler = PhutilServiceProfiler::getInstance();
|
||||||
$call_id = $profiler->beginServiceCall($params);
|
$call_id = $profiler->beginServiceCall($params);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue