opencensus-stackdriver 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 +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/opencensus/stackdriver/version.rb +1 -1
- data/lib/opencensus/stats/exporters/stackdriver/converter.rb +9 -9
- data/lib/opencensus/stats/exporters/stackdriver.rb +34 -48
- data/lib/opencensus/trace/exporters/stackdriver/converter.rb +14 -14
- data/lib/opencensus/trace/exporters/stackdriver.rb +18 -44
- metadata +32 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40d2d899106f63a8b02f06ac0da30df4b26c04af2f666f55085024472073f1d8
|
4
|
+
data.tar.gz: 8b22873772c9c99297a02b50cabc11c1dca6c1d4d1d7769ffd177bb6e13db4a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: affa787bc430a35160d75cbb6afc3e429ba59806b7d1aa2a03054ae254eaf9fd89136def9e62bd2d02f82dff593df1f9e749b9eaba4d675a0e7ab2df54b25326
|
7
|
+
data.tar.gz: 93cc31846c786a16241fcce662c62836f61a87c5cc0cc3fae643b6c3627161789f8addc3be848ef478e7ebbb9beb1ab36261a5115e6392e6ccd3fc929d85fb06
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.4.1 / 2021-11-03
|
4
|
+
|
5
|
+
* Fix: Use the AggregationData timestamp when exporting unchanged gauge values
|
6
|
+
|
7
|
+
### 0.4.0 / 2020-07-23
|
8
|
+
|
9
|
+
* Update for compatibility with changes to the google-cloud-trace and google-cloud-monitoring library structure.
|
10
|
+
* Requires Ruby 2.4 or later.
|
11
|
+
|
12
|
+
### 0.3.2 / 2020-02-24
|
13
|
+
|
14
|
+
* Update the google-cloud-trace and google-cloud-monitoring dependencies to versions that support service address override.
|
15
|
+
|
16
|
+
### 0.3.1 / 2020-02-06
|
17
|
+
|
18
|
+
* Support customizing the stackdriver service address
|
19
|
+
|
3
20
|
### 0.3.0 / 2019-10-14
|
4
21
|
|
5
22
|
This release requires version 0.5 or later of the opencensus gem. It includes
|
@@ -114,14 +114,14 @@ module OpenCensus
|
|
114
114
|
# @param [String] resource_type Metric resource type
|
115
115
|
# @param [Hash<String,String>] resource_labels Metric resource labels
|
116
116
|
# @param [OpenCensus::Stats::ViewData] view_data Stats view data
|
117
|
-
# @return [Array[Google::Monitoring::V3::TimeSeries]]
|
117
|
+
# @return [Array[Google::Cloud::Monitoring::V3::TimeSeries]]
|
118
118
|
#
|
119
119
|
def convert_time_series metric_prefix, resource_type, resource_labels,
|
120
120
|
view_data
|
121
121
|
view = view_data.view
|
122
122
|
|
123
123
|
view_data.data.map do |tag_values, aggr_data|
|
124
|
-
series = Google::Monitoring::V3::TimeSeries.new(
|
124
|
+
series = Google::Cloud::Monitoring::V3::TimeSeries.new(
|
125
125
|
metric: {
|
126
126
|
type: make_metric_type(metric_prefix, view.name),
|
127
127
|
labels: Hash[view.columns.zip tag_values]
|
@@ -152,15 +152,15 @@ module OpenCensus
|
|
152
152
|
# @param [OpenCensus::Stats:Measure] measure Measure details
|
153
153
|
# @param [OpenCensus::Stats:AggregationData] aggr_data Aggregated data
|
154
154
|
# @raise [TypeError] If invalid aggr data type.
|
155
|
-
# @return [Google::Monitoring::V3::Point]
|
155
|
+
# @return [Google::Cloud::Monitoring::V3::Point]
|
156
156
|
def convert_point start_time, end_time, measure, aggr_data
|
157
157
|
case aggr_data
|
158
158
|
when OpenCensus::Stats::AggregationData::Distribution
|
159
159
|
create_distribution_point start_time, end_time, aggr_data
|
160
160
|
when OpenCensus::Stats::AggregationData::LastValue
|
161
161
|
create_number_point(
|
162
|
-
|
163
|
-
|
162
|
+
end_time,
|
163
|
+
end_time,
|
164
164
|
aggr_data.value,
|
165
165
|
measure
|
166
166
|
)
|
@@ -181,7 +181,7 @@ module OpenCensus
|
|
181
181
|
# @param [Time] start_time Start time
|
182
182
|
# @param [Time] end_time Start time
|
183
183
|
# @param [OpenCensus::Stats::AggregationData::Distribution] aggr_data
|
184
|
-
# @return [Google::Monitoring::V3::Point]
|
184
|
+
# @return [Google::Cloud::Monitoring::V3::Point]
|
185
185
|
#
|
186
186
|
def create_distribution_point start_time, end_time, aggr_data
|
187
187
|
value = {
|
@@ -196,7 +196,7 @@ module OpenCensus
|
|
196
196
|
bucket_counts: [0].concat(aggr_data.bucket_counts)
|
197
197
|
}
|
198
198
|
|
199
|
-
Google::Monitoring::V3::Point.new(
|
199
|
+
Google::Cloud::Monitoring::V3::Point.new(
|
200
200
|
interval: {
|
201
201
|
start_time: convert_time(start_time),
|
202
202
|
end_time: convert_time(end_time)
|
@@ -212,7 +212,7 @@ module OpenCensus
|
|
212
212
|
# @param [Time] end_time Start time
|
213
213
|
# @param [Integer, Float] value
|
214
214
|
# @param [OpenCensus::Stats::Measure] measure Measure defination
|
215
|
-
# @return [Google::Monitoring::V3::Point]
|
215
|
+
# @return [Google::Cloud::Monitoring::V3::Point]
|
216
216
|
#
|
217
217
|
def create_number_point start_time, end_time, value, measure
|
218
218
|
value = if measure.int64?
|
@@ -221,7 +221,7 @@ module OpenCensus
|
|
221
221
|
{ double_value: value }
|
222
222
|
end
|
223
223
|
|
224
|
-
Google::Monitoring::V3::Point.new(
|
224
|
+
Google::Cloud::Monitoring::V3::Point.new(
|
225
225
|
interval: {
|
226
226
|
start_time: convert_time(start_time),
|
227
227
|
end_time: convert_time(end_time)
|
@@ -15,11 +15,11 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
-
gem "google-cloud-monitoring"
|
18
|
+
gem "google-cloud-monitoring-v3"
|
19
19
|
gem "concurrent-ruby"
|
20
20
|
|
21
21
|
require "concurrent"
|
22
|
-
require "google/cloud/
|
22
|
+
require "google/cloud/env"
|
23
23
|
require "google/cloud/monitoring/v3"
|
24
24
|
|
25
25
|
module OpenCensus
|
@@ -103,21 +103,27 @@ module OpenCensus
|
|
103
103
|
# Default value set to {GLOBAL_RESOURCE_TYPE}
|
104
104
|
# @param [Hash<String,String>] resource_labels Metric resource labels.
|
105
105
|
# Default value set to { "project_id" => project_id }
|
106
|
+
# @param [String] gcm_service_address Override for the Google
|
107
|
+
# Cloud Monitoring service hostname, or `nil` to leave as
|
108
|
+
# the default.
|
106
109
|
#
|
107
110
|
def initialize \
|
108
111
|
project_id: nil,
|
109
112
|
credentials: nil,
|
110
113
|
scope: nil,
|
111
114
|
timeout: nil,
|
112
|
-
client_config: nil,
|
115
|
+
client_config: nil, # rubocop:disable Lint/UnusedMethodArgument
|
113
116
|
max_queue: 1000,
|
114
117
|
max_threads: 1,
|
115
118
|
auto_terminate_time: 10,
|
116
119
|
mock_client: nil,
|
117
120
|
metric_prefix: nil,
|
118
121
|
resource_type: nil,
|
119
|
-
resource_labels: nil
|
120
|
-
|
122
|
+
resource_labels: nil,
|
123
|
+
gcm_service_address: nil
|
124
|
+
@project_id = project_id ||
|
125
|
+
ENV["GOOGLE_CLOUD_PROJECT"] ||
|
126
|
+
Google::Cloud.env.project_id
|
121
127
|
@metric_prefix = metric_prefix || CUSTOM_OPENCENSUS_DOMAIN
|
122
128
|
@resource_type = resource_type || GLOBAL_RESOURCE_TYPE
|
123
129
|
@resource_labels = resource_labels || {
|
@@ -133,14 +139,13 @@ module OpenCensus
|
|
133
139
|
@client_promise =
|
134
140
|
Concurrent::Promise.fulfill mock_client, executor: @executor
|
135
141
|
else
|
136
|
-
credentials = final_credentials credentials, scope
|
137
142
|
@client_promise = create_client_promise \
|
138
|
-
@executor, credentials, scope,
|
143
|
+
@executor, credentials, scope, timeout, gcm_service_address
|
139
144
|
end
|
140
145
|
|
141
146
|
@converter = Converter.new @project_id
|
142
|
-
|
143
|
-
|
147
|
+
paths = Google::Cloud::Monitoring::V3::MetricService::Paths
|
148
|
+
@project_path = paths.project_path project: @project_id
|
144
149
|
end
|
145
150
|
|
146
151
|
# Export stats to Monitoring service asynchronously.
|
@@ -158,7 +163,7 @@ module OpenCensus
|
|
158
163
|
export_as_batch(client, views_data)
|
159
164
|
end
|
160
165
|
export_promise.on_error do |reason|
|
161
|
-
warn "Unable to export to
|
166
|
+
warn "Unable to export to Monitoring service because: #{reason}"
|
162
167
|
end
|
163
168
|
|
164
169
|
nil
|
@@ -242,15 +247,16 @@ module OpenCensus
|
|
242
247
|
view,
|
243
248
|
metric_prefix
|
244
249
|
)
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
+
paths = Google::Cloud::Monitoring::V3::MetricService::Paths
|
251
|
+
metric_name = paths.metric_descriptor_path(
|
252
|
+
project: project_id,
|
253
|
+
metric_descriptor: metric_descriptor.type
|
254
|
+
)
|
250
255
|
|
251
256
|
@client_promise.execute
|
252
257
|
descriptor_create_promise = @client_promise.then do |client|
|
253
|
-
client.create_metric_descriptor metric_name,
|
258
|
+
client.create_metric_descriptor name: metric_name,
|
259
|
+
metric_descriptor: metric_descriptor
|
254
260
|
end
|
255
261
|
descriptor_create_promise.value!
|
256
262
|
end
|
@@ -273,17 +279,17 @@ module OpenCensus
|
|
273
279
|
# We create the client lazily so grpc doesn't get initialized until
|
274
280
|
# we actually need it. This is important because if it is intialized
|
275
281
|
# too early, before a fork, it can go into a bad state.
|
276
|
-
def create_client_promise executor, credentials, scopes,
|
277
|
-
timeout
|
282
|
+
def create_client_promise executor, credentials, scopes,
|
283
|
+
timeout, service_address
|
278
284
|
Concurrent::Promise.new executor: executor do
|
279
|
-
Google::Cloud::Monitoring::
|
280
|
-
credentials
|
281
|
-
scopes
|
282
|
-
|
283
|
-
|
284
|
-
lib_name
|
285
|
-
lib_version
|
286
|
-
|
285
|
+
Google::Cloud::Monitoring::V3::MetricService::Client.new do |config|
|
286
|
+
config.credentials = credentials if credentials
|
287
|
+
config.scope = scopes if scopes
|
288
|
+
config.timeout = timeout if timeout
|
289
|
+
config.endpoint = service_address if service_address
|
290
|
+
config.lib_name = "opencensus"
|
291
|
+
config.lib_version = OpenCensus::Stackdriver::VERSION
|
292
|
+
end
|
287
293
|
end
|
288
294
|
end
|
289
295
|
|
@@ -298,27 +304,6 @@ module OpenCensus
|
|
298
304
|
end
|
299
305
|
end
|
300
306
|
|
301
|
-
# Fall back to default project ID
|
302
|
-
def final_project_id project_id
|
303
|
-
project_id ||
|
304
|
-
Google::Cloud.configure.project_id ||
|
305
|
-
Google::Cloud.env.project_id
|
306
|
-
end
|
307
|
-
|
308
|
-
# Fall back to default credentials, and wrap in a creds object
|
309
|
-
def final_credentials credentials, scope
|
310
|
-
credentials ||=
|
311
|
-
Google::Cloud.configure.credentials ||
|
312
|
-
Google::Cloud::Monitoring::V3::Credentials.default(scope: scope)
|
313
|
-
unless credentials.is_a? Google::Auth::Credentials
|
314
|
-
credentials = Google::Cloud::Monitoring::V3::Credentials.new(
|
315
|
-
credentials,
|
316
|
-
scope: scope
|
317
|
-
)
|
318
|
-
end
|
319
|
-
credentials
|
320
|
-
end
|
321
|
-
|
322
307
|
# Export a list of stats in the current thread
|
323
308
|
def export_as_batch client, views_data
|
324
309
|
time_series = views_data.map do |view_data|
|
@@ -330,7 +315,8 @@ module OpenCensus
|
|
330
315
|
)
|
331
316
|
end
|
332
317
|
|
333
|
-
client.create_time_series @project_path,
|
318
|
+
client.create_time_series name: @project_path,
|
319
|
+
time_series: time_series.flatten
|
334
320
|
end
|
335
321
|
end
|
336
322
|
end
|
@@ -36,7 +36,7 @@ module OpenCensus
|
|
36
36
|
# @private
|
37
37
|
# Alias for the V2 Cloudtrace protos namespace
|
38
38
|
#
|
39
|
-
TraceProtos = Google::
|
39
|
+
TraceProtos = Google::Cloud::Trace::V2
|
40
40
|
|
41
41
|
##
|
42
42
|
# @private
|
@@ -83,7 +83,7 @@ module OpenCensus
|
|
83
83
|
# Convert a span object.
|
84
84
|
#
|
85
85
|
# @param [OpenCensus::Trace::Span] obj OpenCensus span object
|
86
|
-
# @return [Google::
|
86
|
+
# @return [Google::Cloud::Trace::V2::Span] The generated
|
87
87
|
# proto
|
88
88
|
#
|
89
89
|
def convert_span obj
|
@@ -132,7 +132,7 @@ module OpenCensus
|
|
132
132
|
# @param [String] str The string
|
133
133
|
# @param [Integer] truncated_byte_count The number of bytes omitted.
|
134
134
|
# Defaults to 0.
|
135
|
-
# @return [Google::
|
135
|
+
# @return [Google::Cloud::Trace::V2::TruncatableString] The
|
136
136
|
# generated proto
|
137
137
|
#
|
138
138
|
def make_truncatable_string str, truncated_byte_count = 0
|
@@ -146,7 +146,7 @@ module OpenCensus
|
|
146
146
|
#
|
147
147
|
# @param [OpenCensus::Trace::TruncatableString] obj OpenCensus
|
148
148
|
# truncatable string object
|
149
|
-
# @return [Google::
|
149
|
+
# @return [Google::Cloud::Trace::V2::TruncatableString] The
|
150
150
|
# generated proto
|
151
151
|
#
|
152
152
|
def convert_truncatable_string obj
|
@@ -170,7 +170,7 @@ module OpenCensus
|
|
170
170
|
#
|
171
171
|
# @param [OpenCensus::Trace::TruncatableString, Integer, boolean]
|
172
172
|
# obj Object to convert
|
173
|
-
# @return [Google::
|
173
|
+
# @return [Google::Cloud::Trace::V2::AttributeValue] The
|
174
174
|
# generated proto
|
175
175
|
#
|
176
176
|
def convert_attribute_value obj
|
@@ -202,7 +202,7 @@ module OpenCensus
|
|
202
202
|
# @param [Integer] dropped_attributes_count Number of dropped
|
203
203
|
# @param [Boolean] include_agent_attribute Include the `g.co/agent`
|
204
204
|
# attribute in the result. Default is false.
|
205
|
-
# @return [Google::
|
205
|
+
# @return [Google::Cloud::Trace::V2::Attributes] The
|
206
206
|
# generated proto
|
207
207
|
#
|
208
208
|
def convert_attributes attributes, dropped_attributes_count,
|
@@ -225,7 +225,7 @@ module OpenCensus
|
|
225
225
|
#
|
226
226
|
# @param [Thread::Backtrace::Location] frame The backtrace element to
|
227
227
|
# convert
|
228
|
-
# @return [Google::
|
228
|
+
# @return [Google::Cloud::Trace::V2::StackTrace::StackFrame]
|
229
229
|
# The generated proto
|
230
230
|
#
|
231
231
|
def convert_stack_frame frame
|
@@ -242,7 +242,7 @@ module OpenCensus
|
|
242
242
|
# element array to convert
|
243
243
|
# @param [Integer] dropped_frames_count Frames that were dropped
|
244
244
|
# @param [Integer] stack_trace_hash_id Hash of the data
|
245
|
-
# @return [Google::
|
245
|
+
# @return [Google::Cloud::Trace::V2::StackTrace] The
|
246
246
|
# generated proto
|
247
247
|
#
|
248
248
|
def convert_stack_trace backtrace, dropped_frames_count,
|
@@ -267,7 +267,7 @@ module OpenCensus
|
|
267
267
|
# @param [OpenCensus::Trace::Annotation] annotation The annotation
|
268
268
|
# object to convert
|
269
269
|
# @return
|
270
|
-
# [Google::
|
270
|
+
# [Google::Cloud::Trace::V2::Span::TimeEvent::Annotation]
|
271
271
|
# The generated proto
|
272
272
|
#
|
273
273
|
def convert_annotation annotation
|
@@ -287,7 +287,7 @@ module OpenCensus
|
|
287
287
|
# @param [OpenCensus::Trace::MessageEvent] message_event The message
|
288
288
|
# event object to convert
|
289
289
|
# @return
|
290
|
-
# [Google::
|
290
|
+
# [Google::Cloud::Trace::V2::Span::TimeEvent::MessageEvent]
|
291
291
|
# The generated proto
|
292
292
|
#
|
293
293
|
def convert_message_event message_event
|
@@ -297,7 +297,7 @@ module OpenCensus
|
|
297
297
|
id: message_event.id,
|
298
298
|
uncompressed_size_bytes: message_event.uncompressed_size,
|
299
299
|
compressed_size_bytes: message_event.compressed_size
|
300
|
-
|
300
|
+
TraceProtos::Span::TimeEvent.new \
|
301
301
|
time: convert_time(message_event.time),
|
302
302
|
message_event: message_event_proto
|
303
303
|
end
|
@@ -311,7 +311,7 @@ module OpenCensus
|
|
311
311
|
# annotations
|
312
312
|
# @param [Integer] dropped_message_events_count Number of dropped
|
313
313
|
# message events
|
314
|
-
# @return [Google::
|
314
|
+
# @return [Google::Cloud::Trace::V2::Span::TimeEvents] The
|
315
315
|
# generated proto
|
316
316
|
#
|
317
317
|
def convert_time_events time_events, dropped_annotations_count,
|
@@ -336,7 +336,7 @@ module OpenCensus
|
|
336
336
|
# Convert a link object
|
337
337
|
#
|
338
338
|
# @param [OpenCensus::Trace::Link] link The link object to convert
|
339
|
-
# @return [Google::
|
339
|
+
# @return [Google::Cloud::Trace::V2::Span::Link] The
|
340
340
|
# generated proto
|
341
341
|
#
|
342
342
|
def convert_link link
|
@@ -355,7 +355,7 @@ module OpenCensus
|
|
355
355
|
# @param [Array<OpenCensus::Trace::Link>] links The link objects to
|
356
356
|
# convert
|
357
357
|
# @param [Integer] dropped_links_count Number of dropped links
|
358
|
-
# @return [Google::
|
358
|
+
# @return [Google::Cloud::Trace::V2::Span::Links] The
|
359
359
|
# generated proto
|
360
360
|
#
|
361
361
|
def convert_links links, dropped_links_count
|
@@ -13,11 +13,11 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
-
gem "google-cloud-trace"
|
16
|
+
gem "google-cloud-trace-v2"
|
17
17
|
gem "concurrent-ruby"
|
18
18
|
|
19
19
|
require "concurrent"
|
20
|
-
require "google/cloud/
|
20
|
+
require "google/cloud/env"
|
21
21
|
require "google/cloud/trace/v2"
|
22
22
|
|
23
23
|
module OpenCensus
|
@@ -56,8 +56,7 @@ module OpenCensus
|
|
56
56
|
# Optional. Most applications can leave this set to the default.
|
57
57
|
# @param [Integer] timeout The default timeout for API requests, in
|
58
58
|
# seconds. Optional.
|
59
|
-
# @param [Hash] client_config
|
60
|
-
# configuration values for the API connection.
|
59
|
+
# @param [Hash] client_config Unused.
|
61
60
|
# @param [Integer] max_queue The maximum number of API requests that
|
62
61
|
# can be queued for background operation. If the queue exceeds this
|
63
62
|
# value, additional requests will be run in the calling thread
|
@@ -75,13 +74,14 @@ module OpenCensus
|
|
75
74
|
credentials: nil,
|
76
75
|
scope: nil,
|
77
76
|
timeout: nil,
|
78
|
-
client_config: nil,
|
77
|
+
client_config: nil, # rubocop:disable Lint/UnusedMethodArgument
|
79
78
|
max_queue: 1000,
|
80
79
|
max_threads: 1,
|
81
80
|
auto_terminate_time: 10,
|
82
81
|
mock_client: nil
|
83
|
-
@project_id =
|
84
|
-
|
82
|
+
@project_id = project_id ||
|
83
|
+
ENV["GOOGLE_CLOUD_PROJECT"] ||
|
84
|
+
Google::Cloud.env.project_id
|
85
85
|
@executor = create_executor max_threads, max_queue
|
86
86
|
if auto_terminate_time
|
87
87
|
terminate_at_exit! @executor, auto_terminate_time
|
@@ -91,12 +91,8 @@ module OpenCensus
|
|
91
91
|
@client_promise =
|
92
92
|
Concurrent::Promise.fulfill mock_client, executor: @executor
|
93
93
|
else
|
94
|
-
credentials = final_credentials credentials, scope
|
95
|
-
scope ||= Google::Cloud.configure.trace.scope
|
96
|
-
timeout ||= Google::Cloud.configure.trace.timeout
|
97
|
-
client_config ||= Google::Cloud.configure.trace.client_config
|
98
94
|
@client_promise = create_client_promise \
|
99
|
-
@executor, credentials, scope,
|
95
|
+
@executor, credentials, scope, timeout
|
100
96
|
end
|
101
97
|
end
|
102
98
|
|
@@ -210,17 +206,15 @@ module OpenCensus
|
|
210
206
|
# We create the client lazily so grpc doesn't get initialized until
|
211
207
|
# we actually need it. This is important because if it is intialized
|
212
208
|
# too early, before a fork, it can go into a bad state.
|
213
|
-
def create_client_promise executor, credentials, scopes,
|
214
|
-
timeout
|
209
|
+
def create_client_promise executor, credentials, scopes, timeout
|
215
210
|
Concurrent::Promise.new executor: executor do
|
216
|
-
Google::Cloud::Trace::V2.new
|
217
|
-
credentials
|
218
|
-
scopes
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
)
|
211
|
+
Google::Cloud::Trace::V2::TraceService::Client.new do |config|
|
212
|
+
config.credentials = credentials if credentials
|
213
|
+
config.scope = scopes if scopes
|
214
|
+
config.timeout = timeout if timeout
|
215
|
+
config.lib_name = "opencensus"
|
216
|
+
config.lib_version = OpenCensus::Stackdriver::VERSION
|
217
|
+
end
|
224
218
|
end
|
225
219
|
end
|
226
220
|
|
@@ -235,32 +229,12 @@ module OpenCensus
|
|
235
229
|
end
|
236
230
|
end
|
237
231
|
|
238
|
-
# Fall back to default project ID
|
239
|
-
def final_project_id project_id
|
240
|
-
project_id ||
|
241
|
-
Google::Cloud.configure.trace.project_id ||
|
242
|
-
Google::Cloud.configure.project_id ||
|
243
|
-
Google::Cloud.env.project_id
|
244
|
-
end
|
245
|
-
|
246
|
-
# Fall back to default credentials, and wrap in a creds object
|
247
|
-
def final_credentials credentials, scope
|
248
|
-
credentials ||=
|
249
|
-
Google::Cloud.configure.trace.credentials ||
|
250
|
-
Google::Cloud.configure.credentials ||
|
251
|
-
Google::Cloud::Trace::Credentials.default(scope: scope)
|
252
|
-
unless credentials.is_a? Google::Auth::Credentials
|
253
|
-
credentials =
|
254
|
-
Google::Cloud::Trace::Credentials.new credentials, scope: scope
|
255
|
-
end
|
256
|
-
credentials
|
257
|
-
end
|
258
|
-
|
259
232
|
# Export a list of spans in a single batch write, in the current thread
|
260
233
|
def export_as_batch client, spans
|
261
234
|
converter = Converter.new project_id
|
262
235
|
span_protos = Array(spans).map { |span| converter.convert_span span }
|
263
|
-
client.batch_write_spans "projects/#{project_id}",
|
236
|
+
client.batch_write_spans name: "projects/#{project_id}",
|
237
|
+
spans: span_protos
|
264
238
|
end
|
265
239
|
end
|
266
240
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opencensus-stackdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -25,47 +25,61 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: google-cloud-
|
28
|
+
name: google-cloud-env
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: google-cloud-monitoring-v3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: google-cloud-
|
56
|
+
name: google-cloud-trace-v2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: '0.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: '0.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: opencensus
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.5'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.5'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +114,14 @@ dependencies:
|
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '5.
|
117
|
+
version: '5.14'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '5.
|
124
|
+
version: '5.14'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: minitest-focus
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,7 +231,7 @@ homepage: https://github.com/census-instrumentation/ruby-stackdriver-exporter
|
|
217
231
|
licenses:
|
218
232
|
- Apache-2.0
|
219
233
|
metadata: {}
|
220
|
-
post_install_message:
|
234
|
+
post_install_message:
|
221
235
|
rdoc_options: []
|
222
236
|
require_paths:
|
223
237
|
- lib
|
@@ -225,15 +239,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
239
|
requirements:
|
226
240
|
- - ">="
|
227
241
|
- !ruby/object:Gem::Version
|
228
|
-
version: 2.
|
242
|
+
version: 2.4.0
|
229
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
244
|
requirements:
|
231
245
|
- - ">="
|
232
246
|
- !ruby/object:Gem::Version
|
233
247
|
version: '0'
|
234
248
|
requirements: []
|
235
|
-
rubygems_version: 3.
|
236
|
-
signing_key:
|
249
|
+
rubygems_version: 3.2.22
|
250
|
+
signing_key:
|
237
251
|
specification_version: 4
|
238
252
|
summary: Stackdriver exporter for OpenCensus
|
239
253
|
test_files: []
|