Trace Sampling & Budgets
Control tracing volume and spend in cloud environments
The Encore platform builds on the tracing described in Distributed Tracing, adding controls for how much of it is recorded and what it costs.
Trace Sampling
Trace sampling lets you control what percentage of traces are recorded and stored. You can configure sampling rates per environment, service, and endpoint, giving you fine-grained control over your tracing volume.
How sampling works
Sampling is determined at the root of the trace. This means if you set an endpoint to sample at 10%, it controls whether a trace is created when that endpoint is called as the initial entry point. If that same endpoint is called as part of an already-ongoing trace (e.g. as an internal service-to-service call), it will always be included in the existing trace regardless of its own sampling rate.
This design ensures that all traces are complete — you'll never see partial traces with missing spans. Either a trace is sampled in its entirety, or not at all.
Configuring sampling rates
You can configure sampling rates in the Encore platform dashboard. Sampling can be set at three levels of granularity:
- Environment level: Set a default sampling rate for all traces in an environment.
- Service level: Override the environment default for a specific service.
- Endpoint level: Override the service default for a specific endpoint.
More specific settings take precedence. For example, if your environment is set to sample 100% of traces but a high-traffic endpoint is set to 10%, that endpoint will only generate new traces 10% of the time it's called as the root of a request.
Trace Budgets
Trace budgets give you full predictability over your tracing costs by letting you set spending limits on a daily and monthly basis. When a budget limit is reached, tracing is paused until the next period begins, ensuring you never receive unexpected charges.
Included events
The Encore platform includes a generous amount of tracing events in each plan:
- Free tier: 1M trace events per month included.
- Pro tier: 20M trace events per month included.
Beyond the included events, Pro tier usage is billed at $1.20 per million events.
Setting budgets
You can configure your trace budgets in the Encore platform dashboard. By setting daily and monthly limits, you define exactly how much you're willing to spend on tracing. This makes tracing costs fully predictable and prevents any surprises on your bill.