Skip to content

Commit

Permalink
fix traceId length
Browse files Browse the repository at this point in the history
  • Loading branch information
jky-yy committed Jun 19, 2018
1 parent eed11b7 commit 1477a22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Jaeger/Jaeger.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public function flush(){


private function generateId(){
return microtime(true) * 10000 . rand(1000, 9999);
return microtime(true) * 10000 . rand(10000, 99999);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Jaeger/SpanContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public function isSampled(){

public function traceIdToString($traceId){
$len = strlen($traceId);
if($len > 15){
$this->traceIdHigh = hexdec(substr($traceId, 0, 15));
$this->traceIdLow = hexdec(substr($traceId, 15));
if($len > 16){
$this->traceIdHigh = hexdec(substr($traceId, 0, 16));
$this->traceIdLow = hexdec(substr($traceId, 16));
}else{
$this->traceIdLow = hexdec($traceId);
}
Expand Down

0 comments on commit 1477a22

Please sign in to comment.