AWS X-Ray Sampling Rule
This page shows how to write Terraform and CloudFormation for X-Ray Sampling Rule and write them securely.
aws_xray_sampling_rule (Terraform)
The Sampling Rule in X-Ray can be configured in Terraform with the resource name aws_xray_sampling_rule. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_xray_sampling_rule" "this" {
attributes = var.attributes
fixed_rate = var.fixed_rate
host = var.host
http_method = var.http_method
priority = var.priority
Parameters
-
arnoptional computed - string -
attributesoptional - map from string to string -
fixed_raterequired - number -
hostrequired - string -
http_methodrequired - string -
idoptional computed - string -
priorityrequired - number -
reservoir_sizerequired - number -
resource_arnrequired - string -
rule_nameoptional - string -
service_namerequired - string -
service_typerequired - string -
tagsoptional - map from string to string -
url_pathrequired - string -
versionrequired - number
Explanation in Terraform Registry
Creates and manages an AWS XRay Sampling Rule.
AWS::XRay::SamplingRule (CloudFormation)
The SamplingRule in XRay can be configured in CloudFormation with the resource name AWS::XRay::SamplingRule. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
"AWS::XRay::SamplingRule": {
"Type": "AWS::XRay::SamplingRule",
"Properties": {}
},
"AWS::IoT::ProvisioningTemplate": {
"Type": "AWS::IoT::ProvisioningTemplate",
Parameters
-
SamplingRuleoptional - SamplingRule -
SamplingRuleRecordoptional - SamplingRuleRecord -
SamplingRuleUpdateoptional - SamplingRuleUpdate -
RuleNameoptional - String -
Tagsoptional - List
Explanation in CloudFormation Registry
Use the
AWS::XRay::SamplingRuleresource to specify a sampling rule, which controls sampling behavior for instrumented applications. A new sampling rule is created by specifying aSamplingRule. To change the configuration of an existing sampling rule, specify aSamplingRuleUpdate. 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.
Frequently asked questions
What is AWS X-Ray Sampling Rule?
AWS X-Ray Sampling Rule is a resource for X-Ray of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS X-Ray Sampling Rule?
For Terraform, the niveklabs/aws source code example is useful. See the Terraform Example section for further details.
For CloudFormation, the mhlabs/aws-icons-directory source code example is useful. See the CloudFormation Example section for further details.