google-cloud-trace 0.34.5 → 0.35.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/INSTRUMENTATION.md +2 -2
- data/lib/google-cloud-trace.rb +1 -0
- data/lib/google/cloud/trace.rb +20 -7
- data/lib/google/cloud/trace/service.rb +17 -16
- data/lib/google/cloud/trace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b28e9c176fadada6b27fe995e7f4052a37c56cdbd8577734cc27941b3995aaf
|
4
|
+
data.tar.gz: 59b09025d3b1a4aada7afcc29117c6a971ae99f1f4d0dde91fed5338a1308f00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48bd85a3d9e6cfdfe1bf3ecab47374475ebb0277c01cf48f251752e8df772215e2d67bfda3dc10bb1fadbe26ff2c2ed774091ddb3a8f593ac906416561a2b357
|
7
|
+
data.tar.gz: 7eae5d1c328748bb591b29838c6f58ff94058249aaf1ea40b679a9be67b4389e98606b0e88f2486aff9967b6714bea04785b7d60a223dd7885a0a971b84ab0b8
|
data/CHANGELOG.md
CHANGED
data/INSTRUMENTATION.md
CHANGED
@@ -16,7 +16,7 @@ you want to run on a non Google Cloud environment or you want to customize the
|
|
16
16
|
default behavior.
|
17
17
|
|
18
18
|
See the [Configuration
|
19
|
-
Guide](https://googleapis.dev/ruby/stackdriver/INSTRUMENTATION_CONFIGURATION
|
19
|
+
Guide](https://googleapis.dev/ruby/stackdriver/latest/file.INSTRUMENTATION_CONFIGURATION.html)
|
20
20
|
for full configuration parameters.
|
21
21
|
|
22
22
|
## Rails Integration
|
@@ -29,7 +29,7 @@ require "google/cloud/trace/rails"
|
|
29
29
|
```
|
30
30
|
|
31
31
|
Alternatively, check out the
|
32
|
-
[stackdriver](https://googleapis.dev/ruby/stackdriver/latest
|
32
|
+
[stackdriver](https://googleapis.dev/ruby/stackdriver/latest)
|
33
33
|
gem, which enables this Railtie by default.
|
34
34
|
|
35
35
|
## Rack Integration
|
data/lib/google-cloud-trace.rb
CHANGED
@@ -137,6 +137,7 @@ Google::Cloud.configure.add_config! :trace do |config|
|
|
137
137
|
config.add_field! :scope, nil, match: [String, Array]
|
138
138
|
config.add_field! :timeout, nil, match: Integer
|
139
139
|
config.add_field! :client_config, nil, match: Hash
|
140
|
+
config.add_field! :endpoint, nil, match: String
|
140
141
|
config.add_field! :capture_stack, nil, enum: [true, false]
|
141
142
|
config.add_field! :sampler, nil
|
142
143
|
config.add_field! :span_id_generator, nil, match: Proc
|
data/lib/google/cloud/trace.rb
CHANGED
@@ -68,6 +68,10 @@ module Google
|
|
68
68
|
# * `https://www.googleapis.com/auth/cloud-platform`
|
69
69
|
#
|
70
70
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
71
|
+
# @param [Hash] client_config A hash of values to override the default
|
72
|
+
# behavior of the API client. Optional.
|
73
|
+
# @param [String] endpoint Override of the endpoint host name. Optional.
|
74
|
+
# If the param is nil, uses the default endpoint.
|
71
75
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
72
76
|
# @param [String] keyfile Alias for the `credentials` argument.
|
73
77
|
# Deprecated.
|
@@ -85,17 +89,15 @@ module Google
|
|
85
89
|
# end
|
86
90
|
#
|
87
91
|
def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
|
88
|
-
client_config: nil, project: nil, keyfile: nil
|
92
|
+
client_config: nil, endpoint: nil, project: nil, keyfile: nil
|
89
93
|
project_id ||= (project || default_project_id)
|
90
94
|
scope ||= configure.scope
|
91
95
|
timeout ||= configure.timeout
|
92
96
|
client_config ||= configure.client_config
|
97
|
+
endpoint ||= configure.endpoint
|
93
98
|
credentials ||= (keyfile || default_credentials(scope: scope))
|
94
99
|
|
95
|
-
|
96
|
-
credentials = Trace::Credentials.new credentials, scope: scope
|
97
|
-
end
|
98
|
-
|
100
|
+
credentials = resolve_credentials credentials, scope
|
99
101
|
if credentials.respond_to? :project_id
|
100
102
|
project_id ||= credentials.project_id
|
101
103
|
end
|
@@ -104,8 +106,8 @@ module Google
|
|
104
106
|
|
105
107
|
Trace::Project.new(
|
106
108
|
Trace::Service.new(
|
107
|
-
project_id, credentials,
|
108
|
-
|
109
|
+
project_id, credentials,
|
110
|
+
host: endpoint, timeout: timeout, client_config: client_config
|
109
111
|
)
|
110
112
|
)
|
111
113
|
end
|
@@ -128,6 +130,8 @@ module Google
|
|
128
130
|
# * `timeout` - (Integer) Default timeout to use in requests.
|
129
131
|
# * `client_config` - (Hash) A hash of values to override the default
|
130
132
|
# behavior of the API client.
|
133
|
+
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
134
|
+
# to use the default endpoint.
|
131
135
|
# * `capture_stack` - (Boolean) Whether to capture stack traces for each
|
132
136
|
# span. Default: `false`
|
133
137
|
# * `sampler` - (Proc) A sampler Proc makes the decision whether to record
|
@@ -173,6 +177,15 @@ module Google
|
|
173
177
|
Trace::Credentials.default(scope: scope)
|
174
178
|
end
|
175
179
|
|
180
|
+
##
|
181
|
+
# @private Resolve credentials
|
182
|
+
def self.resolve_credentials credentials, scope
|
183
|
+
unless credentials.is_a? Google::Auth::Credentials
|
184
|
+
credentials = Trace::Credentials.new credentials, scope: scope
|
185
|
+
end
|
186
|
+
credentials
|
187
|
+
end
|
188
|
+
|
176
189
|
##
|
177
190
|
# Set the current trace span being measured for the current thread, or
|
178
191
|
# the current trace if no span is currently open. This may be used with
|
@@ -17,6 +17,7 @@ require "google/cloud/errors"
|
|
17
17
|
require "google/cloud/trace/version"
|
18
18
|
require "google/cloud/trace/v1"
|
19
19
|
require "google/gax/errors"
|
20
|
+
require "uri"
|
20
21
|
|
21
22
|
module Google
|
22
23
|
module Cloud
|
@@ -27,29 +28,17 @@ module Google
|
|
27
28
|
# @private
|
28
29
|
#
|
29
30
|
class Service
|
30
|
-
|
31
|
-
# @private
|
32
|
-
attr_accessor :project
|
33
|
-
|
34
|
-
##
|
35
|
-
# @private
|
36
|
-
attr_accessor :credentials
|
37
|
-
|
38
|
-
##
|
39
|
-
# @private
|
40
|
-
attr_accessor :timeout
|
41
|
-
|
42
|
-
##
|
43
|
-
# @private
|
44
|
-
attr_accessor :client_config
|
31
|
+
attr_accessor :project, :credentials, :timeout, :client_config, :host
|
45
32
|
|
46
33
|
##
|
47
34
|
# Creates a new Service instance.
|
48
|
-
def initialize project, credentials, timeout: nil, client_config: nil
|
35
|
+
def initialize project, credentials, timeout: nil, client_config: nil,
|
36
|
+
host: nil
|
49
37
|
@project = project
|
50
38
|
@credentials = credentials
|
51
39
|
@timeout = timeout
|
52
40
|
@client_config = client_config || {}
|
41
|
+
@host = host || V1::TraceServiceClient::SERVICE_ADDRESS
|
53
42
|
end
|
54
43
|
|
55
44
|
def lowlevel_client
|
@@ -65,6 +54,8 @@ module Google
|
|
65
54
|
credentials: credentials,
|
66
55
|
timeout: timeout,
|
67
56
|
client_config: client_config,
|
57
|
+
service_address: service_address,
|
58
|
+
service_port: service_port,
|
68
59
|
lib_name: "gccl",
|
69
60
|
lib_version: Google::Cloud::Trace::VERSION
|
70
61
|
)
|
@@ -143,6 +134,16 @@ module Google
|
|
143
134
|
|
144
135
|
protected
|
145
136
|
|
137
|
+
def service_address
|
138
|
+
return nil if host.nil?
|
139
|
+
URI.parse("//#{host}").host
|
140
|
+
end
|
141
|
+
|
142
|
+
def service_port
|
143
|
+
return nil if host.nil?
|
144
|
+
URI.parse("//#{host}").port
|
145
|
+
end
|
146
|
+
|
146
147
|
def execute
|
147
148
|
yield
|
148
149
|
rescue Google::Gax::GaxError => e
|
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.35.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: 2019-08-
|
11
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|