Class: AWSCDK::XRay::CfnSamplingRule::SamplingRuleProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
x_ray/cfn_sampling_rule.rb

Overview

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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fixed_rate:, host:, http_method:, priority:, reservoir_size:, resource_arn:, service_name:, service_type:, url_path:, attributes: nil, rule_arn: nil, rule_name: nil, sampling_rate_boost: nil, version: nil) ⇒ SamplingRuleProperty

Returns a new instance of SamplingRuleProperty.

Parameters:

  • fixed_rate (Numeric)

    The percentage of matching requests to instrument, after the reservoir is exhausted.

  • host (String)

    Matches the hostname from a request URL.

  • http_method (String)

    Matches the HTTP method of a request.

  • priority (Numeric)

    The priority of the sampling rule.

  • reservoir_size (Numeric)

    A fixed number of matching requests to instrument per second, prior to applying the fixed rate.

  • resource_arn (String)

    Matches the ARN of the AWS resource on which the service runs.

  • service_name (String)

    Matches the name that the service uses to identify itself in segments.

  • service_type (String)

    Matches the origin that the service uses to identify its type in segments.

  • url_path (String)

    Matches the path from a request URL.

  • attributes (AWSCDK::IResolvable, Hash{String => String}, nil) (defaults to: nil)

    Matches attributes derived from the request.

  • rule_arn (String, nil) (defaults to: nil)

    The ARN of the sampling rule. Specify a rule by either name or ARN, but not both.

  • rule_name (String, nil) (defaults to: nil)

    The name of the sampling rule.

  • sampling_rate_boost (AWSCDK::IResolvable, AWSCDK::XRay::CfnSamplingRule::SamplingRateBoostProperty, nil) (defaults to: nil)
  • version (Numeric, nil) (defaults to: nil)

    The version of the sampling rule.



630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'x_ray/cfn_sampling_rule.rb', line 630

def initialize(fixed_rate:, host:, http_method:, priority:, reservoir_size:, resource_arn:, service_name:, service_type:, url_path:, attributes: nil, rule_arn: nil, rule_name: nil, sampling_rate_boost: nil, version: nil)
  @fixed_rate = fixed_rate
  Jsii::Type.check_type(@fixed_rate, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "fixedRate")
  @host = host
  Jsii::Type.check_type(@host, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "host")
  @http_method = http_method
  Jsii::Type.check_type(@http_method, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "httpMethod")
  @priority = priority
  Jsii::Type.check_type(@priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "priority")
  @reservoir_size = reservoir_size
  Jsii::Type.check_type(@reservoir_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "reservoirSize")
  @resource_arn = resource_arn
  Jsii::Type.check_type(@resource_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceArn")
  @service_name = service_name
  Jsii::Type.check_type(@service_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "serviceName")
  @service_type = service_type
  Jsii::Type.check_type(@service_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "serviceType")
  @url_path = url_path
  Jsii::Type.check_type(@url_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "urlPath")
  @attributes = attributes
  Jsii::Type.check_type(@attributes, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsicHJpbWl0aXZlIjoic3RyaW5nIn0sImtpbmQiOiJtYXAifX1dfX0=")), "attributes") unless @attributes.nil?
  @rule_arn = rule_arn
  Jsii::Type.check_type(@rule_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ruleArn") unless @rule_arn.nil?
  @rule_name = rule_name
  Jsii::Type.check_type(@rule_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ruleName") unless @rule_name.nil?
  @sampling_rate_boost = sampling_rate_boost.is_a?(Hash) ? ::AWSCDK::XRay::CfnSamplingRule::SamplingRateBoostProperty.new(**sampling_rate_boost.transform_keys(&:to_sym)) : sampling_rate_boost
  Jsii::Type.check_type(@sampling_rate_boost, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c194cmF5LkNmblNhbXBsaW5nUnVsZS5TYW1wbGluZ1JhdGVCb29zdFByb3BlcnR5In1dfX0=")), "samplingRateBoost") unless @sampling_rate_boost.nil?
  @version = version
  Jsii::Type.check_type(@version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "version") unless @version.nil?
end

Instance Attribute Details

#attributesAWSCDK::IResolvable, ... (readonly)

Matches attributes derived from the request.

Map Entries: Maximum number of 5 items.

Key Length Constraints: Minimum length of 1. Maximum length of 32.

Value Length Constraints: Minimum length of 1. Maximum length of 32.



718
719
720
# File 'x_ray/cfn_sampling_rule.rb', line 718

def attributes
  @attributes
end

#fixed_rateNumeric (readonly)

The percentage of matching requests to instrument, after the reservoir is exhausted.



665
666
667
# File 'x_ray/cfn_sampling_rule.rb', line 665

def fixed_rate
  @fixed_rate
end

#hostString (readonly)

Matches the hostname from a request URL.



670
671
672
# File 'x_ray/cfn_sampling_rule.rb', line 670

def host
  @host
end

#http_methodString (readonly)

Matches the HTTP method of a request.



675
676
677
# File 'x_ray/cfn_sampling_rule.rb', line 675

def http_method
  @http_method
end

#priorityNumeric (readonly)

The priority of the sampling rule.



680
681
682
# File 'x_ray/cfn_sampling_rule.rb', line 680

def priority
  @priority
end

#reservoir_sizeNumeric (readonly)

A fixed number of matching requests to instrument per second, prior to applying the fixed rate.

The reservoir is not used directly by services, but applies to all services using the rule collectively.



687
688
689
# File 'x_ray/cfn_sampling_rule.rb', line 687

def reservoir_size
  @reservoir_size
end

#resource_arnString (readonly)

Matches the ARN of the AWS resource on which the service runs.



692
693
694
# File 'x_ray/cfn_sampling_rule.rb', line 692

def resource_arn
  @resource_arn
end

#rule_arnString? (readonly)

The ARN of the sampling rule. Specify a rule by either name or ARN, but not both.

Specifying a sampling rule by name is recommended, as specifying by ARN will be deprecated in future.



725
726
727
# File 'x_ray/cfn_sampling_rule.rb', line 725

def rule_arn
  @rule_arn
end

#rule_nameString? (readonly)

The name of the sampling rule.

Specify a rule by either name or ARN, but not both.



732
733
734
# File 'x_ray/cfn_sampling_rule.rb', line 732

def rule_name
  @rule_name
end

#sampling_rate_boostAWSCDK::IResolvable, ... (readonly)



735
736
737
# File 'x_ray/cfn_sampling_rule.rb', line 735

def sampling_rate_boost
  @sampling_rate_boost
end

#service_nameString (readonly)

Matches the name that the service uses to identify itself in segments.



697
698
699
# File 'x_ray/cfn_sampling_rule.rb', line 697

def service_name
  @service_name
end

#service_typeString (readonly)

Matches the origin that the service uses to identify its type in segments.



702
703
704
# File 'x_ray/cfn_sampling_rule.rb', line 702

def service_type
  @service_type
end

#url_pathString (readonly)

Matches the path from a request URL.



707
708
709
# File 'x_ray/cfn_sampling_rule.rb', line 707

def url_path
  @url_path
end

#versionNumeric? (readonly)

The version of the sampling rule.

Version can only be set when creating a new sampling rule.



742
743
744
# File 'x_ray/cfn_sampling_rule.rb', line 742

def version
  @version
end

Class Method Details

.jsii_propertiesObject



744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
# File 'x_ray/cfn_sampling_rule.rb', line 744

def self.jsii_properties
  {
    :fixed_rate => "fixedRate",
    :host => "host",
    :http_method => "httpMethod",
    :priority => "priority",
    :reservoir_size => "reservoirSize",
    :resource_arn => "resourceArn",
    :service_name => "serviceName",
    :service_type => "serviceType",
    :url_path => "urlPath",
    :attributes => "attributes",
    :rule_arn => "ruleArn",
    :rule_name => "ruleName",
    :sampling_rate_boost => "samplingRateBoost",
    :version => "version",
  }
end

Instance Method Details

#to_jsiiObject



763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
# File 'x_ray/cfn_sampling_rule.rb', line 763

def to_jsii
  result = {}
  result.merge!({
    "fixedRate" => @fixed_rate,
    "host" => @host,
    "httpMethod" => @http_method,
    "priority" => @priority,
    "reservoirSize" => @reservoir_size,
    "resourceArn" => @resource_arn,
    "serviceName" => @service_name,
    "serviceType" => @service_type,
    "urlPath" => @url_path,
    "attributes" => @attributes,
    "ruleArn" => @rule_arn,
    "ruleName" => @rule_name,
    "samplingRateBoost" => @sampling_rate_boost,
    "version" => @version,
  })
  result.compact
end