google-cloud-trace 0.39.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/CHANGELOG.md +24 -0
- data/lib/google-cloud-trace.rb +20 -12
- data/lib/google/cloud/trace.rb +18 -14
- data/lib/google/cloud/trace/credentials.rb +2 -2
- data/lib/google/cloud/trace/result_set.rb +20 -12
- data/lib/google/cloud/trace/service.rb +34 -60
- data/lib/google/cloud/trace/span.rb +3 -3
- data/lib/google/cloud/trace/trace_record.rb +3 -3
- data/lib/google/cloud/trace/version.rb +1 -1
- metadata +15 -64
- data/lib/google/cloud/trace/v1.rb +0 -16
- data/lib/google/cloud/trace/v1/credentials.rb +0 -39
- data/lib/google/cloud/trace/v1/doc/google/devtools/cloudtrace/v1/trace.rb +0 -253
- data/lib/google/cloud/trace/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/trace/v1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/trace/v1/trace_service_client.rb +0 -425
- data/lib/google/cloud/trace/v1/trace_service_client_config.json +0 -41
- data/lib/google/cloud/trace/v2.rb +0 -123
- data/lib/google/cloud/trace/v2/credentials.rb +0 -39
- data/lib/google/cloud/trace/v2/doc/google/devtools/cloudtrace/v2/trace.rb +0 -356
- data/lib/google/cloud/trace/v2/doc/google/devtools/cloudtrace/v2/tracing.rb +0 -33
- data/lib/google/cloud/trace/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/trace/v2/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/trace/v2/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/trace/v2/doc/google/protobuf/wrappers.rb +0 -34
- data/lib/google/cloud/trace/v2/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/trace/v2/trace_service_client.rb +0 -418
- data/lib/google/cloud/trace/v2/trace_service_client_config.json +0 -36
- data/lib/google/devtools/cloudtrace/v1/trace_pb.rb +0 -82
- data/lib/google/devtools/cloudtrace/v1/trace_services_pb.rb +0 -58
- data/lib/google/devtools/cloudtrace/v2/trace_pb.rb +0 -142
- data/lib/google/devtools/cloudtrace/v2/tracing_pb.rb +0 -29
- data/lib/google/devtools/cloudtrace/v2/tracing_services_pb.rb +0 -53
@@ -1,29 +0,0 @@
|
|
1
|
-
# Copyright 2020 Google LLC
|
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
|
-
# https://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
|
-
|
16
|
-
module Google
|
17
|
-
module Protobuf
|
18
|
-
# A generic empty message that you can re-use to avoid defining duplicated
|
19
|
-
# empty messages in your APIs. A typical example is to use it as the request
|
20
|
-
# or the response type of an API method. For instance:
|
21
|
-
#
|
22
|
-
# service Foo {
|
23
|
-
# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
24
|
-
# }
|
25
|
-
#
|
26
|
-
# The JSON representation for `Empty` is empty JSON object `{}`.
|
27
|
-
class Empty; end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
# Copyright 2020 Google LLC
|
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
|
-
# https://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
|
-
|
16
|
-
module Google
|
17
|
-
module Protobuf
|
18
|
-
# A Timestamp represents a point in time independent of any time zone or local
|
19
|
-
# calendar, encoded as a count of seconds and fractions of seconds at
|
20
|
-
# nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
21
|
-
# January 1, 1970, in the proleptic Gregorian calendar which extends the
|
22
|
-
# Gregorian calendar backwards to year one.
|
23
|
-
#
|
24
|
-
# All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
25
|
-
# second table is needed for interpretation, using a [24-hour linear
|
26
|
-
# smear](https://developers.google.com/time/smear).
|
27
|
-
#
|
28
|
-
# The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
29
|
-
# restricting to that range, we ensure that we can convert to and from [RFC
|
30
|
-
# 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
31
|
-
#
|
32
|
-
# = Examples
|
33
|
-
#
|
34
|
-
# Example 1: Compute Timestamp from POSIX `time()`.
|
35
|
-
#
|
36
|
-
# Timestamp timestamp;
|
37
|
-
# timestamp.set_seconds(time(NULL));
|
38
|
-
# timestamp.set_nanos(0);
|
39
|
-
#
|
40
|
-
# Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
41
|
-
#
|
42
|
-
# struct timeval tv;
|
43
|
-
# gettimeofday(&tv, NULL);
|
44
|
-
#
|
45
|
-
# Timestamp timestamp;
|
46
|
-
# timestamp.set_seconds(tv.tv_sec);
|
47
|
-
# timestamp.set_nanos(tv.tv_usec * 1000);
|
48
|
-
#
|
49
|
-
# Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
50
|
-
#
|
51
|
-
# FILETIME ft;
|
52
|
-
# GetSystemTimeAsFileTime(&ft);
|
53
|
-
# UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
54
|
-
#
|
55
|
-
# // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
56
|
-
# // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
57
|
-
# Timestamp timestamp;
|
58
|
-
# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
59
|
-
# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
60
|
-
#
|
61
|
-
# Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
62
|
-
#
|
63
|
-
# long millis = System.currentTimeMillis();
|
64
|
-
#
|
65
|
-
# Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
66
|
-
# .setNanos((int) ((millis % 1000) * 1000000)).build();
|
67
|
-
#
|
68
|
-
#
|
69
|
-
# Example 5: Compute Timestamp from current time in Python.
|
70
|
-
#
|
71
|
-
# timestamp = Timestamp()
|
72
|
-
# timestamp.GetCurrentTime()
|
73
|
-
#
|
74
|
-
# = JSON Mapping
|
75
|
-
#
|
76
|
-
# In JSON format, the Timestamp type is encoded as a string in the
|
77
|
-
# [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
78
|
-
# format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
|
79
|
-
# where \\{year} is always expressed using four digits while \\{month}, \\{day},
|
80
|
-
# \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
|
81
|
-
# seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
82
|
-
# are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
83
|
-
# is required. A proto3 JSON serializer should always use UTC (as indicated by
|
84
|
-
# "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
85
|
-
# able to accept both UTC and other timezones (as indicated by an offset).
|
86
|
-
#
|
87
|
-
# For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
88
|
-
# 01:30 UTC on January 15, 2017.
|
89
|
-
#
|
90
|
-
# In JavaScript, one can convert a Date object to this format using the
|
91
|
-
# standard
|
92
|
-
# [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
93
|
-
# method. In Python, a standard `datetime.datetime` object can be converted
|
94
|
-
# to this format using
|
95
|
-
# [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
96
|
-
# the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
97
|
-
# the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
98
|
-
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
99
|
-
# ) to obtain a formatter capable of generating timestamps in this format.
|
100
|
-
# @!attribute [rw] seconds
|
101
|
-
# @return [Integer]
|
102
|
-
# Represents seconds of UTC time since Unix epoch
|
103
|
-
# 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
104
|
-
# 9999-12-31T23:59:59Z inclusive.
|
105
|
-
# @!attribute [rw] nanos
|
106
|
-
# @return [Integer]
|
107
|
-
# Non-negative fractions of a second at nanosecond resolution. Negative
|
108
|
-
# second values with fractions must still have non-negative nanos values
|
109
|
-
# that count forward in time. Must be from 0 to 999,999,999
|
110
|
-
# inclusive.
|
111
|
-
class Timestamp; end
|
112
|
-
end
|
113
|
-
end
|
@@ -1,425 +0,0 @@
|
|
1
|
-
# Copyright 2020 Google LLC
|
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
|
-
# https://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
|
-
# EDITING INSTRUCTIONS
|
16
|
-
# This file was generated from the file
|
17
|
-
# https://github.com/googleapis/googleapis/blob/master/google/devtools/cloudtrace/v1/trace.proto,
|
18
|
-
# and updates to that file get reflected here through a refresh process.
|
19
|
-
# For the short term, the refresh process will only be runnable by Google
|
20
|
-
# engineers.
|
21
|
-
|
22
|
-
|
23
|
-
require "json"
|
24
|
-
require "pathname"
|
25
|
-
|
26
|
-
require "google/gax"
|
27
|
-
|
28
|
-
require "google/devtools/cloudtrace/v1/trace_pb"
|
29
|
-
require "google/cloud/trace/v1/credentials"
|
30
|
-
require "google/cloud/trace/version"
|
31
|
-
|
32
|
-
module Google
|
33
|
-
module Cloud
|
34
|
-
module Trace
|
35
|
-
module V1
|
36
|
-
# This file describes an API for collecting and viewing traces and spans
|
37
|
-
# within a trace. A Trace is a collection of spans corresponding to a single
|
38
|
-
# operation or set of operations for an application. A span is an individual
|
39
|
-
# timed event which forms a node of the trace tree. Spans for a single trace
|
40
|
-
# may span multiple services.
|
41
|
-
#
|
42
|
-
# @!attribute [r] trace_service_stub
|
43
|
-
# @return [Google::Devtools::Cloudtrace::V1::TraceService::Stub]
|
44
|
-
class TraceServiceClient
|
45
|
-
# @private
|
46
|
-
attr_reader :trace_service_stub
|
47
|
-
|
48
|
-
# The default address of the service.
|
49
|
-
SERVICE_ADDRESS = "cloudtrace.googleapis.com".freeze
|
50
|
-
|
51
|
-
# The default port of the service.
|
52
|
-
DEFAULT_SERVICE_PORT = 443
|
53
|
-
|
54
|
-
# The default set of gRPC interceptors.
|
55
|
-
GRPC_INTERCEPTORS = []
|
56
|
-
|
57
|
-
DEFAULT_TIMEOUT = 30
|
58
|
-
|
59
|
-
PAGE_DESCRIPTORS = {
|
60
|
-
"list_traces" => Google::Gax::PageDescriptor.new(
|
61
|
-
"page_token",
|
62
|
-
"next_page_token",
|
63
|
-
"traces")
|
64
|
-
}.freeze
|
65
|
-
|
66
|
-
private_constant :PAGE_DESCRIPTORS
|
67
|
-
|
68
|
-
# The scopes needed to make gRPC calls to all of the methods defined in
|
69
|
-
# this service.
|
70
|
-
ALL_SCOPES = [
|
71
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
72
|
-
"https://www.googleapis.com/auth/trace.append",
|
73
|
-
"https://www.googleapis.com/auth/trace.readonly"
|
74
|
-
].freeze
|
75
|
-
|
76
|
-
|
77
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
78
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
79
|
-
# be many types.
|
80
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
81
|
-
# authenticating requests made by this client.
|
82
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
83
|
-
# credentials for this client.
|
84
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
85
|
-
# credentials for this client.
|
86
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
87
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
88
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
89
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
90
|
-
# metadata for requests, generally, to give OAuth credentials.
|
91
|
-
# @param scopes [Array<String>]
|
92
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
93
|
-
# an updater_proc is supplied.
|
94
|
-
# @param client_config [Hash]
|
95
|
-
# A Hash for call options for each method. See
|
96
|
-
# Google::Gax#construct_settings for the structure of
|
97
|
-
# this data. Falls back to the default config if not specified
|
98
|
-
# or the specified config is missing data points.
|
99
|
-
# @param timeout [Numeric]
|
100
|
-
# The default timeout, in seconds, for calls made through this client.
|
101
|
-
# @param metadata [Hash]
|
102
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
103
|
-
# @param service_address [String]
|
104
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
105
|
-
# @param service_port [Integer]
|
106
|
-
# Override for the service port, or `nil` to leave as the default.
|
107
|
-
# @param exception_transformer [Proc]
|
108
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
109
|
-
# custom error handling.
|
110
|
-
def initialize \
|
111
|
-
credentials: nil,
|
112
|
-
scopes: ALL_SCOPES,
|
113
|
-
client_config: {},
|
114
|
-
timeout: DEFAULT_TIMEOUT,
|
115
|
-
metadata: nil,
|
116
|
-
service_address: nil,
|
117
|
-
service_port: nil,
|
118
|
-
exception_transformer: nil,
|
119
|
-
lib_name: nil,
|
120
|
-
lib_version: ""
|
121
|
-
# These require statements are intentionally placed here to initialize
|
122
|
-
# the gRPC module only when it's required.
|
123
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
124
|
-
require "google/gax/grpc"
|
125
|
-
require "google/devtools/cloudtrace/v1/trace_services_pb"
|
126
|
-
|
127
|
-
credentials ||= Google::Cloud::Trace::V1::Credentials.default
|
128
|
-
|
129
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
130
|
-
updater_proc = Google::Cloud::Trace::V1::Credentials.new(credentials).updater_proc
|
131
|
-
end
|
132
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
133
|
-
channel = credentials
|
134
|
-
end
|
135
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
136
|
-
chan_creds = credentials
|
137
|
-
end
|
138
|
-
if credentials.is_a?(Proc)
|
139
|
-
updater_proc = credentials
|
140
|
-
end
|
141
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
142
|
-
updater_proc = credentials.updater_proc
|
143
|
-
end
|
144
|
-
|
145
|
-
package_version = Google::Cloud::Trace::VERSION
|
146
|
-
|
147
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
148
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
149
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
150
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
151
|
-
google_api_client.freeze
|
152
|
-
|
153
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
154
|
-
if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
|
155
|
-
headers[:"x-goog-user-project"] = credentials.quota_project_id
|
156
|
-
end
|
157
|
-
headers.merge!(metadata) unless metadata.nil?
|
158
|
-
client_config_file = Pathname.new(__dir__).join(
|
159
|
-
"trace_service_client_config.json"
|
160
|
-
)
|
161
|
-
defaults = client_config_file.open do |f|
|
162
|
-
Google::Gax.construct_settings(
|
163
|
-
"google.devtools.cloudtrace.v1.TraceService",
|
164
|
-
JSON.parse(f.read),
|
165
|
-
client_config,
|
166
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
167
|
-
timeout,
|
168
|
-
page_descriptors: PAGE_DESCRIPTORS,
|
169
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
170
|
-
metadata: headers
|
171
|
-
)
|
172
|
-
end
|
173
|
-
|
174
|
-
# Allow overriding the service path/port in subclasses.
|
175
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
176
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
177
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
178
|
-
@trace_service_stub = Google::Gax::Grpc.create_stub(
|
179
|
-
service_path,
|
180
|
-
port,
|
181
|
-
chan_creds: chan_creds,
|
182
|
-
channel: channel,
|
183
|
-
updater_proc: updater_proc,
|
184
|
-
scopes: scopes,
|
185
|
-
interceptors: interceptors,
|
186
|
-
&Google::Devtools::Cloudtrace::V1::TraceService::Stub.method(:new)
|
187
|
-
)
|
188
|
-
|
189
|
-
@patch_traces = Google::Gax.create_api_call(
|
190
|
-
@trace_service_stub.method(:patch_traces),
|
191
|
-
defaults["patch_traces"],
|
192
|
-
exception_transformer: exception_transformer,
|
193
|
-
params_extractor: proc do |request|
|
194
|
-
{'project_id' => request.project_id}
|
195
|
-
end
|
196
|
-
)
|
197
|
-
@list_traces = Google::Gax.create_api_call(
|
198
|
-
@trace_service_stub.method(:list_traces),
|
199
|
-
defaults["list_traces"],
|
200
|
-
exception_transformer: exception_transformer,
|
201
|
-
params_extractor: proc do |request|
|
202
|
-
{'project_id' => request.project_id}
|
203
|
-
end
|
204
|
-
)
|
205
|
-
@get_trace = Google::Gax.create_api_call(
|
206
|
-
@trace_service_stub.method(:get_trace),
|
207
|
-
defaults["get_trace"],
|
208
|
-
exception_transformer: exception_transformer
|
209
|
-
)
|
210
|
-
end
|
211
|
-
|
212
|
-
# Service calls
|
213
|
-
|
214
|
-
# Sends new traces to Stackdriver Trace or updates existing traces. If the ID
|
215
|
-
# of a trace that you send matches that of an existing trace, any fields
|
216
|
-
# in the existing trace and its spans are overwritten by the provided values,
|
217
|
-
# and any new fields provided are merged with the existing trace data. If the
|
218
|
-
# ID does not match, a new trace is created.
|
219
|
-
#
|
220
|
-
# @param project_id [String]
|
221
|
-
# Required. ID of the Cloud project where the trace data is stored.
|
222
|
-
# @param traces [Google::Devtools::Cloudtrace::V1::Traces | Hash]
|
223
|
-
# Required. The body of the message.
|
224
|
-
# A hash of the same form as `Google::Devtools::Cloudtrace::V1::Traces`
|
225
|
-
# can also be provided.
|
226
|
-
# @param options [Google::Gax::CallOptions]
|
227
|
-
# Overrides the default settings for this call, e.g, timeout,
|
228
|
-
# retries, etc.
|
229
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
230
|
-
# @yieldparam result []
|
231
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
232
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
233
|
-
# @example
|
234
|
-
# require "google/cloud/trace"
|
235
|
-
#
|
236
|
-
# trace_client = Google::Cloud::Trace.new(version: :v1)
|
237
|
-
#
|
238
|
-
# # TODO: Initialize `project_id`:
|
239
|
-
# project_id = ''
|
240
|
-
#
|
241
|
-
# # TODO: Initialize `traces`:
|
242
|
-
# traces = {}
|
243
|
-
# trace_client.patch_traces(project_id, traces)
|
244
|
-
|
245
|
-
def patch_traces \
|
246
|
-
project_id,
|
247
|
-
traces,
|
248
|
-
options: nil,
|
249
|
-
&block
|
250
|
-
req = {
|
251
|
-
project_id: project_id,
|
252
|
-
traces: traces
|
253
|
-
}.delete_if { |_, v| v.nil? }
|
254
|
-
req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::PatchTracesRequest)
|
255
|
-
@patch_traces.call(req, options, &block)
|
256
|
-
nil
|
257
|
-
end
|
258
|
-
|
259
|
-
# Returns of a list of traces that match the specified filter conditions.
|
260
|
-
#
|
261
|
-
# @param project_id [String]
|
262
|
-
# Required. ID of the Cloud project where the trace data is stored.
|
263
|
-
# @param view [Google::Devtools::Cloudtrace::V1::ListTracesRequest::ViewType]
|
264
|
-
# Optional. Type of data returned for traces in the list. Default is
|
265
|
-
# `MINIMAL`.
|
266
|
-
# @param page_size [Integer]
|
267
|
-
# The maximum number of resources contained in the underlying API
|
268
|
-
# response. If page streaming is performed per-resource, this
|
269
|
-
# parameter does not affect the return value. If page streaming is
|
270
|
-
# performed per-page, this determines the maximum number of
|
271
|
-
# resources in a page.
|
272
|
-
# @param start_time [Google::Protobuf::Timestamp | Hash]
|
273
|
-
# Start of the time interval (inclusive) during which the trace data was
|
274
|
-
# collected from the application.
|
275
|
-
# A hash of the same form as `Google::Protobuf::Timestamp`
|
276
|
-
# can also be provided.
|
277
|
-
# @param end_time [Google::Protobuf::Timestamp | Hash]
|
278
|
-
# End of the time interval (inclusive) during which the trace data was
|
279
|
-
# collected from the application.
|
280
|
-
# A hash of the same form as `Google::Protobuf::Timestamp`
|
281
|
-
# can also be provided.
|
282
|
-
# @param filter [String]
|
283
|
-
# Optional. A filter against labels for the request.
|
284
|
-
#
|
285
|
-
# By default, searches use prefix matching. To specify exact match, prepend
|
286
|
-
# a plus symbol (`+`) to the search term.
|
287
|
-
# Multiple terms are ANDed. Syntax:
|
288
|
-
#
|
289
|
-
# * `root:NAME_PREFIX` or `NAME_PREFIX`: Return traces where any root
|
290
|
-
# span starts with `NAME_PREFIX`.
|
291
|
-
# * `+root:NAME` or `+NAME`: Return traces where any root span's name is
|
292
|
-
# exactly `NAME`.
|
293
|
-
# * `span:NAME_PREFIX`: Return traces where any span starts with
|
294
|
-
# `NAME_PREFIX`.
|
295
|
-
# * `+span:NAME`: Return traces where any span's name is exactly
|
296
|
-
# `NAME`.
|
297
|
-
# * `latency:DURATION`: Return traces whose overall latency is
|
298
|
-
# greater or equal to than `DURATION`. Accepted units are nanoseconds
|
299
|
-
# (`ns`), milliseconds (`ms`), and seconds (`s`). Default is `ms`. For
|
300
|
-
# example, `latency:24ms` returns traces whose overall latency
|
301
|
-
# is greater than or equal to 24 milliseconds.
|
302
|
-
# * `label:LABEL_KEY`: Return all traces containing the specified
|
303
|
-
# label key (exact match, case-sensitive) regardless of the key:value
|
304
|
-
# pair's value (including empty values).
|
305
|
-
# * `LABEL_KEY:VALUE_PREFIX`: Return all traces containing the specified
|
306
|
-
# label key (exact match, case-sensitive) whose value starts with
|
307
|
-
# `VALUE_PREFIX`. Both a key and a value must be specified.
|
308
|
-
# * `+LABEL_KEY:VALUE`: Return all traces containing a key:value pair
|
309
|
-
# exactly matching the specified text. Both a key and a value must be
|
310
|
-
# specified.
|
311
|
-
# * `method:VALUE`: Equivalent to `/http/method:VALUE`.
|
312
|
-
# * `url:VALUE`: Equivalent to `/http/url:VALUE`.
|
313
|
-
# @param order_by [String]
|
314
|
-
# Optional. Field used to sort the returned traces.
|
315
|
-
# Can be one of the following:
|
316
|
-
#
|
317
|
-
# * `trace_id`
|
318
|
-
# * `name` (`name` field of root span in the trace)
|
319
|
-
# * `duration` (difference between `end_time` and `start_time` fields of
|
320
|
-
# the root span)
|
321
|
-
# * `start` (`start_time` field of the root span)
|
322
|
-
#
|
323
|
-
# Descending order can be specified by appending `desc` to the sort field
|
324
|
-
# (for example, `name desc`).
|
325
|
-
#
|
326
|
-
# Only one sort field is permitted.
|
327
|
-
# @param options [Google::Gax::CallOptions]
|
328
|
-
# Overrides the default settings for this call, e.g, timeout,
|
329
|
-
# retries, etc.
|
330
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
331
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Devtools::Cloudtrace::V1::Trace>]
|
332
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
333
|
-
# @return [Google::Gax::PagedEnumerable<Google::Devtools::Cloudtrace::V1::Trace>]
|
334
|
-
# An enumerable of Google::Devtools::Cloudtrace::V1::Trace instances.
|
335
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
336
|
-
# operations such as per-page iteration or access to the response
|
337
|
-
# object.
|
338
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
339
|
-
# @example
|
340
|
-
# require "google/cloud/trace"
|
341
|
-
#
|
342
|
-
# trace_client = Google::Cloud::Trace.new(version: :v1)
|
343
|
-
#
|
344
|
-
# # TODO: Initialize `project_id`:
|
345
|
-
# project_id = ''
|
346
|
-
#
|
347
|
-
# # Iterate over all results.
|
348
|
-
# trace_client.list_traces(project_id).each do |element|
|
349
|
-
# # Process element.
|
350
|
-
# end
|
351
|
-
#
|
352
|
-
# # Or iterate over results one page at a time.
|
353
|
-
# trace_client.list_traces(project_id).each_page do |page|
|
354
|
-
# # Process each page at a time.
|
355
|
-
# page.each do |element|
|
356
|
-
# # Process element.
|
357
|
-
# end
|
358
|
-
# end
|
359
|
-
|
360
|
-
def list_traces \
|
361
|
-
project_id,
|
362
|
-
view: nil,
|
363
|
-
page_size: nil,
|
364
|
-
start_time: nil,
|
365
|
-
end_time: nil,
|
366
|
-
filter: nil,
|
367
|
-
order_by: nil,
|
368
|
-
options: nil,
|
369
|
-
&block
|
370
|
-
req = {
|
371
|
-
project_id: project_id,
|
372
|
-
view: view,
|
373
|
-
page_size: page_size,
|
374
|
-
start_time: start_time,
|
375
|
-
end_time: end_time,
|
376
|
-
filter: filter,
|
377
|
-
order_by: order_by
|
378
|
-
}.delete_if { |_, v| v.nil? }
|
379
|
-
req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::ListTracesRequest)
|
380
|
-
@list_traces.call(req, options, &block)
|
381
|
-
end
|
382
|
-
|
383
|
-
# Gets a single trace by its ID.
|
384
|
-
#
|
385
|
-
# @param project_id [String]
|
386
|
-
# Required. ID of the Cloud project where the trace data is stored.
|
387
|
-
# @param trace_id [String]
|
388
|
-
# Required. ID of the trace to return.
|
389
|
-
# @param options [Google::Gax::CallOptions]
|
390
|
-
# Overrides the default settings for this call, e.g, timeout,
|
391
|
-
# retries, etc.
|
392
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
393
|
-
# @yieldparam result [Google::Devtools::Cloudtrace::V1::Trace]
|
394
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
395
|
-
# @return [Google::Devtools::Cloudtrace::V1::Trace]
|
396
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
397
|
-
# @example
|
398
|
-
# require "google/cloud/trace"
|
399
|
-
#
|
400
|
-
# trace_client = Google::Cloud::Trace.new(version: :v1)
|
401
|
-
#
|
402
|
-
# # TODO: Initialize `project_id`:
|
403
|
-
# project_id = ''
|
404
|
-
#
|
405
|
-
# # TODO: Initialize `trace_id`:
|
406
|
-
# trace_id = ''
|
407
|
-
# response = trace_client.get_trace(project_id, trace_id)
|
408
|
-
|
409
|
-
def get_trace \
|
410
|
-
project_id,
|
411
|
-
trace_id,
|
412
|
-
options: nil,
|
413
|
-
&block
|
414
|
-
req = {
|
415
|
-
project_id: project_id,
|
416
|
-
trace_id: trace_id
|
417
|
-
}.delete_if { |_, v| v.nil? }
|
418
|
-
req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::GetTraceRequest)
|
419
|
-
@get_trace.call(req, options, &block)
|
420
|
-
end
|
421
|
-
end
|
422
|
-
end
|
423
|
-
end
|
424
|
-
end
|
425
|
-
end
|