On the Sampling store tab, you can view the span data that is reported and stored. You can also configure sampling rules.

Background information

More than 90% of the span data reported by an application is repeated and useless. You can configure sampling rules to store only the span data that is useful to your business to save costs.

For example, your application may report 1,000,000 span data records. In this case, you can configure a sampling rule to store only 10,000 span data records that meet the specified conditions. This way, you can save storage costs and improve query efficiency.

Notice If a span meets the conditions that you specify on exceptions and duration, the full trace that corresponds to the span is stored to ensure trace integrity.

Go to the Sampling store tab

  1. Log on Tracing Analysis console.
  2. In the left-side navigation pane, click Cluster Configurations.
  3. On the page that appears, click the Sampling store tab.
    Tracing Analysis - Cluster Configurations - Sampling store

Parameter description

  • Total number of reported spans: the total number of span data records reported to the current account.
  • Total storage span: the number of span data records that are stored based on the sampling rules that you configure.
  • Full real-time analysis (last half an hour): the total number of span data records reported within the last 30 minutes for real-time full data analysis.

The reported span data records are sampled first based on the default sampling rule and then based on the relevant custom sampling rule.

For example, your application reports 1,000,000 span data records, among which 10,000 records meet the specified conditions on exceptions and duration. In the relevant custom sampling rule, the number of specified span data records is 20,000, and the sampling ratio is set to 10%. The following list describes the sampling process and logic:

  1. The system samples data records based on the default sampling rule. The system first stores the 10,000 data records that meet the conditions and then stores 10% of all reported data records, which indicates 100,000 data records.
  2. The system samples data records based on the relevant custom sampling rule. The system stores the data records that hit the custom sampling rule. In this step, 20,000 data records are stored.
  3. In this example, a total of 130,000 data records are stored.

Configure the default sampling rule

  1. In the Default sampling section of the Sampling store tab, click Editing.
  2. Set the following parameters as required and click Save.
    • Sampling ratio: the ratio of the number of stored span data records to the total number of reported span data records. Enter a number as required. If you enter 10, the sampling ratio is set to 10%.
    • Abnormal full adoption (error tag exists): specifies whether to store a full trace that has the error tag.
    • span time: the threshold of span duration. After you specify a value, spans whose duration is longer than the value are stored.
    After you configure the default sampling rule, you can view the number of span data records that hit the rule in the upper-right corner of the Default sampling section.

Configure a custom sampling rule

  1. In the Custom sampling section of the Sampling store tab, click Add custom sampling.
  2. In the Add custom sampling dialog box, specify a rule name.
  3. In the Filter conditions section, set the Application Name, span name, tag key, and tag value parameter as required.
    Click Query to query the traces that meet the filter conditions.
    Parameter Description
    Application Name The name of the application for which you want to sample data.
    span name The name of the span. This parameter is used as a filter condition.
    tag key The key of the tag. This parameter is used as a filter condition.
    tag value The value of the tag. This parameter is used as a filter condition.
  4. Specify a sampling ratio and click Determine.
    After the custom sampling rule is created, you can enable, disable, modify, and delete the rule in the Custom sampling section. You can also view the number of span data records that hit the rule in the upper-right corner.