opentelemetry-metrics-sdk 0.3.0 → 0.4.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: b0394fb7c1a15117d165ce69b4419700868f9a9a2b662c9f1a5c933f71dc1a25
4
- data.tar.gz: 58b977f251b7eea72c6935058073cd46aa0803c21e10686571cd9ffa0e23792f
3
+ metadata.gz: 45746399ac9cf72000a4a5531a1bb151731fd6fcb3354385d8821a6d9b109cce
4
+ data.tar.gz: 7da59da17348fc19abb319da95964a5902154b54eab28ca54166f971e3d366ea
5
5
  SHA512:
6
- metadata.gz: 969ec426ccc294ba7fff17b3edc5c0536d885e4c410f2a91c49b36afbd6ad2595a8073332c86e3109ba50d7ac51d119f30a3c9f24a3074576b79279f46ec7b34
7
- data.tar.gz: ea08bec0926c227147edaa1dc66d9da4a4f0b714a9d01fb7e2db4edca81e152cfdae9338ac1e900bb29a1a24e2dab6df8c9653a5539fbce02a248ab4eeca3650
6
+ metadata.gz: f8a0095dda549fea543c7049e5cf228809ae5f67e449c6a1d11933fb1f1849b10a06200682c4fd52b016e9dc4ff2159236abeec9120d5997e56b76f34f6d11f7
7
+ data.tar.gz: 858df23a2dac33a1567a78aec7b6fac4c6afa02f274e8e5b2828d329f4073aa51cfe15277161be87fcc33402828fe20d9bc9f25b6ad2ac1999bb117a9a2fdac3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-metrics-sdk
2
2
 
3
+ ### v0.4.0 / 2024-11-19
4
+
5
+ * ADDED: Update metrics configuration patch
6
+
3
7
  ### v0.3.0 / 2024-10-22
4
8
 
5
9
  * ADDED: Add basic metrics view
@@ -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.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.3.0
4
+ version: 0.4.0
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-11-20 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.0/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.0
246
246
  post_install_message:
247
247
  rdoc_options: []
248
248
  require_paths: