Skip to content

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sashengpeng committed Sep 30, 2020
1 parent 8c01f16 commit 53a2abb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/Base/EApmEventBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class EApmEventBase
*
* EApmEventBase constructor.
* @param EApmEventBase|null $parentEvent
* @throws \Exception
*/
public function __construct(?EApmEventBase $parentEvent = null)
{
Expand Down
11 changes: 7 additions & 4 deletions src/EApmComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class EApmComposer
* Agent version
* @const
*/
public const AGENT_VERSION = "1.1.1";
public const AGENT_VERSION = "1.1.2";

/**
* Agent name
Expand Down Expand Up @@ -394,6 +394,7 @@ public function startNewTransaction(string $name, string $type)
* @param EApmEventBase|null $parentEvent
*
* @return EApmTransaction
* @throws \Exception
*/
public function createNewTransaction(string $name, string $type, ?EApmEventBase $parentEvent = null) : EApmTransaction
{
Expand All @@ -404,9 +405,11 @@ public function createNewTransaction(string $name, string $type, ?EApmEventBase
$transaction->setTraceId($this->getDistributeTrace()->getTraceId());
$transaction->setParentId($this->getDistributeTrace()->getParentSpanId());
} else {
$transaction->setTraceId(
EApmRandomIdUtil::RandomIdGenerate(EApmDistributeTrace::TRACEID_LENGTH / 2)
);
if (is_null($transaction->getTraceId())) {
$transaction->setTraceId(
EApmRandomIdUtil::RandomIdGenerate(EApmDistributeTrace::TRACEID_LENGTH / 2)
);
}
}

return $transaction;
Expand Down
8 changes: 5 additions & 3 deletions src/Events/EApmTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ public function __construct(string $name, string $type, ?EApmEventBase $parentEv
$this->getComposer()->getDistributeTrace()->getParentSpanId()
);
} else {
$this->setTraceId(
EApmRandomIdUtil::RandomIdGenerate(EApmDistributeTrace::TRACEID_LENGTH / 2)
);
if (is_null($this->getTraceId())) {
$this->setTraceId(
EApmRandomIdUtil::RandomIdGenerate(EApmDistributeTrace::TRACEID_LENGTH / 2)
);
}
}
}
// prepare result
Expand Down

0 comments on commit 53a2abb

Please sign in to comment.