opentelemetry-metrics-sdk 0.4.1 → 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: 65d8c5195153d2f5a5935ada32ad8045eec7d2aa867876fe98dedf48ccc42a6a
4
- data.tar.gz: 2108b549a5eab96b9185eb45293074db155bd64554623c6d49921cb11ed0bea5
3
+ metadata.gz: ab6bcf236973bf3076b7ed474af0b5f6d1800109b50ea962ee30e5c26e8e2939
4
+ data.tar.gz: 98b5732131f76d66d2a8aa9dec222540d46bcde1c505611838dac389c84633f2
5
5
  SHA512:
6
- metadata.gz: cc5a6f9d822abc4ddb9e77d558ed21391fa68823248db02452436a53d4e82294c7f7dba04887c782d7f9e01e12514db70cde8b2bd73ef85ddc6b6753fa8bca52
7
- data.tar.gz: 17ac61e347fca948a49637d9699899ed16217a7bb06854f7451fbfc303fa8c553b43134c02a489cad06d0a4229694ecb8618080250c916297ec98ab5a7e2db2d
6
+ metadata.gz: 2e67ddd388122be3e244bfb72089fc22df9c00e7f0ccbe1d7407cfa666c91e5eee65056b5430cc35ae034bf8d55073c6b24848736afcd38d06b7a4e07e757154
7
+ data.tar.gz: 967900597a808f03bfc221773a5c5095fa4f8ea0f94b1cae2b4c30ed16e2e30c4e49d8bda30774a63b924cf836f50d1d3a68bdc589b9455de3588a57846859ea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-metrics-sdk
2
2
 
3
+ ### v0.5.0 / 2025-01-08
4
+
5
+ * ADDED: Add synchronous gauge
6
+
3
7
  ### v0.4.1 / 2024-12-04
4
8
 
5
9
  * FIXED: Handle float value in NumberDataPoint
@@ -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.1'
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.1
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-12-05 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.1/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.1
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: []