opentelemetry-metrics-sdk 0.4.0 → 0.5.0

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: 45746399ac9cf72000a4a5531a1bb151731fd6fcb3354385d8821a6d9b109cce
4
- data.tar.gz: 7da59da17348fc19abb319da95964a5902154b54eab28ca54166f971e3d366ea
3
+ metadata.gz: ab6bcf236973bf3076b7ed474af0b5f6d1800109b50ea962ee30e5c26e8e2939
4
+ data.tar.gz: 98b5732131f76d66d2a8aa9dec222540d46bcde1c505611838dac389c84633f2
5
5
  SHA512:
6
- metadata.gz: f8a0095dda549fea543c7049e5cf228809ae5f67e449c6a1d11933fb1f1849b10a06200682c4fd52b016e9dc4ff2159236abeec9120d5997e56b76f34f6d11f7
7
- data.tar.gz: 858df23a2dac33a1567a78aec7b6fac4c6afa02f274e8e5b2828d329f4073aa51cfe15277161be87fcc33402828fe20d9bc9f25b6ad2ac1999bb117a9a2fdac3
6
+ metadata.gz: 2e67ddd388122be3e244bfb72089fc22df9c00e7f0ccbe1d7407cfa666c91e5eee65056b5430cc35ae034bf8d55073c6b24848736afcd38d06b7a4e07e757154
7
+ data.tar.gz: 967900597a808f03bfc221773a5c5095fa4f8ea0f94b1cae2b4c30ed16e2e30c4e49d8bda30774a63b924cf836f50d1d3a68bdc589b9455de3588a57846859ea
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Release History: opentelemetry-metrics-sdk
2
2
 
3
- ### v0.4.0 / 2024-11-19
3
+ ### v0.5.0 / 2025-01-08
4
+
5
+ * ADDED: Add synchronous gauge
6
+
7
+ ### v0.4.1 / 2024-12-04
8
+
9
+ * FIXED: Handle float value in NumberDataPoint
10
+
11
+ ### v0.4.0 / 2024-11-20
4
12
 
5
13
  * ADDED: Update metrics configuration patch
6
14
 
@@ -25,7 +25,6 @@ module OpenTelemetry
25
25
  boundaries: DEFAULT_BOUNDARIES,
26
26
  record_min_max: true
27
27
  )
28
-
29
28
  @aggregation_temporality = aggregation_temporality.to_sym
30
29
  @boundaries = boundaries && !boundaries.empty? ? boundaries.sort : nil
31
30
  @record_min_max = record_min_max
@@ -14,7 +14,7 @@ module OpenTelemetry
14
14
  :start_time_unix_nano, # Integer nanoseconds since Epoch
15
15
  :time_unix_nano, # Integer nanoseconds since Epoch
16
16
  :count, # Integer count is the number of values in the population. Must be non-negative.
17
- :sum, # Integer sum of the values in the population. If count is zero then this field then this field must be zero
17
+ :sum, # Float sum of the values in the population. If count is zero then this field must be zero.
18
18
  :bucket_counts, # optional Array[Integer] field contains the count values of histogram for each bucket.
19
19
  :explicit_bounds, # Array[Float] specifies buckets with explicitly defined bounds for values.
20
20
  :exemplars, # optional List of exemplars collected from measurements that were used to form the data point
@@ -11,7 +11,7 @@ module OpenTelemetry
11
11
  NumberDataPoint = Struct.new(:attributes, # Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}
12
12
  :start_time_unix_nano, # Integer nanoseconds since Epoch
13
13
  :time_unix_nano, # Integer nanoseconds since Epoch
14
- :value, # Integer
14
+ :value, # Numeric
15
15
  :exemplars) # optional List of exemplars collected from measurements that were used to form the data point
16
16
  end
17
17
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright The OpenTelemetry Authors
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ module OpenTelemetry
8
+ module SDK
9
+ module Metrics
10
+ module Instrument
11
+ # {Gauge} is the SDK implementation of {OpenTelemetry::Metrics::Gauge}.
12
+ class Gauge < OpenTelemetry::SDK::Metrics::Instrument::SynchronousInstrument
13
+ # Returns the instrument kind as a Symbol
14
+ #
15
+ # @return [Symbol]
16
+ def instrument_kind
17
+ :gauge
18
+ end
19
+
20
+ # Record the absolute value of the Gauge.
21
+ #
22
+ # @param [numeric] value The current absolute value.
23
+ # @param [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] attributes
24
+ # Values must be non-nil and (array of) string, boolean or numeric type.
25
+ # Array values must not contain nil elements and all elements must be of
26
+ # the same basic type (string, numeric, boolean).
27
+ def record(value, attributes: {})
28
+ # TODO: When the metrics SDK stabilizes and is merged into the main SDK,
29
+ # we can leverage the SDK Internal validation classes to enforce this:
30
+ # https://github.com/open-telemetry/opentelemetry-ruby/blob/6bec625ef49004f364457c26263df421526b60d6/sdk/lib/opentelemetry/sdk/internal.rb#L47
31
+ update(value, attributes)
32
+ nil
33
+ rescue StandardError => e
34
+ OpenTelemetry.handle_error(exception: e)
35
+ nil
36
+ end
37
+
38
+ private
39
+
40
+ def default_aggregation
41
+ OpenTelemetry::SDK::Metrics::Aggregation::LastValue.new
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -20,3 +20,4 @@ require 'opentelemetry/sdk/metrics/instrument/observable_counter'
20
20
  require 'opentelemetry/sdk/metrics/instrument/observable_gauge'
21
21
  require 'opentelemetry/sdk/metrics/instrument/observable_up_down_counter'
22
22
  require 'opentelemetry/sdk/metrics/instrument/up_down_counter'
23
+ require 'opentelemetry/sdk/metrics/instrument/gauge'
@@ -46,6 +46,7 @@ module OpenTelemetry
46
46
  case kind
47
47
  when :counter then OpenTelemetry::SDK::Metrics::Instrument::Counter.new(name, unit, description, @instrumentation_scope, @meter_provider)
48
48
  when :observable_counter then OpenTelemetry::SDK::Metrics::Instrument::ObservableCounter.new(name, unit, description, callback, @instrumentation_scope, @meter_provider)
49
+ when :gauge then OpenTelemetry::SDK::Metrics::Instrument::Gauge.new(name, unit, description, @instrumentation_scope, @meter_provider)
49
50
  when :histogram then OpenTelemetry::SDK::Metrics::Instrument::Histogram.new(name, unit, description, @instrumentation_scope, @meter_provider)
50
51
  when :observable_gauge then OpenTelemetry::SDK::Metrics::Instrument::ObservableGauge.new(name, unit, description, callback, @instrumentation_scope, @meter_provider)
51
52
  when :up_down_counter then OpenTelemetry::SDK::Metrics::Instrument::UpDownCounter.new(name, unit, description, @instrumentation_scope, @meter_provider)
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module SDK
9
9
  module Metrics
10
10
  # Current OpenTelemetry metrics sdk version
11
- VERSION = '0.4.0'
11
+ VERSION = '0.5.0'
12
12
  end
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-metrics-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-20 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.1
33
+ version: '0.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.1
40
+ version: '0.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: opentelemetry-sdk
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +220,7 @@ files:
220
220
  - lib/opentelemetry/sdk/metrics/export/periodic_metric_reader.rb
221
221
  - lib/opentelemetry/sdk/metrics/instrument.rb
222
222
  - lib/opentelemetry/sdk/metrics/instrument/counter.rb
223
+ - lib/opentelemetry/sdk/metrics/instrument/gauge.rb
223
224
  - lib/opentelemetry/sdk/metrics/instrument/histogram.rb
224
225
  - lib/opentelemetry/sdk/metrics/instrument/observable_counter.rb
225
226
  - lib/opentelemetry/sdk/metrics/instrument/observable_gauge.rb
@@ -239,11 +240,11 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
239
240
  licenses:
240
241
  - Apache-2.0
241
242
  metadata:
242
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.4.0/file.CHANGELOG.html
243
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.5.0/file.CHANGELOG.html
243
244
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/metrics_sdk
244
245
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
245
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.4.0
246
- post_install_message:
246
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.5.0
247
+ post_install_message:
247
248
  rdoc_options: []
248
249
  require_paths:
249
250
  - lib
@@ -259,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
260
  version: '0'
260
261
  requirements: []
261
262
  rubygems_version: 3.2.33
262
- signing_key:
263
+ signing_key:
263
264
  specification_version: 4
264
265
  summary: A stats collection and distributed tracing framework
265
266
  test_files: []