Class CfnSamplingRule

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-11T15:56:07.470Z") @Stability(Stable) public class CfnSamplingRule extends CfnResource implements IInspectable, 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.Version can 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:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String 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

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      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:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrRuleArn

      @Stability(Stable) @NotNull public String getAttrRuleArn()
      The sampling rule ARN that was created or updated.
    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getRuleName

      @Stability(Deprecated) @Deprecated @Nullable public String getRuleName()
      Deprecated.
      this property has been deprecated
      (deprecated) The ARN of the sampling rule.

    • setRuleName

      @Stability(Deprecated) @Deprecated public void setRuleName(@Nullable String value)
      Deprecated.
      this property has been deprecated
      (deprecated) The ARN of the sampling rule.

    • getSamplingRule

      @Stability(Stable) @Nullable public Object getSamplingRule()
      The sampling rule to be created or updated.
    • setSamplingRule

      @Stability(Stable) public void setSamplingRule(@Nullable IResolvable value)
      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

      @Stability(Deprecated) @Deprecated @Nullable public Object getSamplingRuleRecord()
      Deprecated.
      this property has been deprecated
    • setSamplingRuleRecord

      @Stability(Deprecated) @Deprecated public void setSamplingRuleRecord(@Nullable IResolvable value)
      Deprecated.
      this property has been deprecated
    • setSamplingRuleRecord

      @Stability(Deprecated) @Deprecated public void setSamplingRuleRecord(@Nullable CfnSamplingRule.SamplingRuleRecordProperty value)
      Deprecated.
      this property has been deprecated
    • getSamplingRuleUpdate

      @Stability(Deprecated) @Deprecated @Nullable public Object getSamplingRuleUpdate()
      Deprecated.
      this property has been deprecated
    • setSamplingRuleUpdate

      @Stability(Deprecated) @Deprecated public void setSamplingRuleUpdate(@Nullable IResolvable value)
      Deprecated.
      this property has been deprecated
    • setSamplingRuleUpdate

      @Stability(Deprecated) @Deprecated public void setSamplingRuleUpdate(@Nullable CfnSamplingRule.SamplingRuleUpdateProperty value)
      Deprecated.
      this property has been deprecated
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      An array of key-value pairs to apply to this resource.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      An array of key-value pairs to apply to this resource.