Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGarde committed Aug 22, 2019
2 parents ec6a255 + 6fd0553 commit 4d345a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/DataDogHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ public function set($stat, $value, $sampleRate = 1.0, $tags = null)
* @param float $sampleRate the rate (0-1) for sampling.
* @param array|string $tags Key Value array of Tag => Value, or single tag as string
* @param int $value the amount to increment by (default 1)
*
* @return boolean
**/
public function increment($stats, $sampleRate = 1.0, $tags = null, $value = 1)
{
Expand All @@ -192,8 +190,6 @@ public function increment($stats, $sampleRate = 1.0, $tags = null, $value = 1)
* @param float $sampleRate the rate (0-1) for sampling.
* @param array|string $tags Key Value array of Tag => Value, or single tag as string
* @param int $value the amount to decrement by (default -1)
*
* @return boolean
**/
public function decrement($stats, $sampleRate = 1.0, $tags = null, $value = -1)
{
Expand Down
8 changes: 7 additions & 1 deletion src/DoctrineFileLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function startQuery($sql, array $params = null, array $types = null)
public function stopQuery()
{
$tmp = app('router')->getCurrentRoute();
$tmp = method_exists($tmp, 'uri') ? $tmp->uri() : 'composerInstall';
$tmp = method_exists($tmp, 'uri') ? $tmp->uri() : 'unknown';
$route = ($tmp) ?: '';

$tag = [
Expand All @@ -75,6 +75,12 @@ public function stopQuery()
];
DataDog::increment('sql', 1, $tag);
DataDog::microtiming('sql.timing', $this->getExecutionTime(), 1, $tag);

// Some users may enable DataDog on Workers, if so lets periodically flush the buffer to DataDog
if (rand(1,100) === 1)
{
DataDog::flush();
}
}

/**
Expand Down

0 comments on commit 4d345a1

Please sign in to comment.