Skip to content

Commit

Permalink
Fixed Naming of cURL, PDO and Redis ActionWrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Kaviani committed May 8, 2019
1 parent 7e5739f commit 98f5c2a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ActionWrappers/APMGuzzleActionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function handleBefore($request, string $actionName, array $actionData = [
$txName = $this->apmAgent->getCurrentTransactionName();
$tx = $this->apmAgent->getTransactionEvent($txName);

$this->span = $tx->startSpan("cURL" , self::SPAN_TYPE);
$this->span = $tx->startSpan("cURL:" . $actionName , self::SPAN_TYPE);
$this->span->setSubType("http");

$this->setData("url", $request->getUri()->__toString());
Expand Down
2 changes: 1 addition & 1 deletion src/ActionWrappers/APMPdoActionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function handleBefore($stmt, string $actionName, array $actionData = [])
$txName = $this->apmAgent->getCurrentTransactionName();
$tx = $this->apmAgent->getTransactionEvent($txName);

$spanName = "PDO Query : " . $stmt->getServerName();
$spanName = "PDO:" . $stmt->getServerName();

$this->span = $tx->startSpan($spanName, self::SPAN_TYPE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ActionWrappers/APMRedisActionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function handleBefore($redisObject, string $actionName, array $actionData
$txName = $this->apmAgent->getCurrentTransactionName();
$tx = $this->apmAgent->getTransactionEvent($txName);

$this->span = $tx->startSpan("Redis : " . $redisObject->getServerIdentifier(), self::SPAN_TYPE);
$this->span = $tx->startSpan("Redis:" . $redisObject->getServerIdentifier(), self::SPAN_TYPE);
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/Middlewares/GuzzleAPMMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ public function __invoke(callable $handler) {
$apmActionWrapper = $this->actionWrapper;

$before = function($request, $options) use ($apmActionWrapper) {
$apmActionWrapper->handleBefore($request,'cURL',[]);
$type = $options['type'] ?? "General";
$apmActionWrapper->handleBefore($request,$type,[]);
//var_dump( "BTap " . microtime(true) );
};

$after = function($request,$option,$response) use ($apmActionWrapper) {
$response->then(function (\Psr\Http\Message\ResponseInterface $response) use($apmActionWrapper) {
$apmActionWrapper->handleAfter($response,'cURL',[]);
$type = $options['type'] ?? "General";
$response->then(function (\Psr\Http\Message\ResponseInterface $response) use($apmActionWrapper,$type) {
$apmActionWrapper->handleAfter($response,$type,[]);
});
};

Expand Down

0 comments on commit 98f5c2a

Please sign in to comment.