@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:40.854Z") public class CfnSamplingRule extends CfnResource implements IInspectable
Use the AWS::XRay::SamplingRule
resource to specify a sampling rule, which controls sampling behavior for instrumented applications. A new sampling rule is created by specifying a SamplingRule
. To change the configuration of an existing sampling rule, specify a SamplingRuleUpdate
.
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.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.xray.*; Object tags; CfnSamplingRule cfnSamplingRule = CfnSamplingRule.Builder.create(this, "MyCfnSamplingRule") .ruleName("ruleName") .samplingRule(SamplingRuleProperty.builder() .attributes(Map.of( "attributesKey", "attributes")) .fixedRate(123) .host("host") .httpMethod("httpMethod") .priority(123) .reservoirSize(123) .resourceArn("resourceArn") .ruleArn("ruleArn") .ruleName("ruleName") .serviceName("serviceName") .serviceType("serviceType") .urlPath("urlPath") .version(123) .build()) .samplingRuleRecord(SamplingRuleRecordProperty.builder() .createdAt("createdAt") .modifiedAt("modifiedAt") .samplingRule(SamplingRuleProperty.builder() .attributes(Map.of( "attributesKey", "attributes")) .fixedRate(123) .host("host") .httpMethod("httpMethod") .priority(123) .reservoirSize(123) .resourceArn("resourceArn") .ruleArn("ruleArn") .ruleName("ruleName") .serviceName("serviceName") .serviceType("serviceType") .urlPath("urlPath") .version(123) .build()) .build()) .samplingRuleUpdate(SamplingRuleUpdateProperty.builder() .attributes(Map.of( "attributesKey", "attributes")) .fixedRate(123) .host("host") .httpMethod("httpMethod") .priority(123) .reservoirSize(123) .resourceArn("resourceArn") .ruleArn("ruleArn") .ruleName("ruleName") .serviceName("serviceName") .serviceType("serviceType") .urlPath("urlPath") .build()) .tags(List.of(tags)) .build();
Modifier and Type | Class and Description |
---|---|
static class |
CfnSamplingRule.Builder
A fluent builder for
CfnSamplingRule . |
static interface |
CfnSamplingRule.SamplingRuleProperty
A sampling rule that services use to decide whether to instrument a request.
|
static interface |
CfnSamplingRule.SamplingRuleRecordProperty
A [SamplingRule](https://docs.aws.amazon.com//xray/latest/api/API_SamplingRule.html) and its metadata.
|
static interface |
CfnSamplingRule.SamplingRuleUpdateProperty
A document specifying changes to a sampling rule's configuration.
|
static interface |
CfnSamplingRule.TagsItemsProperty
Example:
|
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnSamplingRule(Construct scope,
java.lang.String id)
Create a new `AWS::XRay::SamplingRule`.
|
|
CfnSamplingRule(Construct scope,
java.lang.String id,
CfnSamplingRuleProps props)
Create a new `AWS::XRay::SamplingRule`.
|
protected |
CfnSamplingRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnSamplingRule(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrRuleArn()
The sampling rule ARN that was created or updated.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getRuleName()
The name of the sampling rule.
|
java.lang.Object |
getSamplingRule()
The sampling rule to be created.
|
java.lang.Object |
getSamplingRuleRecord()
`AWS::XRay::SamplingRule.SamplingRuleRecord`.
|
java.lang.Object |
getSamplingRuleUpdate()
A document specifying changes to a sampling rule's configuration.
|
java.util.List<java.lang.Object> |
getTags()
An array of key-value pairs to apply to this resource.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setRuleName(java.lang.String value)
The name of the sampling rule.
|
void |
setSamplingRule(CfnSamplingRule.SamplingRuleProperty value)
The sampling rule to be created.
|
void |
setSamplingRule(IResolvable value)
The sampling rule to be created.
|
void |
setSamplingRuleRecord(CfnSamplingRule.SamplingRuleRecordProperty value)
`AWS::XRay::SamplingRule.SamplingRuleRecord`.
|
void |
setSamplingRuleRecord(IResolvable value)
`AWS::XRay::SamplingRule.SamplingRuleRecord`.
|
void |
setSamplingRuleUpdate(CfnSamplingRule.SamplingRuleUpdateProperty value)
A document specifying changes to a sampling rule's configuration.
|
void |
setSamplingRuleUpdate(IResolvable value)
A document specifying changes to a sampling rule's configuration.
|
void |
setTags(java.util.List<java.lang.Object> value)
An array of key-value pairs to apply to this resource.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnSamplingRule(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnSamplingRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnSamplingRule(Construct scope, java.lang.String id, CfnSamplingRuleProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties.public CfnSamplingRule(Construct scope, java.lang.String id)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrRuleArn()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.String getRuleName()
Specify a rule by either name or ARN, but not both. Used only when deleting a sampling rule. When creating or updating a sampling rule, use the RuleName
or RuleARN
properties within SamplingRule
or SamplingRuleUpdate
.
public void setRuleName(java.lang.String value)
Specify a rule by either name or ARN, but not both. Used only when deleting a sampling rule. When creating or updating a sampling rule, use the RuleName
or RuleARN
properties within SamplingRule
or SamplingRuleUpdate
.
public java.lang.Object getSamplingRule()
Must be provided if creating a new sampling rule. Not valid when updating an existing sampling rule.
public void setSamplingRule(IResolvable value)
Must be provided if creating a new sampling rule. Not valid when updating an existing sampling rule.
public void setSamplingRule(CfnSamplingRule.SamplingRuleProperty value)
Must be provided if creating a new sampling rule. Not valid when updating an existing sampling rule.
public java.lang.Object getSamplingRuleRecord()
public void setSamplingRuleRecord(IResolvable value)
public void setSamplingRuleRecord(CfnSamplingRule.SamplingRuleRecordProperty value)
public java.lang.Object getSamplingRuleUpdate()
Must be provided if updating an existing sampling rule. Not valid when creating a new sampling rule.
The
Version
of a sampling rule cannot be updated, and is not part ofSamplingRuleUpdate
.
public void setSamplingRuleUpdate(IResolvable value)
Must be provided if updating an existing sampling rule. Not valid when creating a new sampling rule.
The
Version
of a sampling rule cannot be updated, and is not part ofSamplingRuleUpdate
.
public void setSamplingRuleUpdate(CfnSamplingRule.SamplingRuleUpdateProperty value)
Must be provided if updating an existing sampling rule. Not valid when creating a new sampling rule.
The
Version
of a sampling rule cannot be updated, and is not part ofSamplingRuleUpdate
.
public java.util.List<java.lang.Object> getTags()
For more information, see Tag .
public void setTags(java.util.List<java.lang.Object> value)
For more information, see Tag .