diff --git a/src/conduit/ConduitFuture.php b/src/conduit/ConduitFuture.php --- a/src/conduit/ConduitFuture.php +++ b/src/conduit/ConduitFuture.php @@ -5,7 +5,6 @@ private $client; private $engine; private $conduitMethod; - private $profilerCallID; public function setClient(ConduitClient $client, $method) { $this->client = $client; @@ -13,29 +12,19 @@ return $this; } - public function isReady() { - if ($this->profilerCallID === null) { - $profiler = PhutilServiceProfiler::getInstance(); - - $this->profilerCallID = $profiler->beginServiceCall( - array( - 'type' => 'conduit', - 'method' => $this->conduitMethod, - 'size' => $this->getProxiedFuture()->getHTTPRequestByteLength(), - )); - } + protected function getServiceProfilerStartParameters() { + return array( + 'type' => 'conduit', + 'method' => $this->conduitMethod, + 'size' => $this->getProxiedFuture()->getHTTPRequestByteLength(), + ); + } - return parent::isReady(); + protected function getServiceProfilerResultParameters() { + return array(); } protected function didReceiveResult($result) { - if ($this->profilerCallID !== null) { - $profiler = PhutilServiceProfiler::getInstance(); - $profiler->endServiceCall( - $this->profilerCallID, - array()); - } - list($status, $body, $headers) = $result; if ($status->isError()) { throw $status; diff --git a/src/conduit/FutureAgent.php b/src/conduit/FutureAgent.php --- a/src/conduit/FutureAgent.php +++ b/src/conduit/FutureAgent.php @@ -35,4 +35,11 @@ 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; + } + } diff --git a/src/future/Future.php b/src/future/Future.php --- a/src/future/Future.php +++ b/src/future/Future.php @@ -115,6 +115,10 @@ $params = $this->getServiceProfilerStartParameters(); + if ($params === null) { + return; + } + $profiler = PhutilServiceProfiler::getInstance(); $call_id = $profiler->beginServiceCall($params);