Skip to content

Commit

Permalink
Merge pull request #20 from jukylin/fix_traceid_len
Browse files Browse the repository at this point in the history
fix traceId length
  • Loading branch information
jky-yy authored Jun 20, 2018
2 parents eed11b7 + 1477a22 commit ff801e9
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 ff801e9

Please sign in to comment.