opentelemetry-metrics-api 0.1.0 → 0.1.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: e083b923d5961c60a77e23cec51451171a627cdebaad0aad91c64dedb6f940e4
4
- data.tar.gz: 7ec8d56f0f9fcc2db01d173d755351f7d3365632070861ac1d5f920613f7c77e
3
+ metadata.gz: 6232b4090e467e0d9f7933342d5a1a9634a41186222306214d889b5c211af55c
4
+ data.tar.gz: 6e52fe54891237e36ef39fcd29ef035772051f1a54e18b67270369af8a06f352
5
5
  SHA512:
6
- metadata.gz: 1fe0235ce6aa725df40a48324dfedc6ccc4735bc250b90909964d6bc8d9af0c5c5586fbb174871ba292b2dac78f6971f7881dc6016d55dc5029dc7c0f8b74268
7
- data.tar.gz: 6c7460fb94836f0754b9b7ba6f64a807f6477c4715518ae803db9b89da8618b549f140422f6e9749c33ac505c616419356b10fc091bc560e00654a4d6905e40c
6
+ metadata.gz: cf96e7239ee84437c1b4389b763b3f80f7882c8d9e29b2db94f7bd0bb9c1cfbd8475a0cb75712e8c916833a3cc184c4028f95996905dd3d2fddec13a8999d9a3
7
+ data.tar.gz: 6d048b7a1622e36a791cf5e64f104f8a75faa3a9248495bd528ad7089fa6f2d685aa5f9f52026e92366b11aa4faefabe5f18cde5262d35df39fbc7f98092c5ca
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-metrics-api
2
2
 
3
+ ### v0.1.1 / 2024-10-22
4
+
5
+ * FIXED: Refactor instrument validation
6
+
3
7
  ### v0.1.0 / 2024-07-31
4
8
 
5
9
  Initial release.
data/README.md CHANGED
@@ -12,7 +12,11 @@ OpenTelemetry provides a single set of APIs, libraries, agents, and collector se
12
12
 
13
13
  The `opentelemetry-metrics-api` gem defines the core OpenTelemetry interfaces in the form of abstract classes and no-op implementations. That is, it defines interfaces and data types sufficient for a library or application to code against to produce telemetry data, but does not actually collect, analyze, or export the data.
14
14
 
15
- To collect and analyze telemetry data, _applications_ should also install a concrete implementation of the API, such as the `opentelemetry-metrics-sdk` gem. However, _libraries_ that produce telemetry data should depend only on `opentelemetry-metrics-api`, deferring the choise of concrete implementation to the application developer.
15
+ To collect and analyze telemetry data, _applications_ should also
16
+ install a concrete implementation of the API, such as the
17
+ `opentelemetry-metrics-sdk` gem. However, _libraries_ that produce
18
+ telemetry data should depend only on `opentelemetry-metrics-api`,
19
+ deferring the choice of concrete implementation to the application developer.
16
20
 
17
21
  This code is still under development and is not a complete implementation of the Metrics API. Until the code becomes stable, Metrics API functionality will live outside the `opentelemetry-api` library.
18
22
 
@@ -20,7 +24,7 @@ This code is still under development and is not a complete implementation of the
20
24
 
21
25
  Install the gem using:
22
26
 
23
- ```
27
+ ```sh
24
28
  gem install opentelemetry-metrics-api
25
29
  ```
26
30
 
@@ -16,7 +16,7 @@ module OpenTelemetry
16
16
  # Values must be non-nil and (array of) string, boolean or numeric type.
17
17
  # Array values must not contain nil elements and all elements must be of
18
18
  # the same basic type (string, numeric, boolean).
19
- def add(increment, attributes: nil); end
19
+ def add(increment, attributes: {}); end
20
20
  end
21
21
  end
22
22
  end
@@ -16,7 +16,7 @@ module OpenTelemetry
16
16
  # Values must be non-nil and (array of) string, boolean or numeric type.
17
17
  # Array values must not contain nil elements and all elements must be of
18
18
  # the same basic type (string, numeric, boolean).
19
- def record(amount, attributes: nil); end
19
+ def record(amount, attributes: {}); end
20
20
  end
21
21
  end
22
22
  end
@@ -16,7 +16,7 @@ module OpenTelemetry
16
16
  # Values must be non-nil and (array of) string, boolean or numeric type.
17
17
  # Array values must not contain nil elements and all elements must be of
18
18
  # the same basic type (string, numeric, boolean).
19
- def add(amount, attributes: nil); end
19
+ def add(amount, attributes: {}); end
20
20
  end
21
21
  end
22
22
  end
@@ -15,8 +15,6 @@ module OpenTelemetry
15
15
  UP_DOWN_COUNTER = Instrument::UpDownCounter.new
16
16
  OBSERVABLE_UP_DOWN_COUNTER = Instrument::ObservableUpDownCounter.new
17
17
 
18
- NAME_REGEX = /\A[a-zA-Z][-.\w]{0,62}\z/
19
-
20
18
  private_constant(:COUNTER, :OBSERVABLE_COUNTER, :HISTOGRAM, :OBSERVABLE_GAUGE, :UP_DOWN_COUNTER, :OBSERVABLE_UP_DOWN_COUNTER)
21
19
 
22
20
  DuplicateInstrumentError = Class.new(OpenTelemetry::Error)
@@ -56,23 +54,12 @@ module OpenTelemetry
56
54
  private
57
55
 
58
56
  def create_instrument(kind, name, unit, description, callback)
59
- raise InstrumentNameError if name.nil?
60
- raise InstrumentNameError if name.empty?
61
- raise InstrumentNameError unless NAME_REGEX.match?(name)
62
- raise InstrumentUnitError if unit && (!unit.ascii_only? || unit.size > 63)
63
- raise InstrumentDescriptionError if description && (description.size > 1023 || !utf8mb3_encoding?(description.dup))
64
-
65
57
  @mutex.synchronize do
66
58
  OpenTelemetry.logger.warn("duplicate instrument registration occurred for instrument #{name}") if @instrument_registry.include? name
67
59
 
68
60
  @instrument_registry[name] = yield
69
61
  end
70
62
  end
71
-
72
- def utf8mb3_encoding?(string)
73
- string.force_encoding('UTF-8').valid_encoding? &&
74
- string.each_char { |c| return false if c.bytesize >= 4 }
75
- end
76
63
  end
77
64
  end
78
65
  end
@@ -7,6 +7,6 @@
7
7
  module OpenTelemetry
8
8
  module Metrics
9
9
  ## Current OpenTelemetry metrics version
10
- VERSION = '0.1.0'
10
+ VERSION = '0.1.1'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-metrics-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.51.0
117
+ version: '1.65'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.51.0
124
+ version: '1.65'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: simplecov
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -195,10 +195,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
195
195
  licenses:
196
196
  - Apache-2.0
197
197
  metadata:
198
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-api/v0.1.0/file.CHANGELOG.html
198
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-api/v0.1.1/file.CHANGELOG.html
199
199
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/metrics_api
200
200
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
201
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-api/v0.1.0
201
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-api/v0.1.1
202
202
  post_install_message:
203
203
  rdoc_options: []
204
204
  require_paths: