How to sample 25% of only successful traces using open telemetry collector(AWS ADOT collector)?

74 Views Asked by At

I have a use case where I want to sample 25% of all successful trace ( which does not have error)。

I have 2 more use cases:

  • Sample all error traces ( no problem)
  • Sample all High latency traces (no problem)

I am using ADOT collector. Upon reading the README.md for tail sampling processor.

My understanding is that my use case can be achieved by using and policy.Like combination go two policies

  • Sample only Error free successful traces
  • Sample only 25% probabilistic traces

I tried the following policy but not luck

{
              name: send-percent-of-successful-traces,
              type: and,
              and:
                {
                  and_sub_policy:
                    [
                        {
                          name: only-200-response-code,
                          type: string_attribute,
                          string_attribute:
                            {
                                key: http.response.status,
                                values: ["200"],
                                enabled_regex_matching: true,
                            },
                        },
                        {
                          name: sample-percent-traces,
                          type: probabilistic,
                          probabilistic: { sampling_percentage: 25 },
                        },
                    ],
                },
            },

Is there any other way to achieve my use case?

Note: I already have 2 more policies to sample only error traces and high latency traces so I cannot use another processor to filter 404 error traces.

0

There are 0 best solutions below