Skip to main content

sampling_rules

Creates, updates, deletes, gets or lists a sampling_rules resource.

Overview

Namesampling_rules
TypeResource
Idaws.xray.sampling_rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
created_atstring (date-time)When the rule was created.
modified_atstring (date-time)When the rule was last modified.
sampling_ruleobjectA sampling rule that services use to decide whether to instrument a request. Rule fields can match properties of the service, or properties of a request. The service can ignore rules that don't match its properties.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_sampling_rulesselectregionRetrieves all sampling rules.
create_sampling_ruleinsertregion, SamplingRuleCreates a rule to control sampling behavior for instrumented applications. Services retrieve rules with GetSamplingRules, and evaluate each rule in ascending order of priority for each request. If a rule matches, the service records a trace, borrowing it from the reservoir size. After 10 seconds, the service reports back to X-Ray with GetSamplingTargets to get updated versions of each in-use rule. The updated rule contains a trace quota that the service can use instead of borrowing from the reservoir.
update_sampling_ruleupdateregion, SamplingRuleUpdateModifies a sampling rule's configuration.
delete_sampling_ruledeleteregionDeletes a sampling rule.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves all sampling rules.

SELECT
created_at,
modified_at,
sampling_rule
FROM aws.xray.sampling_rules
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a rule to control sampling behavior for instrumented applications. Services retrieve rules with GetSamplingRules, and evaluate each rule in ascending order of priority for each request. If a rule matches, the service records a trace, borrowing it from the reservoir size. After 10 seconds, the service reports back to X-Ray with GetSamplingTargets to get updated versions of each in-use rule. The updated rule contains a trace quota that the service can use instead of borrowing from the reservoir.

INSERT INTO aws.xray.sampling_rules (
SamplingRule,
Tags,
region
)
SELECT
'{{ SamplingRule }}' /* required */,
'{{ Tags }}',
'{{ region }}'
RETURNING
sampling_rule_record
;

UPDATE examples

Modifies a sampling rule's configuration.

UPDATE aws.xray.sampling_rules
SET
SamplingRuleUpdate = '{{ SamplingRuleUpdate }}'
WHERE
region = '{{ region }}' --required
AND SamplingRuleUpdate = '{{ SamplingRuleUpdate }}' --required
RETURNING
sampling_rule_record;

DELETE examples

Deletes a sampling rule.

DELETE FROM aws.xray.sampling_rules
WHERE region = '{{ region }}' --required
;