Skip to content

Commit bbf5810

Browse files
committed
docs: hint how to ignore spans if very short
1 parent db09598 commit bbf5810

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/performance-tuning.asciidoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,14 @@ Limiting the number of spans that may be recorded will reduce memory usage.
175175

176176
Reducing max spans could result in loss of useful data about what occurred within a request,
177177
if it is set too low.
178+
179+
Instead of limiting the number of spans, it can be better to drop spans with a very short duration. This will record the spans but discard them if they are very short.
180+
This can be implemented by providing a span-filter:
181+
182+
```js
183+
const agent = require('elastic-apm-node').start({ /* configuration options */ })
184+
185+
agent.addSpanFilter(payload => {
186+
return payload.duration < 10 ? null : payload
187+
})
188+
```

0 commit comments

Comments
 (0)