Skip to main content

Filter entry that can match a span to control its settings.

Properties (3)

Property Type Default Required Description
context⚓︎ { [key: string]: string | number | boolean; } x x

Specifies the filtering context values used for matching spans. Spans match only if all the values in this object match the context values returned by the context getter callback and the filteringContext config property.

Start strings with "#" for case-insensitive regex match.

injectOTELHeaders⚓︎ false | "same-origin" | "all-origins" false x

For spans instrumenting HTTP requests, controls automatic injection of the trace context headers with the current span's context. The headers are produced by the globally registered propagator (W3C trace context - traceparent/tracestate - by default; replaceable via the traces settings' propagator, e.g. with B3 or a composite propagator including baggage).

"same-origin" injects into same-origin requests only: adding a custom header to a cross-origin request triggers a CORS preflight, and a server that does not allow the header would fail the request itself. (The legacy value true is treated as "same-origin" at runtime.)

"all-origins" injects into every request this filter matches, including cross-origin ones - use it in filters whose context.url matches origins known to accept the headers (e.g. via Access-Control-Allow-Headers).

Applies to the fetch/XHR instrumentation and to the platform's Electron net.request instrumentation. Note the main process has no origin, so "same-origin" never matches there - opt platform backends in with "all-origins" filters scoped by context.url (there is no CORS preflight risk for main-process requests).

source⚓︎ string x x

Specifies the source string used for matching spans. Spans match only if their source equals this value, or if their source starts with '.' (e.g. my.api.foo starts with my.api).

Start string with "#" for case-insensitive regex match.