---
title: "Policy types | Grafana Cloud documentation"
description: "Reference-level documentation for policy types."
---

# Policy types

Here are the available policy types and their definitions. For more information on each of the policy types, refer to the [Components documentation](/docs/grafana-cloud/send-data/alloy/reference/components/otelcol/otelcol.processor.tail_sampling/).

Expand table

Policy typeDefinition

`always_sample`Samples every trace that it encounters. It’s useful for debugging or when you need to capture all data.

`probabilistic`Samples a certain percentage of traces randomly. You can specify the sampling rate.

`latency`Samples traces based on their duration. You can set a threshold, and any trace that exceeds that threshold is sampled.

`boolean_attribute`Samples based on boolean attributes.

`status_code`Samples traces based on their status code (for example, errors, success). This is very useful for capturing traces that contain errors.

`string_attribute`Samples traces based on the values of string attributes.

> Note
> 
> When using regular expressions (regex) in string attributes, you must explicitly [enable regex matching](/docs/grafana-cloud/adaptive-telemetry/adaptive-traces/reference/policy_types/#regex-matching-for-string-attributes) in the configuration.

`numeric_attribute`Samples traces based on numeric attribute values. You can specify a key, a minimum value, and a maximum value to define the range.

`trace_flags`Samples based on a span having the sampling trace flag set.

`trace_state`Samples based on the values of the TraceState.

`rate_limiting`Samples based on the rate of spans per second.

`span_count`Samples based on the number of spans within a trace.

`ottl_condition`Samples based on OpenTelemetry Transformation Language (OTTL) conditions. This allows very complex and specific filtering.

`and`Allows you to combine multiple policies using a logical “AND” operation.

`composite`Allows for a combination of samplers, with ordering, and rate allocation per sampler. This creates very flexible sampling strategies.

`drop`Allows for a combination of specific conditions to discard unwanted traces before any other rules are evaluated. When you create a drop policy, make sure you also have an active sampling policy (like `always_sample`) otherwise all of your traces will be dropped.

`volumetric`(Public preview) Distributes a target sampling budget across groups of traces (such as by `service.name` and `http.method`) using per-group rates that adapt to traffic. Refer to [Use volumetric sampling](/docs/grafana-cloud/adaptive-telemetry/adaptive-traces/manage-recommendations/volumetric-policy/) for details.

## Numeric attribute policy

The `numeric_attribute` policy samples traces based on the value of a numeric span attribute. You define a key and a range using minimum and maximum values. Any trace with a matching attribute value within that range is sampled.

Expand table

| Field       | Type   | Description                                 |
|-------------|--------|---------------------------------------------|
| `key`       | string | The span attribute key to evaluate.         |
| `min_value` | number | The minimum value of the range (inclusive). |
| `max_value` | number | The maximum value of the range (inclusive). |

### Example

JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```json
{
  "key": "http.response.content_length",
  "min_value": 1000000,
  "max_value": 10000000
}
```

This policy samples traces where the `http.response.content_length` attribute is between 1 MB and 10 MB.

## Regex matching for string attributes

When using regular expressions (regex) in string attributes, you must explicitly enable regex matching in the configuration.

Set `enabled_regex_matching` to true for the corresponding attribute block.

Without this option, regex patterns are treated as plain text, and invalid regex syntax may cause errors during evaluation.

### Example

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```none
{
  "key": "foo",
  "values": [
    "normal-value",
    "regex-value.*"
  ],
  "enabled_regex_matching": true
}
```

> Note
> 
> The `enabled_regex_matching` option is required only when using regex in string\_attribute filters. If this field is omitted, regex patterns are not interpreted, and misconfigured expressions can lead to processor errors.
> 
> For additional reference, refer to the Alloy tail\_sampling string\_attribute [documentation](/docs/grafana-cloud/send-data/alloy/reference/components/otelcol/otelcol.processor.tail_sampling/).
