Trace sampling

Adaptive Traffic Management automatically starts sampling traces if the amount of ingested traces exceeds the included trace volume. In case of Extended trace ingest the threshold is increased but otherwise it works the same way. If OneAgent capture rate is below 100%, sampling has been applied because the amount of traces that can be captured by OneAgent has exceeded the Full-Stack included trace volume.

Adjust trace sampling of Web requests

If the capture rate is not 100% you can tell the OneAgent to increase or decrease the sampling frequency of certain requests. This does not change the overall ingested trace volume, nor will it change the overall capture rate. It does enable you to control what the available trace volume is used.

You have two options:

  • Adjusting the capture frequency is only affective if the OneAgent that starts the distributed trace is not sampling at a 100% capture rate.
  • In all environments, there are transactions for which traces are of lower value. You can exclude them from being captured at all. This feature will always be affective and frees up trace volume for other more important requests.

Configure URL sampling for all OneAgents in the environment:

  1. Go to Settings > Server-side service monitoring > URL-based sampling.
  2. Select Add URL.
  3. Create your new rule.
    1. Modify OneAgent capturing frequency as needed.

      • To increase or reduce the frequency of trace capture for the specific URL compared to the environment wide nominal sampling rate, set Importance of a specific URL to a different scaling factor.
      • To never capture traces for a URL, regardless of the available trace volume, turn on Ignore URLs with specific path and/or query parameters.
    2. Type the URL path or specify query parameters.

      Use wildcards (**) for URLs with similar segment paths, such as URLs of the same domain.

      For example, in /api/product/**/detail, all values between slashes are ignored; the path applies to both /api/product/1/detail and /api/product/2/detail.

      To specify query parameters, go to Query parameters and select Add item.

      1. Type a query parameter name.
      2. Type the query parameter value or turn on Query parameter value is undefined.
    3. optional To apply the scaling factor to one or more HTTP methods, turn off Any HTTP method and select the HTTP method(s) to target.

  4. Select Save changes.

Configure sampling for a particular Host group

Dynatrace version 1.312+

Very often you do not have the permission to configure sampling for the environment. However your Dynatrace admin can give you permissions to set up configuration on a host group level. Dynatrace recommends to do that. In this case you can then set up sampling rules on host group.

To do this go to the Host classic app, filter by the host group of choice. Click on any host in that host group, select More () > ** Host group settings ** and select URL-based sampling.

Configure URL sampling for a particular Process Group

Very often you either do not have the permission to configure sampling for the environment, or you simply only want this to effect a particular process group. To do this go to either the Process in Host classic or Process group in Technologies & Processes Classic. Find your Process or Process group.

  • On the process group level, select More () > Process group settings and select URL-based sampling.
  • On the process level, select More () > OneAgent feature settings and select URL-based sampling.

Configure URL sampling for a particular Kubernetes Cluster or Namespace

You can configure trace sampling for all traces started by a particular Kubernetes cluster or namespace. This is useful if you do not have environment permissions or simply want this to only effect a particular part of your environment. To do this

  • go to Kubernetes classic
  • On the Kubernetes cluster level, select More () > Settings and select URL-based sampling.
  • On the Kuberentes namespace level, select More () > Settings and select URL-based sampling.

Use case examples

The following rule reduces by 4 the capturing frequency of requests that start with _healthz.

  1. Go to Settings > Server-side service monitoring > URL-based sampling.
  2. Select Add URL.
  3. From Importance of a specific URL, select Reduce capturing by factor 2.
  4. Type the URL path /_healthz.
  5. From Path comparison condition, select Starts with.
  6. Turn on Any HTTP method.
  7. Select Save changes.

The following rule ignores all requests (starts with /) that have OPTIONS as HTTP method for a selected process group.

  1. Go to the process group and select More () > Process group settings > URL-based sampling.
  2. Select Add URL.
  3. Turn on Ignore a specific URL.
  4. Type the URL path /.
  5. From Path comparison condition, select Starts with.
  6. Turn off Any HTTP method.
  7. From the HTTP method list, turn on OPTIONS.
  8. Select Save changes.
  9. optional Create a new rule for each process group that you want to target.