google-cloud-trace 0.27.2 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/google-cloud-trace.rb +12 -10
- data/lib/google/cloud/trace.rb +22 -16
- data/lib/google/cloud/trace/credentials.rb +31 -15
- data/lib/google/cloud/trace/label_key.rb +1 -1
- data/lib/google/cloud/trace/middleware.rb +1 -1
- data/lib/google/cloud/trace/notifications.rb +1 -1
- data/lib/google/cloud/trace/project.rb +8 -7
- data/lib/google/cloud/trace/rails.rb +1 -1
- data/lib/google/cloud/trace/service.rb +14 -36
- data/lib/google/cloud/trace/span.rb +3 -3
- data/lib/google/cloud/trace/trace_record.rb +3 -2
- data/lib/google/cloud/trace/v1/doc/google/devtools/cloudtrace/v1/trace.rb +84 -11
- data/lib/google/cloud/trace/v1/doc/google/protobuf/timestamp.rb +26 -1
- data/lib/google/cloud/trace/v1/doc/overview.rb +56 -0
- data/lib/google/cloud/trace/v1/trace_service_client.rb +176 -108
- data/lib/google/cloud/trace/v1/trace_service_client_config.json +15 -6
- data/lib/google/cloud/trace/version.rb +1 -1
- data/lib/google/devtools/cloudtrace/v1/trace_services_pb.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 155666f9d25b1a89fc1961ff6f951a85d70ee76d0b873c0ae8d0968d2fe7bdc5
|
4
|
+
data.tar.gz: bb205f6876342cc8475afa4846199bf7776c9a424e22ae3bf76db4c4081dfcab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f8611b26a07d784c37d71c57d067b7aa811176301cd146c47fc355c2b53e4da7987d19ea83a423fa1bdfda7a3780c465c4f4cf1f5413f922069b00259c07485
|
7
|
+
data.tar.gz: 3cbfea10ed4fd5452a6b543177f713a8cdfe89944285ace795a6d83d33f69870aa5341b741adb6449371b743000a38ea7158206ccf9405c21c3e7c0ec00ca1c8
|
data/lib/google-cloud-trace.rb
CHANGED
@@ -13,9 +13,9 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
##
|
16
|
-
# This file is here to be autorequired by bundler, so that the
|
17
|
-
# #trace methods can be available, but the
|
18
|
-
# be loaded until required and used.
|
16
|
+
# This file is here to be autorequired by bundler, so that the
|
17
|
+
# Google::Cloud.trace and Google::Cloud#trace methods can be available, but the
|
18
|
+
# library and all dependencies won't be loaded until required and used.
|
19
19
|
|
20
20
|
|
21
21
|
gem "google-cloud-core"
|
@@ -63,10 +63,12 @@ module Google
|
|
63
63
|
# For more information on connecting to Google Cloud see the [Authentication
|
64
64
|
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
|
65
65
|
#
|
66
|
-
# @param [String]
|
67
|
-
# service.
|
68
|
-
#
|
69
|
-
#
|
66
|
+
# @param [String] project_id Project identifier for the Stackdriver Trace
|
67
|
+
# service you are connecting to. If not present, the default project for
|
68
|
+
# the credentials is used.
|
69
|
+
# @param [String, Hash, Google::Auth::Credentials] credentials The path to
|
70
|
+
# the keyfile as a String, the contents of the keyfile as a Hash, or a
|
71
|
+
# Google::Auth::Credentials object. (See {Trace::Credentials})
|
70
72
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
|
71
73
|
# set of resources and operations that the connection can access. See
|
72
74
|
# [Using OAuth 2.0 to Access Google
|
@@ -86,10 +88,10 @@ module Google
|
|
86
88
|
# puts "Retrieved trace ID: #{trace.trace_id}"
|
87
89
|
# end
|
88
90
|
#
|
89
|
-
def self.trace
|
90
|
-
client_config: nil
|
91
|
+
def self.trace project_id = nil, credentials = nil, scope: nil,
|
92
|
+
timeout: nil, client_config: nil
|
91
93
|
require "google/cloud/trace"
|
92
|
-
Google::Cloud::Trace.new
|
94
|
+
Google::Cloud::Trace.new project_id: project_id, credentials: credentials,
|
93
95
|
scope: scope, timeout: timeout,
|
94
96
|
client_config: client_config
|
95
97
|
end
|
data/lib/google/cloud/trace.rb
CHANGED
@@ -205,16 +205,21 @@ module Google
|
|
205
205
|
# [Authentication
|
206
206
|
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
|
207
207
|
#
|
208
|
-
# @param [String]
|
209
|
-
# service.
|
210
|
-
#
|
211
|
-
#
|
208
|
+
# @param [String] project_id Project identifier for the Stackdriver Trace
|
209
|
+
# service you are connecting to. If not present, the default project for
|
210
|
+
# the credentials is used.
|
211
|
+
# @param [String, Hash, Google::Auth::Credentials] credentials The path to
|
212
|
+
# the keyfile as a String, the contents of the keyfile as a Hash, or a
|
213
|
+
# Google::Auth::Credentials object. (See {Trace::Credentials})
|
212
214
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
|
213
215
|
# the set of resources and operations that the connection can access.
|
214
216
|
# See [Using OAuth 2.0 to Access Google
|
215
217
|
# APIs](https://developers.google.com/identity/protocols/OAuth2).
|
216
218
|
# The default scope is `https://www.googleapis.com/auth/cloud-platform`
|
217
219
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
220
|
+
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
221
|
+
# @param [String] keyfile Alias for the `credentials` argument.
|
222
|
+
# Deprecated.
|
218
223
|
#
|
219
224
|
# @return [Google::Cloud::Trace::Project]
|
220
225
|
#
|
@@ -228,20 +233,21 @@ module Google
|
|
228
233
|
# puts "Retrieved trace ID: #{trace.trace_id}"
|
229
234
|
# end
|
230
235
|
#
|
231
|
-
def self.new
|
232
|
-
client_config: nil
|
233
|
-
|
234
|
-
|
235
|
-
fail ArgumentError, "
|
236
|
+
def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
|
237
|
+
client_config: nil, project: nil, keyfile: nil
|
238
|
+
project_id ||= (project || Trace::Project.default_project_id)
|
239
|
+
project_id = project_id.to_s # Always cast to a string
|
240
|
+
fail ArgumentError, "project_id is missing" if project_id.empty?
|
236
241
|
|
237
|
-
credentials
|
238
|
-
|
239
|
-
|
242
|
+
credentials ||= (keyfile || Trace::Credentials.default(scope: scope))
|
243
|
+
unless credentials.is_a? Google::Auth::Credentials
|
244
|
+
credentials = Trace::Credentials.new credentials, scope: scope
|
245
|
+
end
|
240
246
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
247
|
+
Trace::Project.new(
|
248
|
+
Trace::Service.new(
|
249
|
+
project_id, credentials, timeout: timeout,
|
250
|
+
client_config: client_config))
|
245
251
|
end
|
246
252
|
|
247
253
|
##
|
@@ -13,28 +13,44 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
-
require "
|
16
|
+
require "googleauth"
|
17
17
|
|
18
18
|
module Google
|
19
19
|
module Cloud
|
20
20
|
module Trace
|
21
21
|
##
|
22
|
-
#
|
23
|
-
|
22
|
+
# # Credentials
|
23
|
+
#
|
24
|
+
# Represents the authentication and authorization used to connect to the
|
25
|
+
# Stackdriver Trace API.
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# require "google/cloud/trace"
|
29
|
+
#
|
30
|
+
# keyfile = "/path/to/keyfile.json"
|
31
|
+
# creds = Google::Cloud::Trace::Credentials.new keyfile
|
32
|
+
#
|
33
|
+
# trace = Google::Cloud::Trace.new(
|
34
|
+
# project_id: "my-project",
|
35
|
+
# credentials: creds
|
36
|
+
# )
|
37
|
+
#
|
38
|
+
# trace.project_id #=> "my-project"
|
39
|
+
#
|
40
|
+
class Credentials < Google::Auth::Credentials
|
24
41
|
SCOPE = ["https://www.googleapis.com/auth/cloud-platform"]
|
25
|
-
PATH_ENV_VARS = %w(
|
26
|
-
|
42
|
+
PATH_ENV_VARS = %w(TRACE_CREDENTIALS
|
43
|
+
TRACE_KEYFILE
|
44
|
+
GOOGLE_CLOUD_CREDENTIALS
|
45
|
+
GOOGLE_CLOUD_KEYFILE
|
46
|
+
GCLOUD_KEYFILE)
|
47
|
+
JSON_ENV_VARS = %w(TRACE_CREDENTIALS_JSON
|
48
|
+
TRACE_KEYFILE_JSON
|
49
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
50
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
27
51
|
GCLOUD_KEYFILE_JSON)
|
28
|
-
|
29
|
-
|
30
|
-
# @private Create credentials with given scope and/or keyfile
|
31
|
-
def self.credentials_with_scope keyfile, scope = nil
|
32
|
-
if keyfile.nil?
|
33
|
-
default(scope: scope)
|
34
|
-
else
|
35
|
-
new(keyfile, scope: scope)
|
36
|
-
end
|
37
|
-
end
|
52
|
+
DEFAULT_PATHS = \
|
53
|
+
["~/.config/gcloud/application_default_credentials.json"]
|
38
54
|
end
|
39
55
|
end
|
40
56
|
end
|
@@ -106,7 +106,7 @@ module Google
|
|
106
106
|
# @example
|
107
107
|
# require "google/cloud/trace"
|
108
108
|
#
|
109
|
-
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project
|
109
|
+
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project"
|
110
110
|
# span = trace_record.create_span "root_span"
|
111
111
|
# Google::Cloud::Trace::LabelKey.set_stack_trace span.labels
|
112
112
|
#
|
@@ -378,7 +378,7 @@ module Google
|
|
378
378
|
# Fallback to default configuration values if not defined already
|
379
379
|
def init_default_config
|
380
380
|
configuration.project_id ||= Cloud.configure.project_id ||
|
381
|
-
Trace::Project.
|
381
|
+
Trace::Project.default_project_id
|
382
382
|
configuration.keyfile ||= Cloud.configure.keyfile
|
383
383
|
configuration.capture_stack ||= false
|
384
384
|
end
|
@@ -61,7 +61,7 @@ module Google
|
|
61
61
|
#
|
62
62
|
# Google::Cloud::Trace::Notifications.instrument "sql.activerecord"
|
63
63
|
#
|
64
|
-
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project
|
64
|
+
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project"
|
65
65
|
# Google::Cloud::Trace.set trace_record
|
66
66
|
#
|
67
67
|
# ActiveRecord::Base.connection.execute "SHOW TABLES"
|
@@ -61,15 +61,16 @@ module Google
|
|
61
61
|
# require "google/cloud/trace"
|
62
62
|
#
|
63
63
|
# trace_client = Google::Cloud::Trace.new(
|
64
|
-
#
|
65
|
-
#
|
64
|
+
# project_id: "my-project",
|
65
|
+
# credentials: "/path/to/keyfile.json"
|
66
66
|
# )
|
67
67
|
#
|
68
|
-
# trace_client.
|
68
|
+
# trace_client.project_id #=> "my-project"
|
69
69
|
#
|
70
|
-
def
|
70
|
+
def project_id
|
71
71
|
service.project
|
72
72
|
end
|
73
|
+
alias_method :project, :project_id
|
73
74
|
|
74
75
|
##
|
75
76
|
# Create a new empty trace record for this project. Uses the current
|
@@ -87,8 +88,8 @@ module Google
|
|
87
88
|
# require "google/cloud/trace"
|
88
89
|
#
|
89
90
|
# trace_client = Google::Cloud::Trace.new(
|
90
|
-
#
|
91
|
-
#
|
91
|
+
# project_id: "my-project",
|
92
|
+
# credentials: "/path/to/keyfile.json"
|
92
93
|
# )
|
93
94
|
#
|
94
95
|
# trace = trace_client.new_trace
|
@@ -198,7 +199,7 @@ module Google
|
|
198
199
|
|
199
200
|
##
|
200
201
|
# @private Default project.
|
201
|
-
def self.
|
202
|
+
def self.default_project_id
|
202
203
|
ENV["TRACE_PROJECT"] ||
|
203
204
|
ENV["GOOGLE_CLOUD_PROJECT"] ||
|
204
205
|
ENV["GCLOUD_PROJECT"] ||
|
@@ -163,7 +163,7 @@ module Google
|
|
163
163
|
##
|
164
164
|
# Fallback to default config values if config parameters not provided.
|
165
165
|
def self.init_default_config
|
166
|
-
Trace.configure.project_id ||= Trace::Project.
|
166
|
+
Trace.configure.project_id ||= Trace::Project.default_project_id
|
167
167
|
end
|
168
168
|
|
169
169
|
##
|
@@ -35,10 +35,6 @@ module Google
|
|
35
35
|
# @private
|
36
36
|
attr_accessor :credentials
|
37
37
|
|
38
|
-
##
|
39
|
-
# @private
|
40
|
-
attr_accessor :host
|
41
|
-
|
42
38
|
##
|
43
39
|
# @private
|
44
40
|
attr_accessor :timeout
|
@@ -49,41 +45,29 @@ module Google
|
|
49
45
|
|
50
46
|
##
|
51
47
|
# Creates a new Service instance.
|
52
|
-
def initialize project, credentials,
|
53
|
-
client_config: nil
|
48
|
+
def initialize project, credentials, timeout: nil, client_config: nil
|
54
49
|
@project = project
|
55
50
|
@credentials = credentials
|
56
|
-
@host = host || V1::TraceServiceClient::SERVICE_ADDRESS
|
57
51
|
@timeout = timeout
|
58
52
|
@client_config = client_config || {}
|
59
53
|
end
|
60
54
|
|
61
|
-
def channel
|
62
|
-
load_grpc
|
63
|
-
GRPC::Core::Channel.new host, nil, chan_creds
|
64
|
-
end
|
65
|
-
|
66
|
-
def chan_creds
|
67
|
-
return credentials if insecure?
|
68
|
-
load_grpc
|
69
|
-
GRPC::Core::ChannelCredentials.new.compose \
|
70
|
-
GRPC::Core::CallCredentials.new credentials.client.updater_proc
|
71
|
-
end
|
72
|
-
|
73
|
-
def insecure?
|
74
|
-
credentials == :this_channel_is_insecure
|
75
|
-
end
|
76
|
-
|
77
55
|
def lowlevel_client
|
78
56
|
return mocked_lowlevel_client if mocked_lowlevel_client
|
57
|
+
|
79
58
|
@lowlevel_client ||= \
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
59
|
+
begin
|
60
|
+
require "grpc"
|
61
|
+
require "google/cloud/trace/patches/active_call_with_trace"
|
62
|
+
require "google/cloud/trace/patches/call_with_trace"
|
63
|
+
|
64
|
+
V1::TraceServiceClient.new(
|
65
|
+
credentials: credentials,
|
66
|
+
timeout: timeout,
|
67
|
+
client_config: client_config,
|
68
|
+
lib_name: "gccl",
|
69
|
+
lib_version: Google::Cloud::Trace::VERSION)
|
70
|
+
end
|
87
71
|
end
|
88
72
|
attr_accessor :mocked_lowlevel_client
|
89
73
|
|
@@ -160,12 +144,6 @@ module Google
|
|
160
144
|
# GaxError wraps BadStatus, but exposes it as #cause
|
161
145
|
raise Google::Cloud::Error.from_error(e.cause)
|
162
146
|
end
|
163
|
-
|
164
|
-
def load_grpc
|
165
|
-
require "grpc"
|
166
|
-
require "google/cloud/trace/patches/active_call_with_trace"
|
167
|
-
require "google/cloud/trace/patches/call_with_trace"
|
168
|
-
end
|
169
147
|
end
|
170
148
|
end
|
171
149
|
end
|
@@ -244,7 +244,7 @@ module Google
|
|
244
244
|
# @example
|
245
245
|
# require "google/cloud/trace"
|
246
246
|
#
|
247
|
-
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project
|
247
|
+
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project"
|
248
248
|
# span = trace_record.create_span "root_span"
|
249
249
|
# subspan = span.create_span "subspan"
|
250
250
|
#
|
@@ -272,7 +272,7 @@ module Google
|
|
272
272
|
# @example
|
273
273
|
# require "google/cloud/trace"
|
274
274
|
#
|
275
|
-
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project
|
275
|
+
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project"
|
276
276
|
# trace_record.in_span "root_span" do |span|
|
277
277
|
# # Do stuff...
|
278
278
|
# span.in_span "subspan" do |subspan|
|
@@ -367,7 +367,7 @@ module Google
|
|
367
367
|
# @example
|
368
368
|
# require "google/cloud/trace"
|
369
369
|
#
|
370
|
-
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project
|
370
|
+
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project"
|
371
371
|
# root1 = trace_record.create_span "root_span_1"
|
372
372
|
# root2 = trace_record.create_span "root_span_2"
|
373
373
|
# subspan = root1.create_span "subspan"
|
@@ -122,6 +122,7 @@ module Google
|
|
122
122
|
# @return [String]
|
123
123
|
#
|
124
124
|
attr_reader :project
|
125
|
+
alias_method :project_id, :project
|
125
126
|
|
126
127
|
##
|
127
128
|
# The context for this trace.
|
@@ -182,7 +183,7 @@ module Google
|
|
182
183
|
# @example
|
183
184
|
# require "google/cloud/trace"
|
184
185
|
#
|
185
|
-
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project
|
186
|
+
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project"
|
186
187
|
# span = trace_record.create_span "root_span"
|
187
188
|
#
|
188
189
|
def create_span name, span_id: nil, parent_span_id: 0,
|
@@ -219,7 +220,7 @@ module Google
|
|
219
220
|
# @example
|
220
221
|
# require "google/cloud/trace"
|
221
222
|
#
|
222
|
-
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project
|
223
|
+
# trace_record = Google::Cloud::Trace::TraceRecord.new "my-project"
|
223
224
|
# trace_record.in_span "root_span" do |span|
|
224
225
|
# # Do stuff...
|
225
226
|
# end
|
@@ -15,6 +15,17 @@
|
|
15
15
|
module Google
|
16
16
|
module Devtools
|
17
17
|
module Cloudtrace
|
18
|
+
##
|
19
|
+
# # Stackdriver Trace API Contents
|
20
|
+
#
|
21
|
+
# | Class | Description |
|
22
|
+
# | ----- | ----------- |
|
23
|
+
# | [TraceServiceClient][] | Send and retrieve trace data from Stackdriver Trace. Data is generated and available by default for all App Engine applications. Data from other applications can be written to Stackdriver Trace for display, reporting, and analysis. |
|
24
|
+
# | [Data Types][] | Data types for Google::Cloud::Trace::V1 |
|
25
|
+
#
|
26
|
+
# [TraceServiceClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-trace/latest/google/devtools/cloudtrace/v1/traceserviceclient
|
27
|
+
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-trace/latest/google/devtools/cloudtrace/v1/datatypes
|
28
|
+
#
|
18
29
|
module V1
|
19
30
|
# A trace describes how long it takes for an application to perform an
|
20
31
|
# operation. It consists of a set of spans, each of which represent a single
|
@@ -53,8 +64,9 @@ module Google
|
|
53
64
|
# and +RPC_SERVER+ to identify queueing latency associated with the span.
|
54
65
|
# @!attribute [rw] name
|
55
66
|
# @return [String]
|
56
|
-
# Name of the
|
57
|
-
# Stackdriver Trace tool in the
|
67
|
+
# Name of the span. Must be less than 128 bytes. The span name is sanitized
|
68
|
+
# and displayed in the Stackdriver Trace tool in the
|
69
|
+
# {% dynamic print site_values.console_name %}.
|
58
70
|
# The name may be a method name or some other per-call site name.
|
59
71
|
# For the same executable and the same call point, a best practice is
|
60
72
|
# to use a consistent name, which makes it easier to correlate
|
@@ -70,7 +82,39 @@ module Google
|
|
70
82
|
# ID of the parent span, if any. Optional.
|
71
83
|
# @!attribute [rw] labels
|
72
84
|
# @return [Hash{String => String}]
|
73
|
-
# Collection of labels associated with the span.
|
85
|
+
# Collection of labels associated with the span. Label keys must be less than
|
86
|
+
# 128 bytes. Label values must be less than 16 kilobytes (10MB for
|
87
|
+
# +/stacktrace+ values).
|
88
|
+
#
|
89
|
+
# Some predefined label keys exist, or you may create your own. When creating
|
90
|
+
# your own, we recommend the following formats:
|
91
|
+
#
|
92
|
+
# * +/category/product/key+ for agents of well-known products (e.g.
|
93
|
+
# +/db/mongodb/read_size+).
|
94
|
+
# * +short_host/path/key+ for domain-specific keys (e.g.
|
95
|
+
# +foo.com/myproduct/bar+)
|
96
|
+
#
|
97
|
+
# Predefined labels include:
|
98
|
+
#
|
99
|
+
# * +/agent+
|
100
|
+
# * +/component+
|
101
|
+
# * +/error/message+
|
102
|
+
# * +/error/name+
|
103
|
+
# * +/http/client_city+
|
104
|
+
# * +/http/client_country+
|
105
|
+
# * +/http/client_protocol+
|
106
|
+
# * +/http/client_region+
|
107
|
+
# * +/http/host+
|
108
|
+
# * +/http/method+
|
109
|
+
# * +/http/redirected_url+
|
110
|
+
# * +/http/request/size+
|
111
|
+
# * +/http/response/size+
|
112
|
+
# * +/http/status_code+
|
113
|
+
# * +/http/url+
|
114
|
+
# * +/http/user_agent+
|
115
|
+
# * +/pid+
|
116
|
+
# * +/stacktrace+
|
117
|
+
# * +/tid+
|
74
118
|
class TraceSpan
|
75
119
|
# Type of span. Can be used to specify additional relationships between spans
|
76
120
|
# in addition to a parent/child relationship.
|
@@ -108,25 +152,54 @@ module Google
|
|
108
152
|
# value of the +next_page_token+ field from a previous request. Optional.
|
109
153
|
# @!attribute [rw] start_time
|
110
154
|
# @return [Google::Protobuf::Timestamp]
|
111
|
-
#
|
155
|
+
# Start of the time interval (inclusive) during which the trace data was
|
112
156
|
# collected from the application.
|
113
157
|
# @!attribute [rw] end_time
|
114
158
|
# @return [Google::Protobuf::Timestamp]
|
115
|
-
#
|
159
|
+
# End of the time interval (inclusive) during which the trace data was
|
116
160
|
# collected from the application.
|
117
161
|
# @!attribute [rw] filter
|
118
162
|
# @return [String]
|
119
|
-
# An optional filter for the request.
|
163
|
+
# An optional filter against labels for the request.
|
164
|
+
#
|
165
|
+
# By default, searches use prefix matching. To specify exact match, prepend
|
166
|
+
# a plus symbol (+++) to the search term.
|
167
|
+
# Multiple terms are ANDed. Syntax:
|
168
|
+
#
|
169
|
+
# * +root:NAME_PREFIX+ or +NAME_PREFIX+: Return traces where any root
|
170
|
+
# span starts with +NAME_PREFIX+.
|
171
|
+
# * ++root:NAME+ or ++NAME+: Return traces where any root span's name is
|
172
|
+
# exactly +NAME+.
|
173
|
+
# * +span:NAME_PREFIX+: Return traces where any span starts with
|
174
|
+
# +NAME_PREFIX+.
|
175
|
+
# * ++span:NAME+: Return traces where any span's name is exactly
|
176
|
+
# +NAME+.
|
177
|
+
# * +latency:DURATION+: Return traces whose overall latency is
|
178
|
+
# greater or equal to than +DURATION+. Accepted units are nanoseconds
|
179
|
+
# (+ns+), milliseconds (+ms+), and seconds (+s+). Default is +ms+. For
|
180
|
+
# example, +latency:24ms+ returns traces whose overall latency
|
181
|
+
# is greater than or equal to 24 milliseconds.
|
182
|
+
# * +label:LABEL_KEY+: Return all traces containing the specified
|
183
|
+
# label key (exact match, case-sensitive) regardless of the key:value
|
184
|
+
# pair's value (including empty values).
|
185
|
+
# * +LABEL_KEY:VALUE_PREFIX+: Return all traces containing the specified
|
186
|
+
# label key (exact match, case-sensitive) whose value starts with
|
187
|
+
# +VALUE_PREFIX+. Both a key and a value must be specified.
|
188
|
+
# * ++LABEL_KEY:VALUE+: Return all traces containing a key:value pair
|
189
|
+
# exactly matching the specified text. Both a key and a value must be
|
190
|
+
# specified.
|
191
|
+
# * +method:VALUE+: Equivalent to +/http/method:VALUE+.
|
192
|
+
# * +url:VALUE+: Equivalent to +/http/url:VALUE+.
|
120
193
|
# @!attribute [rw] order_by
|
121
194
|
# @return [String]
|
122
195
|
# Field used to sort the returned traces. Optional.
|
123
196
|
# Can be one of the following:
|
124
197
|
#
|
125
|
-
# *
|
126
|
-
# *
|
127
|
-
# *
|
128
|
-
#
|
129
|
-
# *
|
198
|
+
# * +trace_id+
|
199
|
+
# * +name+ (+name+ field of root span in the trace)
|
200
|
+
# * +duration+ (difference between +end_time+ and +start_time+ fields of
|
201
|
+
# the root span)
|
202
|
+
# * +start+ (+start_time+ field of the root span)
|
130
203
|
#
|
131
204
|
# Descending order can be specified by appending +desc+ to the sort field
|
132
205
|
# (for example, +name desc+).
|
@@ -24,7 +24,9 @@ module Google
|
|
24
24
|
# 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
25
25
|
# By restricting to that range, we ensure that we can convert to
|
26
26
|
# and from RFC 3339 date strings.
|
27
|
-
# See
|
27
|
+
# See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
|
28
|
+
#
|
29
|
+
# = Examples
|
28
30
|
#
|
29
31
|
# Example 1: Compute Timestamp from POSIX +time()+.
|
30
32
|
#
|
@@ -65,6 +67,29 @@ module Google
|
|
65
67
|
#
|
66
68
|
# timestamp = Timestamp()
|
67
69
|
# timestamp.GetCurrentTime()
|
70
|
+
#
|
71
|
+
# = JSON Mapping
|
72
|
+
#
|
73
|
+
# In JSON format, the Timestamp type is encoded as a string in the
|
74
|
+
# [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
75
|
+
# format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
76
|
+
# where {year} is always expressed using four digits while {month}, {day},
|
77
|
+
# {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
78
|
+
# seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
79
|
+
# are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
80
|
+
# is required, though only UTC (as indicated by "Z") is presently supported.
|
81
|
+
#
|
82
|
+
# For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
83
|
+
# 01:30 UTC on January 15, 2017.
|
84
|
+
#
|
85
|
+
# In JavaScript, one can convert a Date object to this format using the
|
86
|
+
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
|
87
|
+
# method. In Python, a standard +datetime.datetime+ object can be converted
|
88
|
+
# to this format using [+strftime+](https://docs.python.org/2/library/time.html#time.strftime)
|
89
|
+
# with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
90
|
+
# can use the Joda Time's [+ISODateTimeFormat.dateTime()+](
|
91
|
+
# http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime())
|
92
|
+
# to obtain a formatter capable of generating timestamps in this format.
|
68
93
|
# @!attribute [rw] seconds
|
69
94
|
# @return [Integer]
|
70
95
|
# Represents seconds of UTC time since Unix epoch
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module Google
|
16
|
+
module Cloud
|
17
|
+
# rubocop:disable LineLength
|
18
|
+
|
19
|
+
##
|
20
|
+
# # Ruby Client for Stackdriver Trace API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
21
|
+
#
|
22
|
+
# [Stackdriver Trace API][Product Documentation]:
|
23
|
+
# Send and retrieve trace data from Stackdriver Trace. Data is generated and
|
24
|
+
# available by default for all App Engine applications. Data from other
|
25
|
+
# applications can be written to Stackdriver Trace for display, reporting, and
|
26
|
+
# analysis.
|
27
|
+
# - [Product Documentation][]
|
28
|
+
#
|
29
|
+
# ## Quick Start
|
30
|
+
# In order to use this library, you first need to go through the following
|
31
|
+
# steps:
|
32
|
+
#
|
33
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
|
+
# 2. [Enable the Stackdriver Trace API.](https://console.cloud.google.com/apis/api/cloudtrace)
|
35
|
+
# 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
36
|
+
#
|
37
|
+
# ### Installation
|
38
|
+
# ```
|
39
|
+
# $ gem install google-cloud-trace
|
40
|
+
# ```
|
41
|
+
#
|
42
|
+
# ### Next Steps
|
43
|
+
# - Read the [Stackdriver Trace API Product documentation][Product Documentation]
|
44
|
+
# to learn more about the product and see How-to Guides.
|
45
|
+
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
46
|
+
# to see the full list of Cloud APIs that we cover.
|
47
|
+
#
|
48
|
+
# [Product Documentation]: https://cloud.google.com/cloudtrace
|
49
|
+
#
|
50
|
+
#
|
51
|
+
module Trace
|
52
|
+
module V1
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -28,6 +28,7 @@ require "pathname"
|
|
28
28
|
require "google/gax"
|
29
29
|
|
30
30
|
require "google/devtools/cloudtrace/v1/trace_pb"
|
31
|
+
require "google/cloud/trace/credentials"
|
31
32
|
|
32
33
|
module Google
|
33
34
|
module Cloud
|
@@ -69,15 +70,24 @@ module Google
|
|
69
70
|
"https://www.googleapis.com/auth/trace.readonly"
|
70
71
|
].freeze
|
71
72
|
|
72
|
-
# @param
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
# A
|
78
|
-
#
|
79
|
-
# A
|
80
|
-
#
|
73
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
74
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
75
|
+
# be many types.
|
76
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
77
|
+
# authenticating requests made by this client.
|
78
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
79
|
+
# credentials for this client.
|
80
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
81
|
+
# credentials for this client.
|
82
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
83
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
84
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
85
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
86
|
+
# metadata for requests, generally, to give OAuth credentials.
|
87
|
+
# @param scopes [Array<String>]
|
88
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
89
|
+
# an updater_proc is supplied.
|
90
|
+
# @param client_config [Hash]
|
81
91
|
# A Hash for call options for each method. See
|
82
92
|
# Google::Gax#construct_settings for the structure of
|
83
93
|
# this data. Falls back to the default config if not specified
|
@@ -89,11 +99,11 @@ module Google
|
|
89
99
|
port: DEFAULT_SERVICE_PORT,
|
90
100
|
channel: nil,
|
91
101
|
chan_creds: nil,
|
102
|
+
updater_proc: nil,
|
103
|
+
credentials: nil,
|
92
104
|
scopes: ALL_SCOPES,
|
93
105
|
client_config: {},
|
94
106
|
timeout: DEFAULT_TIMEOUT,
|
95
|
-
app_name: nil,
|
96
|
-
app_version: nil,
|
97
107
|
lib_name: nil,
|
98
108
|
lib_version: ""
|
99
109
|
# These require statements are intentionally placed here to initialize
|
@@ -102,14 +112,38 @@ module Google
|
|
102
112
|
require "google/gax/grpc"
|
103
113
|
require "google/devtools/cloudtrace/v1/trace_services_pb"
|
104
114
|
|
115
|
+
if channel || chan_creds || updater_proc
|
116
|
+
warn "The `channel`, `chan_creds`, and `updater_proc` parameters will be removed " \
|
117
|
+
"on 2017/09/08"
|
118
|
+
credentials ||= channel
|
119
|
+
credentials ||= chan_creds
|
120
|
+
credentials ||= updater_proc
|
121
|
+
end
|
122
|
+
if service_path != SERVICE_ADDRESS || port != DEFAULT_SERVICE_PORT
|
123
|
+
warn "`service_path` and `port` parameters are deprecated and will be removed"
|
124
|
+
end
|
125
|
+
|
126
|
+
credentials ||= Google::Cloud::Trace::Credentials.default
|
105
127
|
|
106
|
-
if
|
107
|
-
|
128
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
129
|
+
updater_proc = Google::Cloud::Trace::Credentials.new(credentials).updater_proc
|
130
|
+
end
|
131
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
132
|
+
channel = credentials
|
133
|
+
end
|
134
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
135
|
+
chan_creds = credentials
|
136
|
+
end
|
137
|
+
if credentials.is_a?(Proc)
|
138
|
+
updater_proc = credentials
|
139
|
+
end
|
140
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
141
|
+
updater_proc = credentials.updater_proc
|
108
142
|
end
|
109
143
|
|
110
144
|
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
111
145
|
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
112
|
-
google_api_client << " gapic/0.
|
146
|
+
google_api_client << " gapic/0.1.0 gax/#{Google::Gax::VERSION}"
|
113
147
|
google_api_client << " grpc/#{GRPC::VERSION}"
|
114
148
|
google_api_client.freeze
|
115
149
|
|
@@ -134,95 +168,27 @@ module Google
|
|
134
168
|
port,
|
135
169
|
chan_creds: chan_creds,
|
136
170
|
channel: channel,
|
171
|
+
updater_proc: updater_proc,
|
137
172
|
scopes: scopes,
|
138
173
|
&Google::Devtools::Cloudtrace::V1::TraceService::Stub.method(:new)
|
139
174
|
)
|
140
175
|
|
141
|
-
@
|
142
|
-
@trace_service_stub.method(:
|
143
|
-
defaults["
|
176
|
+
@list_traces = Google::Gax.create_api_call(
|
177
|
+
@trace_service_stub.method(:list_traces),
|
178
|
+
defaults["list_traces"]
|
144
179
|
)
|
145
180
|
@get_trace = Google::Gax.create_api_call(
|
146
181
|
@trace_service_stub.method(:get_trace),
|
147
182
|
defaults["get_trace"]
|
148
183
|
)
|
149
|
-
@
|
150
|
-
@trace_service_stub.method(:
|
151
|
-
defaults["
|
184
|
+
@patch_traces = Google::Gax.create_api_call(
|
185
|
+
@trace_service_stub.method(:patch_traces),
|
186
|
+
defaults["patch_traces"]
|
152
187
|
)
|
153
188
|
end
|
154
189
|
|
155
190
|
# Service calls
|
156
191
|
|
157
|
-
# Sends new traces to Stackdriver Trace or updates existing traces. If the ID
|
158
|
-
# of a trace that you send matches that of an existing trace, any fields
|
159
|
-
# in the existing trace and its spans are overwritten by the provided values,
|
160
|
-
# and any new fields provided are merged with the existing trace data. If the
|
161
|
-
# ID does not match, a new trace is created.
|
162
|
-
#
|
163
|
-
# @param project_id [String]
|
164
|
-
# ID of the Cloud project where the trace data is stored.
|
165
|
-
# @param traces [Google::Devtools::Cloudtrace::V1::Traces]
|
166
|
-
# The body of the message.
|
167
|
-
# @param options [Google::Gax::CallOptions]
|
168
|
-
# Overrides the default settings for this call, e.g, timeout,
|
169
|
-
# retries, etc.
|
170
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
171
|
-
# @example
|
172
|
-
# require "google/cloud/trace/v1/trace_service_client"
|
173
|
-
#
|
174
|
-
# TraceServiceClient = Google::Cloud::Trace::V1::TraceServiceClient
|
175
|
-
# Traces = Google::Devtools::Cloudtrace::V1::Traces
|
176
|
-
#
|
177
|
-
# trace_service_client = TraceServiceClient.new
|
178
|
-
# project_id = ''
|
179
|
-
# traces = Traces.new
|
180
|
-
# trace_service_client.patch_traces(project_id, traces)
|
181
|
-
|
182
|
-
def patch_traces \
|
183
|
-
project_id,
|
184
|
-
traces,
|
185
|
-
options: nil
|
186
|
-
req = Google::Devtools::Cloudtrace::V1::PatchTracesRequest.new({
|
187
|
-
project_id: project_id,
|
188
|
-
traces: traces
|
189
|
-
}.delete_if { |_, v| v.nil? })
|
190
|
-
@patch_traces.call(req, options)
|
191
|
-
nil
|
192
|
-
end
|
193
|
-
|
194
|
-
# Gets a single trace by its ID.
|
195
|
-
#
|
196
|
-
# @param project_id [String]
|
197
|
-
# ID of the Cloud project where the trace data is stored.
|
198
|
-
# @param trace_id [String]
|
199
|
-
# ID of the trace to return.
|
200
|
-
# @param options [Google::Gax::CallOptions]
|
201
|
-
# Overrides the default settings for this call, e.g, timeout,
|
202
|
-
# retries, etc.
|
203
|
-
# @return [Google::Devtools::Cloudtrace::V1::Trace]
|
204
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
205
|
-
# @example
|
206
|
-
# require "google/cloud/trace/v1/trace_service_client"
|
207
|
-
#
|
208
|
-
# TraceServiceClient = Google::Cloud::Trace::V1::TraceServiceClient
|
209
|
-
#
|
210
|
-
# trace_service_client = TraceServiceClient.new
|
211
|
-
# project_id = ''
|
212
|
-
# trace_id = ''
|
213
|
-
# response = trace_service_client.get_trace(project_id, trace_id)
|
214
|
-
|
215
|
-
def get_trace \
|
216
|
-
project_id,
|
217
|
-
trace_id,
|
218
|
-
options: nil
|
219
|
-
req = Google::Devtools::Cloudtrace::V1::GetTraceRequest.new({
|
220
|
-
project_id: project_id,
|
221
|
-
trace_id: trace_id
|
222
|
-
}.delete_if { |_, v| v.nil? })
|
223
|
-
@get_trace.call(req, options)
|
224
|
-
end
|
225
|
-
|
226
192
|
# Returns of a list of traces that match the specified filter conditions.
|
227
193
|
#
|
228
194
|
# @param project_id [String]
|
@@ -231,26 +197,61 @@ module Google
|
|
231
197
|
# Type of data returned for traces in the list. Optional. Default is
|
232
198
|
# +MINIMAL+.
|
233
199
|
# @param page_size [Integer]
|
234
|
-
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
240
|
-
# @param end_time [Google::Protobuf::Timestamp]
|
200
|
+
# The maximum number of resources contained in the underlying API
|
201
|
+
# response. If page streaming is performed per-resource, this
|
202
|
+
# parameter does not affect the return value. If page streaming is
|
203
|
+
# performed per-page, this determines the maximum number of
|
204
|
+
# resources in a page.
|
205
|
+
# @param start_time [Google::Protobuf::Timestamp | Hash]
|
241
206
|
# Start of the time interval (inclusive) during which the trace data was
|
242
207
|
# collected from the application.
|
208
|
+
# A hash of the same form as `Google::Protobuf::Timestamp`
|
209
|
+
# can also be provided.
|
210
|
+
# @param end_time [Google::Protobuf::Timestamp | Hash]
|
211
|
+
# End of the time interval (inclusive) during which the trace data was
|
212
|
+
# collected from the application.
|
213
|
+
# A hash of the same form as `Google::Protobuf::Timestamp`
|
214
|
+
# can also be provided.
|
243
215
|
# @param filter [String]
|
244
|
-
# An optional filter for the request.
|
216
|
+
# An optional filter against labels for the request.
|
217
|
+
#
|
218
|
+
# By default, searches use prefix matching. To specify exact match, prepend
|
219
|
+
# a plus symbol (+++) to the search term.
|
220
|
+
# Multiple terms are ANDed. Syntax:
|
221
|
+
#
|
222
|
+
# * +root:NAME_PREFIX+ or +NAME_PREFIX+: Return traces where any root
|
223
|
+
# span starts with +NAME_PREFIX+.
|
224
|
+
# * ++root:NAME+ or ++NAME+: Return traces where any root span's name is
|
225
|
+
# exactly +NAME+.
|
226
|
+
# * +span:NAME_PREFIX+: Return traces where any span starts with
|
227
|
+
# +NAME_PREFIX+.
|
228
|
+
# * ++span:NAME+: Return traces where any span's name is exactly
|
229
|
+
# +NAME+.
|
230
|
+
# * +latency:DURATION+: Return traces whose overall latency is
|
231
|
+
# greater or equal to than +DURATION+. Accepted units are nanoseconds
|
232
|
+
# (+ns+), milliseconds (+ms+), and seconds (+s+). Default is +ms+. For
|
233
|
+
# example, +latency:24ms+ returns traces whose overall latency
|
234
|
+
# is greater than or equal to 24 milliseconds.
|
235
|
+
# * +label:LABEL_KEY+: Return all traces containing the specified
|
236
|
+
# label key (exact match, case-sensitive) regardless of the key:value
|
237
|
+
# pair's value (including empty values).
|
238
|
+
# * +LABEL_KEY:VALUE_PREFIX+: Return all traces containing the specified
|
239
|
+
# label key (exact match, case-sensitive) whose value starts with
|
240
|
+
# +VALUE_PREFIX+. Both a key and a value must be specified.
|
241
|
+
# * ++LABEL_KEY:VALUE+: Return all traces containing a key:value pair
|
242
|
+
# exactly matching the specified text. Both a key and a value must be
|
243
|
+
# specified.
|
244
|
+
# * +method:VALUE+: Equivalent to +/http/method:VALUE+.
|
245
|
+
# * +url:VALUE+: Equivalent to +/http/url:VALUE+.
|
245
246
|
# @param order_by [String]
|
246
247
|
# Field used to sort the returned traces. Optional.
|
247
248
|
# Can be one of the following:
|
248
249
|
#
|
249
|
-
# *
|
250
|
-
# *
|
251
|
-
# *
|
252
|
-
#
|
253
|
-
# *
|
250
|
+
# * +trace_id+
|
251
|
+
# * +name+ (+name+ field of root span in the trace)
|
252
|
+
# * +duration+ (difference between +end_time+ and +start_time+ fields of
|
253
|
+
# the root span)
|
254
|
+
# * +start+ (+start_time+ field of the root span)
|
254
255
|
#
|
255
256
|
# Descending order can be specified by appending +desc+ to the sort field
|
256
257
|
# (for example, +name desc+).
|
@@ -266,11 +267,9 @@ module Google
|
|
266
267
|
# object.
|
267
268
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
268
269
|
# @example
|
269
|
-
# require "google/cloud/trace/v1
|
270
|
+
# require "google/cloud/trace/v1"
|
270
271
|
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
# trace_service_client = TraceServiceClient.new
|
272
|
+
# trace_service_client = Google::Cloud::Trace::V1.new
|
274
273
|
# project_id = ''
|
275
274
|
#
|
276
275
|
# # Iterate over all results.
|
@@ -295,7 +294,7 @@ module Google
|
|
295
294
|
filter: nil,
|
296
295
|
order_by: nil,
|
297
296
|
options: nil
|
298
|
-
req =
|
297
|
+
req = {
|
299
298
|
project_id: project_id,
|
300
299
|
view: view,
|
301
300
|
page_size: page_size,
|
@@ -303,9 +302,78 @@ module Google
|
|
303
302
|
end_time: end_time,
|
304
303
|
filter: filter,
|
305
304
|
order_by: order_by
|
306
|
-
}.delete_if { |_, v| v.nil? }
|
305
|
+
}.delete_if { |_, v| v.nil? }
|
306
|
+
req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::ListTracesRequest)
|
307
307
|
@list_traces.call(req, options)
|
308
308
|
end
|
309
|
+
|
310
|
+
# Gets a single trace by its ID.
|
311
|
+
#
|
312
|
+
# @param project_id [String]
|
313
|
+
# ID of the Cloud project where the trace data is stored.
|
314
|
+
# @param trace_id [String]
|
315
|
+
# ID of the trace to return.
|
316
|
+
# @param options [Google::Gax::CallOptions]
|
317
|
+
# Overrides the default settings for this call, e.g, timeout,
|
318
|
+
# retries, etc.
|
319
|
+
# @return [Google::Devtools::Cloudtrace::V1::Trace]
|
320
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
321
|
+
# @example
|
322
|
+
# require "google/cloud/trace/v1"
|
323
|
+
#
|
324
|
+
# trace_service_client = Google::Cloud::Trace::V1.new
|
325
|
+
# project_id = ''
|
326
|
+
# trace_id = ''
|
327
|
+
# response = trace_service_client.get_trace(project_id, trace_id)
|
328
|
+
|
329
|
+
def get_trace \
|
330
|
+
project_id,
|
331
|
+
trace_id,
|
332
|
+
options: nil
|
333
|
+
req = {
|
334
|
+
project_id: project_id,
|
335
|
+
trace_id: trace_id
|
336
|
+
}.delete_if { |_, v| v.nil? }
|
337
|
+
req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::GetTraceRequest)
|
338
|
+
@get_trace.call(req, options)
|
339
|
+
end
|
340
|
+
|
341
|
+
# Sends new traces to Stackdriver Trace or updates existing traces. If the ID
|
342
|
+
# of a trace that you send matches that of an existing trace, any fields
|
343
|
+
# in the existing trace and its spans are overwritten by the provided values,
|
344
|
+
# and any new fields provided are merged with the existing trace data. If the
|
345
|
+
# ID does not match, a new trace is created.
|
346
|
+
#
|
347
|
+
# @param project_id [String]
|
348
|
+
# ID of the Cloud project where the trace data is stored.
|
349
|
+
# @param traces [Google::Devtools::Cloudtrace::V1::Traces | Hash]
|
350
|
+
# The body of the message.
|
351
|
+
# A hash of the same form as `Google::Devtools::Cloudtrace::V1::Traces`
|
352
|
+
# can also be provided.
|
353
|
+
# @param options [Google::Gax::CallOptions]
|
354
|
+
# Overrides the default settings for this call, e.g, timeout,
|
355
|
+
# retries, etc.
|
356
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
357
|
+
# @example
|
358
|
+
# require "google/cloud/trace/v1"
|
359
|
+
#
|
360
|
+
# trace_service_client = Google::Cloud::Trace::V1.new
|
361
|
+
# project_id = ''
|
362
|
+
# traces = {}
|
363
|
+
# trace_service_client.patch_traces(project_id, traces)
|
364
|
+
|
365
|
+
def patch_traces \
|
366
|
+
project_id,
|
367
|
+
traces,
|
368
|
+
options: nil
|
369
|
+
req = {
|
370
|
+
project_id: project_id,
|
371
|
+
traces: traces
|
372
|
+
}.delete_if { |_, v| v.nil? }
|
373
|
+
req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::PatchTracesRequest)
|
374
|
+
@patch_traces.call(req, options)
|
375
|
+
nil
|
376
|
+
end
|
309
377
|
end
|
310
378
|
end
|
311
379
|
end
|
@@ -17,23 +17,32 @@
|
|
17
17
|
"rpc_timeout_multiplier": 1.5,
|
18
18
|
"max_rpc_timeout_millis": 30000,
|
19
19
|
"total_timeout_millis": 45000
|
20
|
+
},
|
21
|
+
"write_sink": {
|
22
|
+
"initial_retry_delay_millis": 100,
|
23
|
+
"retry_delay_multiplier": 1.2,
|
24
|
+
"max_retry_delay_millis": 1000,
|
25
|
+
"initial_rpc_timeout_millis": 30000,
|
26
|
+
"rpc_timeout_multiplier": 1.5,
|
27
|
+
"max_rpc_timeout_millis": 60000,
|
28
|
+
"total_timeout_millis": 120000
|
20
29
|
}
|
21
30
|
},
|
22
31
|
"methods": {
|
23
|
-
"
|
24
|
-
"timeout_millis":
|
32
|
+
"ListTraces": {
|
33
|
+
"timeout_millis": 60000,
|
25
34
|
"retry_codes_name": "idempotent",
|
26
35
|
"retry_params_name": "default"
|
27
36
|
},
|
28
37
|
"GetTrace": {
|
29
|
-
"timeout_millis":
|
38
|
+
"timeout_millis": 60000,
|
30
39
|
"retry_codes_name": "idempotent",
|
31
40
|
"retry_params_name": "default"
|
32
41
|
},
|
33
|
-
"
|
42
|
+
"PatchTraces": {
|
34
43
|
"timeout_millis": 30000,
|
35
|
-
"retry_codes_name": "
|
36
|
-
"retry_params_name": "
|
44
|
+
"retry_codes_name": "non_idempotent",
|
45
|
+
"retry_params_name": "write_sink"
|
37
46
|
}
|
38
47
|
}
|
39
48
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: google/devtools/cloudtrace/v1/trace.proto for package 'google.devtools.cloudtrace.v1'
|
3
3
|
# Original file comments:
|
4
|
-
# Copyright
|
4
|
+
# Copyright 2017 Google Inc.
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-trace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: stackdriver-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.10.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.10.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,6 +252,7 @@ files:
|
|
252
252
|
- lib/google/cloud/trace/v1.rb
|
253
253
|
- lib/google/cloud/trace/v1/doc/google/devtools/cloudtrace/v1/trace.rb
|
254
254
|
- lib/google/cloud/trace/v1/doc/google/protobuf/timestamp.rb
|
255
|
+
- lib/google/cloud/trace/v1/doc/overview.rb
|
255
256
|
- lib/google/cloud/trace/v1/trace_service_client.rb
|
256
257
|
- lib/google/cloud/trace/v1/trace_service_client_config.json
|
257
258
|
- lib/google/cloud/trace/version.rb
|
@@ -277,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
278
|
version: '0'
|
278
279
|
requirements: []
|
279
280
|
rubyforge_project:
|
280
|
-
rubygems_version: 2.
|
281
|
+
rubygems_version: 2.7.2
|
281
282
|
signing_key:
|
282
283
|
specification_version: 4
|
283
284
|
summary: Application Instrumentation and API Client library for Stackdriver Trace
|