ABV_SAMPLE_RATE environment variable or by using the sample_rate/sampleRate constructor parameter. The value has to be between 0 and 1.
The default value is 1, meaning that all traces are collected. A value of 0.2 means that only 20% of the traces are collected. The SDK samples on the trace level meaning that if a trace is sampled, all observations and scores within that trace will be sampled as well.
Implementation with Python SDK
Install packages.env file in your project root.
.env
Implementation with JS/TS SDK
Install packages.env file in your project root and a package like dotenv to load the variables.
.env
instrumentation.ts file and use dotenv package to load the variables.
Additional parameters are provided to get trace visible in the UI immediately.
ABV respects OpenTelemetry’s sampling decisions. You can configure a sampler in your OTEL SDK to control which traces are sent to ABV. This is useful for managing costs and reducing noise in high-volume applications.
Here is an example of how to configure a TraceIdRatioBasedSampler to send only 20% of traces:
instrumentation.ts
instrumentation.ts file at the top of your application.
See JS/TS SDK docs for more details.