# SpanFilter

**Kind**: interface | **Module**: [Insights](https://docs.interop.io/desktop/reference/javascript/insights/index.md)

**Source**: https://docs.interop.io/desktop/reference/javascript/insights/spanfilter/index.html

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

## Properties

- **`context`** (`{ [key: string]: string | number | boolean; }`, optional)
  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"`, optional) default: `false`
  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`, optional)
  Specifies the source string used for matching spans.
  Spans match only if their source equals this value, or
  if their source starts with '<source>.' (e.g. my.api.foo
  starts with my.api).

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