Skip to main content

Settings used to control the sampling probability of spans.

Properties (4)

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

Span attributes that determine if span will match this sampling setting entry. Useful e.g. for checking otel.library.name/otel.scope.name attribute to filter auto-instrumentated spans. Start strings with "#" for case-insensitive regex match.

context⚓︎ { [key: string]: string | number | boolean } x x

Context values that determine if span will match this sampling setting entry. 'Context' here refers to the object returned from the 'contextGetter' callback at the time of sampling, not the OTEL context concept. This is useful for sampling based on the current client environment - current user, application, server node, time of day, etc. Start strings with "#" for case-insensitive regex match.

name⚓︎ string x x

Span name to determine if span will match this sampling setting entry. Start string with "#" for case-insensitive regex match

sample⚓︎ number | boolean x

Probability that span will be sampled, based on its traceId Spans from the same trace will always either all be sampled, or none will, provided they all have the same sampling probability. If true: will be sampled If false: will not be sampled If number between 0 and 1: has this probability of being sampled. Precision: 3 decimal digits