sampling_rules
Creates, updates, deletes, gets or lists a sampling_rules resource.
Overview
| Name | sampling_rules |
| Type | Resource |
| Id | aws.xray.sampling_rules |
Fields
The following fields are returned by SELECT queries:
- get_sampling_rules
| Name | Datatype | Description |
|---|---|---|
created_at | string (date-time) | When the rule was created. |
modified_at | string (date-time) | When the rule was last modified. |
sampling_rule | object | A 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_sampling_rules | select | region | Retrieves all sampling rules. | |
create_sampling_rule | insert | region, SamplingRule | 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. | |
update_sampling_rule | update | region, SamplingRuleUpdate | Modifies a sampling rule's configuration. | |
delete_sampling_rule | delete | region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_sampling_rules
Retrieves all sampling rules.
SELECT
created_at,
modified_at,
sampling_rule
FROM aws.xray.sampling_rules
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_sampling_rule
- Manifest
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
;
# Description fields are for documentation purposes
- name: sampling_rules
props:
- name: region
value: "{{ region }}"
description: Required parameter for the sampling_rules resource.
- name: SamplingRule
description: |
A 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.
value:
RuleName: "{{ RuleName }}"
RuleARN: "{{ RuleARN }}"
ResourceARN: "{{ ResourceARN }}"
Priority: {{ Priority }}
FixedRate: {{ FixedRate }}
ReservoirSize: {{ ReservoirSize }}
ServiceName: "{{ ServiceName }}"
ServiceType: "{{ ServiceType }}"
Host: "{{ Host }}"
HTTPMethod: "{{ HTTPMethod }}"
URLPath: "{{ URLPath }}"
Version: {{ Version }}
Attributes: "{{ Attributes }}"
SamplingRateBoost:
MaxRate: {{ MaxRate }}
CooldownWindowMinutes: {{ CooldownWindowMinutes }}
- name: Tags
value:
- Key: "{{ Key }}"
Value: "{{ Value }}"
UPDATE examples
- update_sampling_rule
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
- delete_sampling_rule
Deletes a sampling rule.
DELETE FROM aws.xray.sampling_rules
WHERE region = '{{ region }}' --required
;