Skip to content

Commit

Permalink
Merge pull request #21 from sourceability/fix-style
Browse files Browse the repository at this point in the history
Fix code style
  • Loading branch information
magikid authored Nov 29, 2023
2 parents 99a8a8a + ed800dd commit 421ce69
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Profiler/DatadogProfiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function __construct(LoggerInterface $logger)
$this->logger = $logger;

$sampleRateString = getenv('DD_TRACE_SAMPLE_RATE');
if(is_numeric($sampleRateString)) {
$sampleRate = floatval($sampleRateString);
if (is_numeric($sampleRateString)) {
$sampleRate = (float) $sampleRateString;
$this->sampleRate = $sampleRate;
}
}
Expand All @@ -41,7 +41,7 @@ public function start(string $name, ?string $kind = null): void
return;
}

if($this->rateLimited()) {
if ($this->rateLimited()) {
return;
}

Expand Down Expand Up @@ -104,6 +104,7 @@ public function stopAndIgnore(): void
private function rateLimited(): bool
{
$randomFloat = mt_rand() / mt_getrandmax(); // between 0 and 1

return $randomFloat > $this->sampleRate;
}

Expand Down

0 comments on commit 421ce69

Please sign in to comment.