opentelemetry-metrics-sdk 0.6.0 → 0.6.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f80c6d95eeb420fc59002214a2486d588027050dd75c3e675946b52e13db1623
|
4
|
+
data.tar.gz: 401efba2cf641811e0bd21db5f9d1ba73ec41d876a859d98009c1a4a148a38b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f55fad01c447ce033120386ccb5c0841585aba1e787c7865477a398d1502f098bfdb566918eb29e38e8bae83eb9c2903657d32a7e834331a7cbae3a0ccf055
|
7
|
+
data.tar.gz: 265d205ecbfac906c2cdd3d0c29e86b3e2c1b53568c544da0283d1dd71fee40e88d0084d41b28a0aab60f33c79a00db8b2cccfa12df127d822b4547032e6e21c
|
data/CHANGELOG.md
CHANGED
@@ -33,14 +33,22 @@ module OpenTelemetry
|
|
33
33
|
@thread = nil
|
34
34
|
@continue = false
|
35
35
|
@mutex = Mutex.new
|
36
|
+
@condition = ConditionVariable.new
|
36
37
|
@export_mutex = Mutex.new
|
37
38
|
|
38
39
|
start
|
39
40
|
end
|
40
41
|
|
42
|
+
# Shuts the @thread down and set @continue to false; it will block
|
43
|
+
# until the shutdown thread is finished.
|
44
|
+
#
|
45
|
+
# @param [optional Numeric] timeout An optional timeout in seconds.
|
46
|
+
# @return [Integer] SUCCESS if no error occurred, FAILURE if a
|
47
|
+
# non-specific failure occurred.
|
41
48
|
def shutdown(timeout: nil)
|
42
49
|
thread = lock do
|
43
50
|
@continue = false # force termination in next iteration
|
51
|
+
@condition.signal
|
44
52
|
@thread
|
45
53
|
end
|
46
54
|
thread&.join(@export_interval)
|
@@ -52,15 +60,35 @@ module OpenTelemetry
|
|
52
60
|
Export::FAILURE
|
53
61
|
end
|
54
62
|
|
63
|
+
# Export all metrics to the configured `Exporter` that have not yet
|
64
|
+
# been exported.
|
65
|
+
#
|
66
|
+
# This method should only be called in cases where it is absolutely
|
67
|
+
# necessary, such as when using some FaaS providers that may suspend
|
68
|
+
# the process after an invocation, but before the `PeriodicMetricReader` exports
|
69
|
+
# the completed metrics.
|
70
|
+
#
|
71
|
+
# @param [optional Numeric] timeout An optional timeout in seconds.
|
72
|
+
# @return [Integer] SUCCESS if no error occurred, FAILURE if a
|
73
|
+
# non-specific failure occurred.
|
55
74
|
def force_flush(timeout: nil)
|
56
|
-
export(timeout:
|
75
|
+
export(timeout:)
|
57
76
|
Export::SUCCESS
|
58
77
|
rescue StandardError
|
59
78
|
Export::FAILURE
|
60
79
|
end
|
61
80
|
|
81
|
+
# Check both @thread and @continue object to determine if current
|
82
|
+
# PeriodicMetricReader is still alive. If one of them is true/alive,
|
83
|
+
# then PeriodicMetricReader is determined as alive
|
84
|
+
def alive?
|
85
|
+
@continue || @thread.alive?
|
86
|
+
end
|
87
|
+
|
62
88
|
private
|
63
89
|
|
90
|
+
# Start a thread that continously export metrics within fixed duration.
|
91
|
+
# The wait mechanism is using to check @mutex lock with conditional variable
|
64
92
|
def start
|
65
93
|
@continue = true
|
66
94
|
if @exporter.nil?
|
@@ -70,19 +98,21 @@ module OpenTelemetry
|
|
70
98
|
else
|
71
99
|
@thread = Thread.new do
|
72
100
|
while @continue
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
export(timeout: @export_timeout)
|
77
|
-
end
|
78
|
-
rescue Timeout::Error => e
|
79
|
-
OpenTelemetry.handle_error(exception: e, message: 'PeriodicMetricReader timeout.')
|
101
|
+
lock do
|
102
|
+
@condition.wait(@mutex, @export_interval)
|
103
|
+
export(timeout: @export_timeout)
|
80
104
|
end
|
81
105
|
end
|
82
106
|
end
|
83
107
|
end
|
84
108
|
end
|
85
109
|
|
110
|
+
# Helper function for the defined exporter to export metrics.
|
111
|
+
# It only exports if the collected metrics are not an empty array (collect returns an Array).
|
112
|
+
#
|
113
|
+
# @param [optional Numeric] timeout An optional timeout in seconds.
|
114
|
+
# @return [Integer] SUCCESS if no error occurred, FAILURE if a
|
115
|
+
# non-specific failure occurred
|
86
116
|
def export(timeout: nil)
|
87
117
|
@export_mutex.synchronize do
|
88
118
|
collected_metrics = collect
|
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.6.
|
4
|
+
version: 0.6.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: 2025-
|
11
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -240,10 +240,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
240
240
|
licenses:
|
241
241
|
- Apache-2.0
|
242
242
|
metadata:
|
243
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.6.
|
243
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.6.1/file.CHANGELOG.html
|
244
244
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/metrics_sdk
|
245
245
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
246
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.6.
|
246
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-metrics-sdk/v0.6.1
|
247
247
|
post_install_message:
|
248
248
|
rdoc_options: []
|
249
249
|
require_paths:
|