opentelemetry-sdk 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bdebb54966352742da13ac2700b592e49a9f06a751961f7e9d41e70cf855c29
4
- data.tar.gz: 4a977ef6391a6c76b6c333797abab87aba952ee357541b482b72441156c4a7fc
3
+ metadata.gz: f49ca16dd123f2ab96a64ff6e9b5cf6c2e10af45ed433bea357f2cbe188a12bc
4
+ data.tar.gz: 8827826f4cf1abddd6b421fa8812decaacf92c9277877bb7a1e38aecaf8691dc
5
5
  SHA512:
6
- metadata.gz: 8c54d7a07907e48fcef2e9bcab362ca15e8f86d290daa9e88fc2118135004e734fb136998d7f4f46ac419e3a193775dd9ad5fb572fb170d71bd909c9f01a419b
7
- data.tar.gz: be5d9d93ae1f824a250f8dbea0ca63d5318c1d109bc3d83a9a7d237305a2de899c102dd144eb9f03ecb6f653af7415616deecbf609ca30fba7a9941532d88d2a
6
+ metadata.gz: 804969ec3b44d01fb66f5ffa1ee9390065f3652942596477fc9e61187472d018c965ee5f9311f277d2fe99ec4b07c4b880272447777431409b9a3eea8b045037
7
+ data.tar.gz: 589ff982bc7add6a30fca440143f5ea2ff94068de0bc8f5dd9ab5678c45e55ed96b41b65e53836878ed87fa6c82ed585db050f3ddf147a2ab71da752b8b072de
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-sdk
2
2
 
3
+ ### v1.0.3 / 2022-05-02
4
+
5
+ * ADDED: Truncate the strings in an array attribute value if length_limit is configured
6
+ * FIXED: Update attribute length limit env var name to match spec
7
+ * FIXED: Warning about Struct initialization in Ruby 3.2+
8
+ * FIXED: Warn on unsupported otlp transport protocols
9
+ * FIXED: Only allow certain types of Numeric values as attribute values.
10
+
3
11
  ### v1.0.2 / 2021-12-01
4
12
 
5
13
  * FIXED: Default span kind
@@ -169,12 +169,20 @@ module OpenTelemetry
169
169
  processors.each { |p| tracer_provider.add_span_processor(p) }
170
170
  end
171
171
 
172
- def wrapped_exporters_from_env
172
+ def wrapped_exporters_from_env # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
173
173
  exporters = ENV.fetch('OTEL_TRACES_EXPORTER', 'otlp')
174
174
  exporters.split(',').map do |exporter|
175
175
  case exporter.strip
176
176
  when 'none' then nil
177
- when 'otlp' then fetch_exporter(exporter, 'OpenTelemetry::Exporter::OTLP::Exporter')
177
+ when 'otlp'
178
+ otlp_protocol = ENV['OTEL_EXPORTER_OTLP_TRACES_PROTOCOL'] || ENV['OTEL_EXPORTER_OTLP_PROTOCOL'] || 'http/protobuf'
179
+
180
+ if otlp_protocol != 'http/protobuf'
181
+ OpenTelemetry.logger.warn "The #{otlp_protocol} transport protocol is not supported by the OTLP exporter, spans will not be exported."
182
+ nil
183
+ else
184
+ fetch_exporter(exporter, 'OpenTelemetry::Exporter::OTLP::Exporter')
185
+ end
178
186
  when 'jaeger' then fetch_exporter(exporter, 'OpenTelemetry::Exporter::Jaeger::CollectorExporter')
179
187
  when 'zipkin' then fetch_exporter(exporter, 'OpenTelemetry::Exporter::Zipkin::Exporter')
180
188
  when 'console' then Trace::Export::SimpleSpanProcessor.new(Trace::Export::ConsoleSpanExporter.new)
@@ -13,15 +13,19 @@ module OpenTelemetry
13
13
  extend self
14
14
 
15
15
  def boolean?(value)
16
- value.is_a?(TrueClass) || value.is_a?(FalseClass)
16
+ value.instance_of?(TrueClass) || value.instance_of?(FalseClass)
17
17
  end
18
18
 
19
19
  def valid_key?(key)
20
20
  key.instance_of?(String)
21
21
  end
22
22
 
23
+ def numeric?(value)
24
+ value.instance_of?(Integer) || value.instance_of?(Float)
25
+ end
26
+
23
27
  def valid_simple_value?(value)
24
- value.instance_of?(String) || value == false || value == true || value.is_a?(Numeric)
28
+ value.instance_of?(String) || boolean?(value) || numeric?(value)
25
29
  end
26
30
 
27
31
  def valid_array_value?(value)
@@ -34,7 +38,7 @@ module OpenTelemetry
34
38
  when TrueClass, FalseClass
35
39
  value.all? { |v| boolean?(v) }
36
40
  when Numeric
37
- value.all? { |v| v.is_a?(Numeric) }
41
+ value.all? { |v| numeric?(v) }
38
42
  else
39
43
  false
40
44
  end
@@ -351,7 +351,9 @@ module OpenTelemetry
351
351
  return EMPTY_ATTRIBUTES if attrs.nil?
352
352
 
353
353
  attribute_length_limit = @span_limits.attribute_length_limit
354
- attrs.each { |key, value| attrs[key] = OpenTelemetry::Common::Utilities.truncate(value, attribute_length_limit) } if attribute_length_limit
354
+ return attrs if attribute_length_limit.nil?
355
+
356
+ attrs.transform_values! { |value| OpenTelemetry::Common::Utilities.truncate_attribute_value(value, attribute_length_limit) }
355
357
  attrs
356
358
  end
357
359
 
@@ -32,7 +32,8 @@ module OpenTelemetry
32
32
  # @return [SpanLimits] with the desired values.
33
33
  # @raise [ArgumentError] if any of the max numbers are not positive.
34
34
  def initialize(attribute_count_limit: Integer(ENV.fetch('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 128)), # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
35
- attribute_length_limit: ENV['OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT'],
35
+ attribute_length_limit: ENV.fetch('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT',
36
+ ENV['OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT']),
36
37
  event_count_limit: Integer(ENV.fetch('OTEL_SPAN_EVENT_COUNT_LIMIT', 128)),
37
38
  link_count_limit: Integer(ENV.fetch('OTEL_SPAN_LINK_COUNT_LIMIT', 128)),
38
39
  event_attribute_count_limit: Integer(ENV.fetch('OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT', 128)),
@@ -7,6 +7,6 @@
7
7
  module OpenTelemetry
8
8
  module SDK
9
9
  ## Current OpenTelemetry version
10
- VERSION = '1.0.2'
10
+ VERSION = '1.0.3'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-01 00:00:00.000000000 Z
11
+ date: 2022-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.19.0
47
+ version: 0.20.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.19.0
54
+ version: 0.20.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: opentelemetry-semantic_conventions
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.19.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: opentelemetry-test-helpers
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: pry
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -265,10 +279,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
265
279
  licenses:
266
280
  - Apache-2.0
267
281
  metadata:
268
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.0.2/file.CHANGELOG.html
282
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.0.3/file.CHANGELOG.html
269
283
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/sdk
270
284
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
271
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.0.2
285
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.0.3
272
286
  post_install_message:
273
287
  rdoc_options: []
274
288
  require_paths: