Class: OpenTelemetry::Sampler::XRay::SamplingRule
- Inherits:
-
Object
- Object
- OpenTelemetry::Sampler::XRay::SamplingRule
- Defined in:
- lib/opentelemetry/sampler/xray/sampling_rule.rb
Overview
SamplingRule represent a Sampling Rule object for AWS X-Ray See: https://docs.aws.amazon.com/xray/latest/api/API_SamplingRule.html
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#fixed_rate ⇒ Object
Returns the value of attribute fixed_rate.
-
#host ⇒ Object
Returns the value of attribute host.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#reservoir_size ⇒ Object
Returns the value of attribute reservoir_size.
-
#resource_arn ⇒ Object
Returns the value of attribute resource_arn.
-
#rule_arn ⇒ Object
Returns the value of attribute rule_arn.
-
#rule_name ⇒ Object
Returns the value of attribute rule_name.
-
#service_name ⇒ Object
Returns the value of attribute service_name.
-
#service_type ⇒ Object
Returns the value of attribute service_type.
-
#url_path ⇒ Object
Returns the value of attribute url_path.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #equals?(other) ⇒ Boolean
-
#initialize(sampling_rule) ⇒ SamplingRule
constructor
A new instance of SamplingRule.
Constructor Details
#initialize(sampling_rule) ⇒ SamplingRule
Returns a new instance of SamplingRule.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 17 def initialize(sampling_rule) # The AWS API docs mark `rule_name` as an optional field but in practice it seems to always be # present, and sampling targets could not be computed without it. For now provide an arbitrary fallback just in # case the AWS API docs are correct. @rule_name = sampling_rule['RuleName'] || 'Default' @rule_arn = sampling_rule['RuleARN'] @priority = sampling_rule['Priority'] @reservoir_size = sampling_rule['ReservoirSize'] @fixed_rate = sampling_rule['FixedRate'] @service_name = sampling_rule['ServiceName'] @service_type = sampling_rule['ServiceType'] @host = sampling_rule['Host'] @http_method = sampling_rule['HTTPMethod'] @url_path = sampling_rule['URLPath'] @resource_arn = sampling_rule['ResourceARN'] @version = sampling_rule['Version'] @attributes = sampling_rule['Attributes'] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def attributes @attributes end |
#fixed_rate ⇒ Object
Returns the value of attribute fixed_rate.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def fixed_rate @fixed_rate end |
#host ⇒ Object
Returns the value of attribute host.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def host @host end |
#http_method ⇒ Object
Returns the value of attribute http_method.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def http_method @http_method end |
#priority ⇒ Object
Returns the value of attribute priority.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def priority @priority end |
#reservoir_size ⇒ Object
Returns the value of attribute reservoir_size.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def reservoir_size @reservoir_size end |
#resource_arn ⇒ Object
Returns the value of attribute resource_arn.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def resource_arn @resource_arn end |
#rule_arn ⇒ Object
Returns the value of attribute rule_arn.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def rule_arn @rule_arn end |
#rule_name ⇒ Object
Returns the value of attribute rule_name.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def rule_name @rule_name end |
#service_name ⇒ Object
Returns the value of attribute service_name.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def service_name @service_name end |
#service_type ⇒ Object
Returns the value of attribute service_type.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def service_type @service_type end |
#url_path ⇒ Object
Returns the value of attribute url_path.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def url_path @url_path end |
#version ⇒ Object
Returns the value of attribute version.
13 14 15 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 13 def version @version end |
Instance Method Details
#equals?(other) ⇒ Boolean
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/opentelemetry/sampler/xray/sampling_rule.rb', line 36 def equals?(other) attributes_equals = if @attributes.nil? || other.attributes.nil? @attributes == other.attributes else attributes_equal?(other.attributes) end @fixed_rate == other.fixed_rate && @http_method == other.http_method && @host == other.host && @priority == other.priority && @reservoir_size == other.reservoir_size && @resource_arn == other.resource_arn && @rule_arn == other.rule_arn && @rule_name == other.rule_name && @service_name == other.service_name && @service_type == other.service_type && @url_path == other.url_path && @version == other.version && attributes_equals end |