Skip to content

Commit

Permalink
Merge pull request #10 from bethinkpl/IT-3172-limit-max-spans
Browse files Browse the repository at this point in the history
IT-3172 | Limit maximum number of spans per one transaction
  • Loading branch information
Piotr Zygmuntowicz authored Nov 19, 2020
2 parents 2f31645 + ae3b58c commit 93a0551
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/elastic-apm.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
],

'spans' => [
// Max number of child items displayed when viewing trace details.
'maxTraceItems' => env('APM_MAXTRACEITEMS', 1000),

// Depth of backtraces
'backtraceDepth'=> env('APM_BACKTRACEDEPTH', 25),

Expand Down
7 changes: 7 additions & 0 deletions src/Apm/SpanCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@
*/
class SpanCollection extends Collection
{
public function push($value)
{
if ($this->count() >= config('elastic-apm.spans.maxTraceItems')) {
return;
}

parent::push($value);
}
}

0 comments on commit 93a0551

Please sign in to comment.