Skip to main content

SamplingSettingsinterface

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.

The attributes are the ones the span is created with - the filtering context and the additional attributes written on it, the otelSpanOptions attributes - with the values the application gave them: attributeSettings that mask or drop an attribute on the span do not change what an entry here matches ({ user: "john" } matches the span of the user "john" whether or not user is masked). A custom sampler is handed the attributes as the span carries them - masked and dropped.

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