Grafana Agent otelcol.processor.tail_sampling` - Policy Help

I cant quite figure out the syntax for a complex tail sampling.

I want 100% of error traces, 10% of all other traces, and 0% of health check traces.

I know how to do each, individually

otelcol.processor.tail_sampling "default" {
  decision_wait               = "10s"
  num_traces                  = 100
  expected_new_traces_per_sec = 10

  policy {
    name = "test-policy-1"
    type = "status_code"

    status_code {
      status_codes = ["ERROR", "UNSET"]
    }
  }

  policy {
    name = "test-policy-2"
    type = "string_attribute"

    string_attribute {
      key                    = "http.url"
      values                 = ["/health", "/metrics", "/healthz]
      enabled_regex_matching = true
      invert_match           = true
    }
  }

  policy {
    name = "test-policy-3"
    type = "probabilistic"

    probabilistic {
      sampling_percentage = 10
    }
  }
}

But im not sure how to do some sort of conditional? to actually follow the logic im after.

1 Like

Did you manage to find out how to reach your goal? I’m also trying to do the same thing, however, it’s very difficult to make the pipeline work with all the rules

No, we moved back to using the Open Telemetry Collector since it appears to have more documentation/support.