google-cloud-trace 0.34.1 → 0.34.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02b2e97b5844be3d6cdeb71952946f9a9a508bed27d0e50129ab62f99809cebf
4
- data.tar.gz: '0149ae3e5a579db3e91c7dc38f4e3eeff117c53682d724eca50e4890ec2b4dc0'
3
+ metadata.gz: 7519f860e058884c0abedc93d49565ff8bc7b6a12a432bfd4194e5dca06b12fa
4
+ data.tar.gz: 2b2f62529a7a9741143d4ecf592387489f4e7ce856dbd83976cd9fbf41321151
5
5
  SHA512:
6
- metadata.gz: f318a17c151faaf6eb790a0378eacde5a50764c9826d8f158dc83b668fd29c4f34e84d9e36907f23e79cbc327b1f0b013c7cc57f83d4353a97f00e5a917f8ca1
7
- data.tar.gz: 06f9ca91cccf1262eed810ddf6e8ea65478d00fd4a7c77d08a0093535260267ad4601c531c3e87a5517fd1f689e0f73a2fdd5ac07f380153436e0807f17cebe8
6
+ metadata.gz: 27a1d602c21c19dd03526088cf664b85c2ed729ed35363a828fc1c63043fe97937a9056d1640bbce1bf96fa2a8d253478fe22f22599408adaec3f9f857f6ada1
7
+ data.tar.gz: 16a6f56576e8494af4886d3165bf904015b906df8a7b5416c51bf5ab5e173a33bcdd297df0dd97ffddd166638bf1712a23138d6764a78d24f0498014dfd43594
@@ -2,20 +2,39 @@
2
2
 
3
3
  In general, the google-cloud-trace library uses [Service
4
4
  Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
5
- credentials to connect to Google Cloud services. When running on Compute Engine
5
+ credentials to connect to Google Cloud services. When running within [Google
6
+ Cloud Platform environments](#google-cloud-platform-environments)
6
7
  the credentials will be discovered automatically. When running on other
7
8
  environments, the Service Account credentials can be specified by providing the
8
9
  path to the [JSON
9
10
  keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
10
- the account (or the JSON itself) in environment variables. Additionally, Cloud
11
- SDK credentials can also be discovered automatically, but this is only
12
- recommended during development.
11
+ the account (or the JSON itself) in [environment
12
+ variables](#environment-variables). Additionally, Cloud SDK credentials can also
13
+ be discovered automatically, but this is only recommended during development.
14
+
15
+ ## Quickstart
16
+
17
+ 1. [Create a service account and credentials](#creating-a-service-account).
18
+ 2. Set the [environment variable](#environment-variables).
19
+
20
+ ```sh
21
+ export TRACE_CREDENTIALS=/path/to/json`
22
+ ```
23
+
24
+ 3. Initialize the client.
25
+
26
+ ```ruby
27
+ require "google/cloud/trace"
28
+
29
+ client = Google::Cloud::Trace.new
30
+ ```
13
31
 
14
32
  ## Project and Credential Lookup
15
33
 
16
- The google-cloud-trace library aims to make authentication as simple as
17
- possible, and provides several mechanisms to configure your system without
18
- providing **Project ID** and **Service Account Credentials** directly in code.
34
+ The google-cloud-trace library aims to make authentication
35
+ as simple as possible, and provides several mechanisms to configure your system
36
+ without providing **Project ID** and **Service Account Credentials** directly in
37
+ code.
19
38
 
20
39
  **Project ID** is discovered in the following order:
21
40
 
@@ -23,6 +42,7 @@ providing **Project ID** and **Service Account Credentials** directly in code.
23
42
  2. Specify project ID in configuration
24
43
  3. Discover project ID in environment variables
25
44
  4. Discover GCE project ID
45
+ 5. Discover project ID in credentials JSON
26
46
 
27
47
  **Credentials** are discovered in the following order:
28
48
 
@@ -73,12 +93,12 @@ environment variable, or the **Credentials JSON** itself can be stored for
73
93
  environments such as Docker containers where writing files is difficult or not
74
94
  encouraged.
75
95
 
76
- The environment variables that Trace checks for project ID are:
96
+ The environment variables that google-cloud-trace checks for project ID are:
77
97
 
78
98
  1. `TRACE_PROJECT`
79
99
  2. `GOOGLE_CLOUD_PROJECT`
80
100
 
81
- The environment variables that Trace checks for credentials are configured on {Google::Cloud::Trace::V1::Credentials}:
101
+ The environment variables that google-cloud-trace checks for credentials are configured on {Google::Cloud::Trace::V2::Credentials}:
82
102
 
83
103
  1. `TRACE_CREDENTIALS` - Path to JSON file, or JSON contents
84
104
  2. `TRACE_KEYFILE` - Path to JSON file, or JSON contents
@@ -92,7 +112,7 @@ require "google/cloud/trace"
92
112
  ENV["TRACE_PROJECT"] = "my-project-id"
93
113
  ENV["TRACE_CREDENTIALS"] = "path/to/keyfile.json"
94
114
 
95
- trace = Google::Cloud::Trace.new
115
+ client = Google::Cloud::Trace.new
96
116
  ```
97
117
 
98
118
  ### Configuration
@@ -107,7 +127,7 @@ Google::Cloud::Trace.configure do |config|
107
127
  config.credentials = "path/to/keyfile.json"
108
128
  end
109
129
 
110
- trace = Google::Cloud::Trace.new
130
+ client = Google::Cloud::Trace.new
111
131
  ```
112
132
 
113
133
  ### Cloud SDK
@@ -140,7 +160,8 @@ Google Cloud requires a **Project ID** and **Service Account Credentials** to
140
160
  connect to the APIs. You will use the **Project ID** and **JSON key file** to
141
161
  connect to most services with google-cloud-trace.
142
162
 
143
- If you are not running this client on Google Compute Engine, you need a Google
163
+ If you are not running this client within [Google Cloud Platform
164
+ environments](#google-cloud-platform-environments), you need a Google
144
165
  Developers service account.
145
166
 
146
167
  1. Visit the [Google Developers Console][dev-console].
@@ -1,5 +1,12 @@
1
1
  # Release History
2
2
 
3
+ ### 0.34.2 / 2019-04-29
4
+
5
+ * Add AUTHENTICATION.md guide.
6
+ * Update generated documentation.
7
+ * Update generated code examples.
8
+ * Extract gRPC header values from request.
9
+
3
10
  ### 0.34.1 / 2019-02-13
4
11
 
5
12
  * Fix bug (typo) in retrieving default on_error proc.
@@ -15,17 +15,19 @@
15
15
 
16
16
  module Google
17
17
  module Protobuf
18
- # A Timestamp represents a point in time independent of any time zone
19
- # or calendar, represented as seconds and fractions of seconds at
20
- # nanosecond resolution in UTC Epoch time. It is encoded using the
21
- # Proleptic Gregorian Calendar which extends the Gregorian calendar
22
- # backwards to year one. It is encoded assuming all minutes are 60
23
- # seconds long, i.e. leap seconds are "smeared" so that no leap second
24
- # table is needed for interpretation. Range is from
25
- # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
26
- # By restricting to that range, we ensure that we can convert to
27
- # and from RFC 3339 date strings.
28
- # See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
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.
29
31
  #
30
32
  # = Examples
31
33
  #
@@ -86,12 +88,12 @@ module Google
86
88
  # 01:30 UTC on January 15, 2017.
87
89
  #
88
90
  # In JavaScript, one can convert a Date object to this format using the
89
- # standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
91
+ # standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
90
92
  # method. In Python, a standard `datetime.datetime` object can be converted
91
93
  # to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
92
94
  # with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
93
95
  # can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
94
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
96
+ # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
95
97
  # ) to obtain a formatter capable of generating timestamps in this format.
96
98
  # @!attribute [rw] seconds
97
99
  # @return [Integer]
@@ -179,7 +179,10 @@ module Google
179
179
  @patch_traces = Google::Gax.create_api_call(
180
180
  @trace_service_stub.method(:patch_traces),
181
181
  defaults["patch_traces"],
182
- exception_transformer: exception_transformer
182
+ exception_transformer: exception_transformer,
183
+ params_extractor: proc do |request|
184
+ {'project_id' => request.project_id}
185
+ end
183
186
  )
184
187
  @get_trace = Google::Gax.create_api_call(
185
188
  @trace_service_stub.method(:get_trace),
@@ -189,7 +192,10 @@ module Google
189
192
  @list_traces = Google::Gax.create_api_call(
190
193
  @trace_service_stub.method(:list_traces),
191
194
  defaults["list_traces"],
192
- exception_transformer: exception_transformer
195
+ exception_transformer: exception_transformer,
196
+ params_extractor: proc do |request|
197
+ {'project_id' => request.project_id}
198
+ end
193
199
  )
194
200
  end
195
201
 
@@ -217,14 +223,14 @@ module Google
217
223
  # @example
218
224
  # require "google/cloud/trace"
219
225
  #
220
- # trace_service_client = Google::Cloud::Trace.new(version: :v1)
226
+ # trace_client = Google::Cloud::Trace.new(version: :v1)
221
227
  #
222
228
  # # TODO: Initialize `project_id`:
223
229
  # project_id = ''
224
230
  #
225
231
  # # TODO: Initialize `traces`:
226
232
  # traces = {}
227
- # trace_service_client.patch_traces(project_id, traces)
233
+ # trace_client.patch_traces(project_id, traces)
228
234
 
229
235
  def patch_traces \
230
236
  project_id,
@@ -257,14 +263,14 @@ module Google
257
263
  # @example
258
264
  # require "google/cloud/trace"
259
265
  #
260
- # trace_service_client = Google::Cloud::Trace.new(version: :v1)
266
+ # trace_client = Google::Cloud::Trace.new(version: :v1)
261
267
  #
262
268
  # # TODO: Initialize `project_id`:
263
269
  # project_id = ''
264
270
  #
265
271
  # # TODO: Initialize `trace_id`:
266
272
  # trace_id = ''
267
- # response = trace_service_client.get_trace(project_id, trace_id)
273
+ # response = trace_client.get_trace(project_id, trace_id)
268
274
 
269
275
  def get_trace \
270
276
  project_id,
@@ -287,9 +293,11 @@ module Google
287
293
  # Type of data returned for traces in the list. Optional. Default is
288
294
  # `MINIMAL`.
289
295
  # @param page_size [Integer]
290
- # Maximum number of traces to return. If not specified or <= 0, the
291
- # implementation selects a reasonable value. The implementation may
292
- # return fewer traces than the requested page size. Optional.
296
+ # The maximum number of resources contained in the underlying API
297
+ # response. If page streaming is performed per-resource, this
298
+ # parameter does not affect the return value. If page streaming is
299
+ # performed per-page, this determines the maximum number of
300
+ # resources in a page.
293
301
  # @param start_time [Google::Protobuf::Timestamp | Hash]
294
302
  # Start of the time interval (inclusive) during which the trace data was
295
303
  # collected from the application.
@@ -360,18 +368,18 @@ module Google
360
368
  # @example
361
369
  # require "google/cloud/trace"
362
370
  #
363
- # trace_service_client = Google::Cloud::Trace.new(version: :v1)
371
+ # trace_client = Google::Cloud::Trace.new(version: :v1)
364
372
  #
365
373
  # # TODO: Initialize `project_id`:
366
374
  # project_id = ''
367
375
  #
368
376
  # # Iterate over all results.
369
- # trace_service_client.list_traces(project_id).each do |element|
377
+ # trace_client.list_traces(project_id).each do |element|
370
378
  # # Process element.
371
379
  # end
372
380
  #
373
381
  # # Or iterate over results one page at a time.
374
- # trace_service_client.list_traces(project_id).each_page do |page|
382
+ # trace_client.list_traces(project_id).each_page do |page|
375
383
  # # Process each page at a time.
376
384
  # page.each do |element|
377
385
  # # Process element.
@@ -97,7 +97,8 @@ module Google
97
97
  # @!attribute [rw] type_url
98
98
  # @return [String]
99
99
  # A URL/resource name that uniquely identifies the type of the serialized
100
- # protocol buffer message. The last segment of the URL's path must represent
100
+ # protocol buffer message. This string must contain at least
101
+ # one "/" character. The last segment of the URL's path must represent
101
102
  # the fully qualified name of the type (as in
102
103
  # `path/google.protobuf.Duration`). The name should be in a canonical form
103
104
  # (e.g., leading "." is not accepted).
@@ -15,17 +15,19 @@
15
15
 
16
16
  module Google
17
17
  module Protobuf
18
- # A Timestamp represents a point in time independent of any time zone
19
- # or calendar, represented as seconds and fractions of seconds at
20
- # nanosecond resolution in UTC Epoch time. It is encoded using the
21
- # Proleptic Gregorian Calendar which extends the Gregorian calendar
22
- # backwards to year one. It is encoded assuming all minutes are 60
23
- # seconds long, i.e. leap seconds are "smeared" so that no leap second
24
- # table is needed for interpretation. Range is from
25
- # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
26
- # By restricting to that range, we ensure that we can convert to
27
- # and from RFC 3339 date strings.
28
- # See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
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.
29
31
  #
30
32
  # = Examples
31
33
  #
@@ -86,12 +88,12 @@ module Google
86
88
  # 01:30 UTC on January 15, 2017.
87
89
  #
88
90
  # In JavaScript, one can convert a Date object to this format using the
89
- # standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
91
+ # standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
90
92
  # method. In Python, a standard `datetime.datetime` object can be converted
91
93
  # to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
92
94
  # with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
93
95
  # can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
94
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
96
+ # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
95
97
  # ) to obtain a formatter capable of generating timestamps in this format.
96
98
  # @!attribute [rw] seconds
97
99
  # @return [Integer]
@@ -15,24 +15,25 @@
15
15
 
16
16
  module Google
17
17
  module Rpc
18
- # The `Status` type defines a logical error model that is suitable for different
19
- # programming environments, including REST APIs and RPC APIs. It is used by
20
- # [gRPC](https://github.com/grpc). The error model is designed to be:
18
+ # The `Status` type defines a logical error model that is suitable for
19
+ # different programming environments, including REST APIs and RPC APIs. It is
20
+ # used by [gRPC](https://github.com/grpc). The error model is designed to be:
21
21
  #
22
22
  # * Simple to use and understand for most users
23
23
  # * Flexible enough to meet unexpected needs
24
24
  #
25
25
  # = Overview
26
26
  #
27
- # The `Status` message contains three pieces of data: error code, error message,
28
- # and error details. The error code should be an enum value of
29
- # {Google::Rpc::Code}, but it may accept additional error codes if needed. The
30
- # error message should be a developer-facing English message that helps
31
- # developers *understand* and *resolve* the error. If a localized user-facing
32
- # error message is needed, put the localized message in the error details or
33
- # localize it in the client. The optional error details may contain arbitrary
34
- # information about the error. There is a predefined set of error detail types
35
- # in the package `google.rpc` that can be used for common error conditions.
27
+ # The `Status` message contains three pieces of data: error code, error
28
+ # message, and error details. The error code should be an enum value of
29
+ # {Google::Rpc::Code}, but it may accept additional error codes
30
+ # if needed. The error message should be a developer-facing English message
31
+ # that helps developers *understand* and *resolve* the error. If a localized
32
+ # user-facing error message is needed, put the localized message in the error
33
+ # details or localize it in the client. The optional error details may contain
34
+ # arbitrary information about the error. There is a predefined set of error
35
+ # detail types in the package `google.rpc` that can be used for common error
36
+ # conditions.
36
37
  #
37
38
  # = Language mapping
38
39
  #
@@ -69,12 +70,14 @@ module Google
69
70
  # be used directly after any stripping needed for security/privacy reasons.
70
71
  # @!attribute [rw] code
71
72
  # @return [Integer]
72
- # The status code, which should be an enum value of {Google::Rpc::Code}.
73
+ # The status code, which should be an enum value of
74
+ # {Google::Rpc::Code}.
73
75
  # @!attribute [rw] message
74
76
  # @return [String]
75
77
  # A developer-facing error message, which should be in English. Any
76
78
  # user-facing error message should be localized and sent in the
77
- # {Google::Rpc::Status#details} field, or localized by the client.
79
+ # {Google::Rpc::Status#details} field, or localized
80
+ # by the client.
78
81
  # @!attribute [rw] details
79
82
  # @return [Array<Google::Protobuf::Any>]
80
83
  # A list of messages that carry the error details. There is a common set of
@@ -202,12 +202,18 @@ module Google
202
202
  @batch_write_spans = Google::Gax.create_api_call(
203
203
  @trace_service_stub.method(:batch_write_spans),
204
204
  defaults["batch_write_spans"],
205
- exception_transformer: exception_transformer
205
+ exception_transformer: exception_transformer,
206
+ params_extractor: proc do |request|
207
+ {'name' => request.name}
208
+ end
206
209
  )
207
210
  @create_span = Google::Gax.create_api_call(
208
211
  @trace_service_stub.method(:create_span),
209
212
  defaults["create_span"],
210
- exception_transformer: exception_transformer
213
+ exception_transformer: exception_transformer,
214
+ params_extractor: proc do |request|
215
+ {'name' => request.name}
216
+ end
211
217
  )
212
218
  end
213
219
 
@@ -234,12 +240,12 @@ module Google
234
240
  # @example
235
241
  # require "google/cloud/trace"
236
242
  #
237
- # trace_service_client = Google::Cloud::Trace.new(version: :v2)
243
+ # trace_client = Google::Cloud::Trace.new(version: :v2)
238
244
  # formatted_name = Google::Cloud::Trace::V2::TraceServiceClient.project_path("[PROJECT]")
239
245
  #
240
246
  # # TODO: Initialize `spans`:
241
247
  # spans = []
242
- # trace_service_client.batch_write_spans(formatted_name, spans)
248
+ # trace_client.batch_write_spans(formatted_name, spans)
243
249
 
244
250
  def batch_write_spans \
245
251
  name,
@@ -339,7 +345,7 @@ module Google
339
345
  # @example
340
346
  # require "google/cloud/trace"
341
347
  #
342
- # trace_service_client = Google::Cloud::Trace.new(version: :v2)
348
+ # trace_client = Google::Cloud::Trace.new(version: :v2)
343
349
  # formatted_name = Google::Cloud::Trace::V2::TraceServiceClient.span_path("[PROJECT]", "[TRACE]", "[SPAN]")
344
350
  #
345
351
  # # TODO: Initialize `span_id`:
@@ -353,7 +359,7 @@ module Google
353
359
  #
354
360
  # # TODO: Initialize `end_time`:
355
361
  # end_time = {}
356
- # response = trace_service_client.create_span(formatted_name, span_id, display_name, start_time, end_time)
362
+ # response = trace_client.create_span(formatted_name, span_id, display_name, start_time, end_time)
357
363
 
358
364
  def create_span \
359
365
  name,
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Trace
19
- VERSION = "0.34.1".freeze
19
+ VERSION = "0.34.2".freeze
20
20
  end
21
21
  end
22
22
  end
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.34.1
4
+ version: 0.34.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-13 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 0.61.0
187
+ version: 0.64.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 0.61.0
194
+ version: 0.64.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: simplecov
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -328,8 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
328
  - !ruby/object:Gem::Version
329
329
  version: '0'
330
330
  requirements: []
331
- rubyforge_project:
332
- rubygems_version: 2.7.6
331
+ rubygems_version: 3.0.3
333
332
  signing_key:
334
333
  specification_version: 4
335
334
  summary: Application Instrumentation and API Client library for Stackdriver Trace