opentelemetry-metrics-sdk 0.3.0 → 0.4.1

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: b0394fb7c1a15117d165ce69b4419700868f9a9a2b662c9f1a5c933f71dc1a25
4
- data.tar.gz: 58b977f251b7eea72c6935058073cd46aa0803c21e10686571cd9ffa0e23792f
3
+ metadata.gz: 65d8c5195153d2f5a5935ada32ad8045eec7d2aa867876fe98dedf48ccc42a6a
4
+ data.tar.gz: 2108b549a5eab96b9185eb45293074db155bd64554623c6d49921cb11ed0bea5
5
5
  SHA512:
6
- metadata.gz: 969ec426ccc294ba7fff17b3edc5c0536d885e4c410f2a91c49b36afbd6ad2595a8073332c86e3109ba50d7ac51d119f30a3c9f24a3074576b79279f46ec7b34
7
- data.tar.gz: ea08bec0926c227147edaa1dc66d9da4a4f0b714a9d01fb7e2db4edca81e152cfdae9338ac1e900bb29a1a24e2dab6df8c9653a5539fbce02a248ab4eeca3650
6
+ metadata.gz: cc5a6f9d822abc4ddb9e77d558ed21391fa68823248db02452436a53d4e82294c7f7dba04887c782d7f9e01e12514db70cde8b2bd73ef85ddc6b6753fa8bca52
7
+ data.tar.gz: 17ac61e347fca948a49637d9699899ed16217a7bb06854f7451fbfc303fa8c553b43134c02a489cad06d0a4229694ecb8618080250c916297ec98ab5a7e2db2d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-metrics-sdk
2
2
 
3
+ ### v0.4.1 / 2024-12-04
4
+
5
+ * FIXED: Handle float value in NumberDataPoint
6
+
7
+ ### v0.4.0 / 2024-11-20
8
+
9
+ * ADDED: Update metrics configuration patch
10
+
3
11
  ### v0.3.0 / 2024-10-22
4
12
 
5
13
  * ADDED: Add basic metrics view
@@ -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
@@ -10,12 +10,47 @@ module OpenTelemetry
10
10
  # The ConfiguratorPatch implements a hook to configure the metrics
11
11
  # portion of the SDK.
12
12
  module ConfiguratorPatch
13
+ def add_metric_reader(metric_reader)
14
+ @metric_readers << metric_reader
15
+ end
16
+
13
17
  private
14
18
 
15
- # The metrics_configuration_hook method is where we define the setup process
16
- # for metrics SDK.
19
+ def initialize
20
+ super
21
+ @metric_readers = []
22
+ end
23
+
24
+ # The metrics_configuration_hook method is where we define the setup process for the metrics SDK.
17
25
  def metrics_configuration_hook
18
26
  OpenTelemetry.meter_provider = Metrics::MeterProvider.new(resource: @resource)
27
+ configure_metric_readers
28
+ end
29
+
30
+ def configure_metric_readers
31
+ readers = @metric_readers.empty? ? wrapped_metric_exporters_from_env.compact : @metric_readers
32
+ readers.each { |r| OpenTelemetry.meter_provider.add_metric_reader(r) }
33
+ end
34
+
35
+ def wrapped_metric_exporters_from_env
36
+ exporters = ENV.fetch('OTEL_METRICS_EXPORTER', 'otlp')
37
+ exporters.split(',').map do |exporter|
38
+ case exporter.strip
39
+ when 'none' then nil
40
+ when 'console' then OpenTelemetry.meter_provider.add_metric_reader(Metrics::Export::PeriodicMetricReader.new(exporter: Metrics::Export::ConsoleMetricPullExporter.new))
41
+ when 'in-memory' then OpenTelemetry.meter_provider.add_metric_reader(Metrics::Export::InMemoryMetricPullExporter.new)
42
+ when 'otlp'
43
+ begin
44
+ OpenTelemetry.meter_provider.add_metric_reader(Metrics::Export::PeriodicMetricReader.new(exporter: OpenTelemetry::Exporter::OTLP::Metrics::MetricsExporter.new))
45
+ rescue NameError
46
+ OpenTelemetry.logger.warn 'The otlp metrics exporter cannot be configured - please add opentelemetry-exporter-otlp-metrics to your Gemfile, metrics will not be exported'
47
+ nil
48
+ end
49
+ else
50
+ OpenTelemetry.logger.warn "The #{exporter} exporter is unknown and cannot be configured, metrics will not be exported"
51
+ nil
52
+ end
53
+ end
19
54
  end
20
55
  end
21
56
  end
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module SDK
9
9
  module Metrics
10
10
  # Current OpenTelemetry metrics sdk version
11
- VERSION = '0.3.0'
11
+ VERSION = '0.4.1'
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.3.0
4
+ version: 0.4.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-10-22 00:00:00.000000000 Z
11
+ date: 2024-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -239,10 +239,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
239
239
  licenses:
240
240
  - Apache-2.0
241
241
  metadata:
242
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.3.0/file.CHANGELOG.html
242
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.4.1/file.CHANGELOG.html
243
243
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/metrics_sdk
244
244
  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.3.0
245
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.4.1
246
246
  post_install_message:
247
247
  rdoc_options: []
248
248
  require_paths: