opentelemetry-metrics-api 0.6.1 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1d3f13882418a0d035653eab3689405c38a4fcfd45cc785370f23f7e6cd7ed1
4
- data.tar.gz: 591df06ff9853bc5311fee40126aa45f550cc0a70c84adfd0698e8d251dc52cf
3
+ metadata.gz: ea4f3c76493a7fd16c6c17457eadc82abde93f7124ec22c5697c8e6eb38fc932
4
+ data.tar.gz: 8fbeff160a5f21e9641fd0d4007ab1b9cd020f81fe08794f88bc3b0ce2ae4b15
5
5
  SHA512:
6
- metadata.gz: 8b90c72e0df6c9a4498507ab338d52832fad444e7c0d8870366f530dc12f5613afad595b4880713e3fd3bfa7853a45e08368acc24466f518bc68cae5232bb237
7
- data.tar.gz: a5ab8a52dbdd6650cb23a3c05aa6a98e37e72278562d3d86bd0389b8d8af30107ea230ce496cf066eeec8526c0fc44a47f71af98b31bbdb79dbd8c70f7bfb8d5
6
+ metadata.gz: 1f042a80106a1445534b5f9f7e17dbbf99f773898827d3877aed6e984653cff26b5c9c61abc64db2467d2fc3752602af286ae2635ffdf39ab525558f0d6908c5
7
+ data.tar.gz: a0c2d36c901f160ba9f426f969a1e43127624f3d286f013252fa68cdc2c3f80abc1a483e9da40720669e1c706c3acfc34faaaaa18612bb47662fdcbe8630999f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-metrics-api
2
2
 
3
+ ### v0.7.1 / 2026-09-15
4
+
5
+ * FIXED: Pass the callback through when upgrading a proxy instrument (#2377)
6
+
7
+ ### v0.7.0 / 2026-08-04
8
+
9
+ * ADDED: Add attributes to Meter InstrumentationScope (#2273)
10
+
3
11
  ### v0.6.1 / 2026-07-08
4
12
 
5
13
  * DOCS: Update source for gemspec links to RubyDoc (#2123)
@@ -8,17 +8,18 @@ module OpenTelemetry
8
8
  module Internal
9
9
  # @api private
10
10
  class ProxyInstrument
11
- def initialize(kind, name, unit, desc, callable, exemplar_filter, exemplar_reservoir)
11
+ def initialize(kind, name, unit, desc, callback, exemplar_filter, exemplar_reservoir)
12
12
  @kind = kind
13
13
  @name = name
14
14
  @unit = unit
15
15
  @desc = desc
16
- @callable = callable
16
+ @callback = callback
17
17
  @exemplar_filter = exemplar_filter
18
18
  @exemplar_reservoir = exemplar_reservoir
19
19
  @delegate = nil
20
20
  end
21
21
 
22
+ # Replaces the no-op delegate with a real instrument from the given meter.
22
23
  def upgrade_with(meter)
23
24
  @delegate = case @kind
24
25
  when :counter, :histogram, :up_down_counter
@@ -28,10 +29,12 @@ module OpenTelemetry
28
29
  end
29
30
  end
30
31
 
32
+ # Delegates to the upgraded instrument's #add, if any.
31
33
  def add(amount, attributes: nil)
32
34
  @delegate&.add(amount, attributes: attributes)
33
35
  end
34
36
 
37
+ # Delegates to the upgraded instrument's #record, if any.
35
38
  def record(amount, attributes: nil)
36
39
  @delegate&.record(amount, attributes: attributes)
37
40
  end
@@ -13,7 +13,7 @@ module OpenTelemetry
13
13
  # It delegates to a "real" MeterProvider after the global meter provider is registered.
14
14
  # It returns {ProxyMeter} instances until the delegate is installed.
15
15
  class ProxyMeterProvider < Metrics::MeterProvider
16
- Key = Struct.new(:name, :version)
16
+ Key = Struct.new(:name, :version, :attributes)
17
17
  private_constant(:Key)
18
18
 
19
19
  # Returns a new {ProxyMeterProvider} instance.
@@ -43,15 +43,17 @@ module OpenTelemetry
43
43
 
44
44
  # Returns a {Meter} instance.
45
45
  #
46
- # @param [optional String] name Instrumentation package name
47
- # @param [optional String] version Instrumentation package version
46
+ # @param [optional String] name Instrumentation scope name
47
+ # @param [optional String] version Instrumentation scope version
48
+ # @param [optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] attributes
49
+ # Instrumentation scope attributes
48
50
  #
49
51
  # @return [Meter]
50
- def meter(name = nil, version: nil)
52
+ def meter(name = nil, version: nil, attributes: nil)
51
53
  @mutex.synchronize do
52
- return @delegate.meter(name, version: version) unless @delegate.nil?
54
+ return @delegate.meter(name, version: version, attributes: attributes) unless @delegate.nil?
53
55
 
54
- @registry[Key.new(name, version)] ||= ProxyMeter.new
56
+ @registry[Key.new(name, version, attributes)] ||= ProxyMeter.new
55
57
  end
56
58
  end
57
59
  end
@@ -20,10 +20,12 @@ module OpenTelemetry
20
20
 
21
21
  private_constant(:COUNTER, :OBSERVABLE_COUNTER, :HISTOGRAM, :GAUGE, :OBSERVABLE_GAUGE, :UP_DOWN_COUNTER, :OBSERVABLE_UP_DOWN_COUNTER)
22
22
 
23
+ # rubocop:disable Style/EmptyClassDefinition
23
24
  DuplicateInstrumentError = Class.new(OpenTelemetry::Error)
24
25
  InstrumentNameError = Class.new(OpenTelemetry::Error)
25
26
  InstrumentUnitError = Class.new(OpenTelemetry::Error)
26
27
  InstrumentDescriptionError = Class.new(OpenTelemetry::Error)
28
+ # rubocop:enable Style/EmptyClassDefinition
27
29
 
28
30
  def initialize
29
31
  @mutex = Mutex.new
@@ -10,11 +10,13 @@ module OpenTelemetry
10
10
  class MeterProvider
11
11
  # Returns a {Meter} instance.
12
12
  #
13
- # @param [String] name Instrumentation package name
14
- # @param [optional String] version Instrumentation package version
13
+ # @param [String] name Instrumentation scope name
14
+ # @param [optional String] version Instrumentation scope version
15
+ # @param [optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] attributes
16
+ # Instrumentation scope attributes
15
17
  #
16
18
  # @return [Meter]
17
- def meter(name, version: nil)
19
+ def meter(name, version: nil, attributes: nil)
18
20
  @meter ||= Meter.new
19
21
  end
20
22
  end
@@ -7,6 +7,6 @@
7
7
  module OpenTelemetry
8
8
  module Metrics
9
9
  ## Current OpenTelemetry metrics version
10
- VERSION = '0.6.1'
10
+ VERSION = '0.7.1'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-metrics-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
@@ -54,10 +54,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
54
54
  licenses:
55
55
  - Apache-2.0
56
56
  metadata:
57
- changelog_uri: https://rubydoc.info/gems/opentelemetry-metrics-api/0.6.1/file/CHANGELOG.md
58
- source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-metrics-api/v0.6.1/metrics_api
57
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-metrics-api/0.7.1/file/CHANGELOG.md
58
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-metrics-api/v0.7.1/metrics_api
59
59
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
60
- documentation_uri: https://rubydoc.info/gems/opentelemetry-metrics-api/0.6.1
60
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-metrics-api/0.7.1
61
61
  rdoc_options: []
62
62
  require_paths:
63
63
  - lib
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubygems_version: 4.0.10
75
+ rubygems_version: 4.0.16
76
76
  specification_version: 4
77
77
  summary: A stats collection and distributed tracing framework
78
78
  test_files: []