Skip to content

Commit d76dfae

Browse files
committed
[docs] Add example for payload filtering
Added an example using a callback for filtering to showcase how to use a filter to ignore some payloads completely. docs
1 parent cb57272 commit d76dfae

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/api.asciidoc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ Return the altered payload.
409409

410410
If `nil` is returned all subsequent filters will be skipped and the post request cancelled.
411411

412-
Example:
412+
Examples:
413413

414+
Altering payload
414415
[source,ruby]
415416
----
416417
ElasticAPM.add_filter(:filter_pings) do |payload|
@@ -421,6 +422,17 @@ ElasticAPM.add_filter(:filter_pings) do |payload|
421422
end
422423
----
423424

425+
Filtering payload
426+
[source,ruby]
427+
----
428+
ElasticAPM.add_filter(
429+
:remove_redis_spans,
430+
Proc.new do |payload|
431+
payload.dig(:span, :type) == 'db.redis' ? nil : payload
432+
end
433+
)
434+
----
435+
424436
[float]
425437
[[api-transaction]]
426438
=== Transaction

0 commit comments

Comments
 (0)