Class CfnSamplingRule
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.xray.CfnSamplingRule
- All Implemented Interfaces:
IInspectable,ITaggableV2,ISamplingRuleRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:50.748Z")
@Stability(Stable)
public class CfnSamplingRule
extends CfnResource
implements IInspectable, ISamplingRuleRef, ITaggableV2
Use the
AWS::XRay::SamplingRule resource to specify a sampling rule, which controls sampling behavior for instrumented applications.
Include a SamplingRule entity to create or update a sampling rule.
SamplingRule.Versioncan only be set when creating a sampling rule. Updating the version will cause the update to fail.
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.*;
CfnSamplingRule cfnSamplingRule = CfnSamplingRule.Builder.create(this, "MyCfnSamplingRule")
.ruleName("ruleName")
.samplingRule(SamplingRuleProperty.builder()
.fixedRate(123)
.host("host")
.httpMethod("httpMethod")
.priority(123)
.reservoirSize(123)
.resourceArn("resourceArn")
.serviceName("serviceName")
.serviceType("serviceType")
.urlPath("urlPath")
// the properties below are optional
.attributes(Map.of(
"attributesKey", "attributes"))
.ruleArn("ruleArn")
.ruleName("ruleName")
.version(123)
.build())
.samplingRuleRecord(SamplingRuleRecordProperty.builder()
.createdAt("createdAt")
.modifiedAt("modifiedAt")
.samplingRule(SamplingRuleProperty.builder()
.fixedRate(123)
.host("host")
.httpMethod("httpMethod")
.priority(123)
.reservoirSize(123)
.resourceArn("resourceArn")
.serviceName("serviceName")
.serviceType("serviceType")
.urlPath("urlPath")
// the properties below are optional
.attributes(Map.of(
"attributesKey", "attributes"))
.ruleArn("ruleArn")
.ruleName("ruleName")
.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(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnSamplingRule.static interfaceA sampling rule that services use to decide whether to instrument a request.static interfaceExample:static interfaceExample:Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.xray.ISamplingRuleRef
ISamplingRuleRef.Jsii$Default, ISamplingRuleRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnSamplingRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnSamplingRule(software.amazon.jsii.JsiiObjectRef objRef) CfnSamplingRule(software.constructs.Construct scope, String id) CfnSamplingRule(software.constructs.Construct scope, String id, CfnSamplingRuleProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe sampling rule ARN that was created or updated.Tag Manager which manages the tags for this resource.Deprecated.this property has been deprecatedThe sampling rule to be created or updated.Deprecated.this property has been deprecatedA reference to a SamplingRule resource.Deprecated.this property has been deprecatedgetTags()An array of key-value pairs to apply to this resource.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetRuleName(String value) Deprecated.this property has been deprecatedvoidsetSamplingRule(IResolvable value) The sampling rule to be created or updated.voidThe sampling rule to be created or updated.voidsetSamplingRuleRecord(IResolvable value) Deprecated.this property has been deprecatedvoidDeprecated.this property has been deprecatedvoidsetSamplingRuleUpdate(IResolvable value) Deprecated.this property has been deprecatedvoidDeprecated.this property has been deprecatedvoidAn array of key-value pairs to apply to this resource.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnSamplingRule
protected CfnSamplingRule(software.amazon.jsii.JsiiObjectRef objRef) -
CfnSamplingRule
protected CfnSamplingRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnSamplingRule
@Stability(Stable) public CfnSamplingRule(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnSamplingRuleProps props) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnSamplingRule
@Stability(Stable) public CfnSamplingRule(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrRuleArn
The sampling rule ARN that was created or updated. -
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManagerin interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getSamplingRuleRef
A reference to a SamplingRule resource.- Specified by:
getSamplingRuleRefin interfaceISamplingRuleRef
-
getRuleName
Deprecated.this property has been deprecated(deprecated) The ARN of the sampling rule. -
setRuleName
Deprecated.this property has been deprecated(deprecated) The ARN of the sampling rule. -
getSamplingRule
The sampling rule to be created or updated.Returns union: either
IResolvableorCfnSamplingRule.SamplingRuleProperty -
setSamplingRule
The sampling rule to be created or updated. -
setSamplingRule
@Stability(Stable) public void setSamplingRule(@Nullable CfnSamplingRule.SamplingRuleProperty value) The sampling rule to be created or updated. -
getSamplingRuleRecord
Deprecated.this property has been deprecatedReturns union: eitherIResolvableorCfnSamplingRule.SamplingRuleRecordProperty -
setSamplingRuleRecord
Deprecated.this property has been deprecated -
setSamplingRuleRecord
@Stability(Deprecated) @Deprecated public void setSamplingRuleRecord(@Nullable CfnSamplingRule.SamplingRuleRecordProperty value) Deprecated.this property has been deprecated -
getSamplingRuleUpdate
Deprecated.this property has been deprecatedReturns union: eitherIResolvableorCfnSamplingRule.SamplingRuleUpdateProperty -
setSamplingRuleUpdate
Deprecated.this property has been deprecated -
setSamplingRuleUpdate
@Stability(Deprecated) @Deprecated public void setSamplingRuleUpdate(@Nullable CfnSamplingRule.SamplingRuleUpdateProperty value) Deprecated.this property has been deprecated -
getTags
An array of key-value pairs to apply to this resource. -
setTags
An array of key-value pairs to apply to this resource.
-