google-cloud-trace 0.46.1 → 0.47.0
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/google/cloud/trace/middleware.rb +9 -1
- data/lib/google/cloud/trace/project.rb +9 -0
- data/lib/google/cloud/trace/rails.rb +2 -0
- data/lib/google/cloud/trace/service.rb +37 -2
- data/lib/google/cloud/trace/version.rb +1 -1
- data/lib/google/cloud/trace.rb +16 -6
- data/lib/google-cloud-trace.rb +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77d4b97fc254f1f3111d461c1fe0e7db5a81a18acba36902406e365be15d7cec
|
|
4
|
+
data.tar.gz: aab0506cb759384629dca60cc5bf4f4a579b9f3230d05651b27f497bc82403b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 821cbf6ad4adcdf0d31d57c1818f02327bfdb9a911ea61f4bde49b5a65a5ad1c49e0b6c7697f3fe2f4aa870b76fd7aa43cd809bbf0048574400f4c03048c0ee4
|
|
7
|
+
data.tar.gz: 67827469741b1d0d3746416e67a5c53a93a60465202695f4abf6ebde61f8aea728feba56658359b0d7c227d2e7ec1d314bf4967631ee31503295cb46bb6e197b
|
data/CHANGELOG.md
CHANGED
|
@@ -164,7 +164,9 @@ module Google
|
|
|
164
164
|
if project_id
|
|
165
165
|
credentials = configuration.credentials
|
|
166
166
|
tracer = Google::Cloud::Trace.new project_id: project_id,
|
|
167
|
-
credentials: credentials
|
|
167
|
+
credentials: credentials,
|
|
168
|
+
endpoint: configuration.endpoint,
|
|
169
|
+
universe_domain: configuration.universe_domain
|
|
168
170
|
@service = Google::Cloud::Trace::AsyncReporter.new tracer.service
|
|
169
171
|
end
|
|
170
172
|
end
|
|
@@ -388,6 +390,12 @@ module Google
|
|
|
388
390
|
# already.
|
|
389
391
|
#
|
|
390
392
|
def load_config **kwargs
|
|
393
|
+
endpoint = kwargs[:endpoint]
|
|
394
|
+
configuration.endpoint = endpoint unless endpoint.nil?
|
|
395
|
+
|
|
396
|
+
universe_domain = kwargs[:universe_domain]
|
|
397
|
+
configuration.universe_domain = universe_domain unless universe_domain.nil?
|
|
398
|
+
|
|
391
399
|
capture_stack = kwargs[:capture_stack]
|
|
392
400
|
configuration.capture_stack = capture_stack unless capture_stack.nil?
|
|
393
401
|
|
|
@@ -72,6 +72,15 @@ module Google
|
|
|
72
72
|
end
|
|
73
73
|
alias project project_id
|
|
74
74
|
|
|
75
|
+
##
|
|
76
|
+
# The universe domain the client is connected to.
|
|
77
|
+
#
|
|
78
|
+
# @return [String]
|
|
79
|
+
#
|
|
80
|
+
def universe_domain
|
|
81
|
+
service.universe_domain
|
|
82
|
+
end
|
|
83
|
+
|
|
75
84
|
##
|
|
76
85
|
# Create a new empty trace record for this project. Uses the current
|
|
77
86
|
# thread's TraceContext by default; otherwise you may provide a
|
|
@@ -161,6 +161,8 @@ module Google
|
|
|
161
161
|
config.credentials ||= (config.keyfile ||
|
|
162
162
|
trace_config.credentials || trace_config.keyfile ||
|
|
163
163
|
gcp_config.credentials || gcp_config.keyfile)
|
|
164
|
+
config.endpoint ||= trace_config.endpoint
|
|
165
|
+
config.universe_domain ||= trace_config.universe_domain || gcp_config.universe_domain
|
|
164
166
|
config.notifications ||= trace_config.notifications
|
|
165
167
|
config.max_data_length ||= trace_config.max_data_length
|
|
166
168
|
if config.capture_stack.nil?
|
|
@@ -37,11 +37,20 @@ module Google
|
|
|
37
37
|
def initialize project,
|
|
38
38
|
credentials,
|
|
39
39
|
timeout: nil,
|
|
40
|
-
host: nil
|
|
40
|
+
host: nil,
|
|
41
|
+
universe_domain: nil
|
|
41
42
|
@project = project
|
|
42
43
|
@credentials = credentials
|
|
43
44
|
@timeout = timeout
|
|
44
45
|
@host = host
|
|
46
|
+
@universe_domain = universe_domain
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def universe_domain
|
|
50
|
+
@lowlevel_client&.universe_domain ||
|
|
51
|
+
resolved_universe_domain ||
|
|
52
|
+
ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"] ||
|
|
53
|
+
"googleapis.com"
|
|
45
54
|
end
|
|
46
55
|
|
|
47
56
|
def lowlevel_client
|
|
@@ -53,10 +62,14 @@ module Google
|
|
|
53
62
|
require "google/cloud/trace/patches/active_call_with_trace"
|
|
54
63
|
require "google/cloud/trace/patches/call_with_trace"
|
|
55
64
|
|
|
65
|
+
endpoint = resolved_endpoint
|
|
66
|
+
universe = resolved_universe_domain
|
|
67
|
+
|
|
56
68
|
V1::TraceService::Client.new do |config|
|
|
57
69
|
config.credentials = credentials if credentials
|
|
58
70
|
config.timeout = timeout if timeout
|
|
59
|
-
config.endpoint =
|
|
71
|
+
config.endpoint = endpoint if endpoint
|
|
72
|
+
config.universe_domain = universe if universe
|
|
60
73
|
config.lib_name = "gccl"
|
|
61
74
|
config.lib_version = Google::Cloud::Trace::VERSION
|
|
62
75
|
end
|
|
@@ -123,6 +136,28 @@ module Google
|
|
|
123
136
|
def inspect
|
|
124
137
|
"#{self.class}(#{@project})"
|
|
125
138
|
end
|
|
139
|
+
|
|
140
|
+
private
|
|
141
|
+
|
|
142
|
+
def resolved_endpoint
|
|
143
|
+
host ||
|
|
144
|
+
V1::TraceService::Client.configure.endpoint ||
|
|
145
|
+
configured_trace_option(:endpoint)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def resolved_universe_domain
|
|
149
|
+
@universe_domain ||
|
|
150
|
+
V1::TraceService::Client.configure.universe_domain ||
|
|
151
|
+
configured_trace_option(:universe_domain)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def configured_trace_option key
|
|
155
|
+
return unless Google::Cloud.respond_to?(:configure) &&
|
|
156
|
+
Google::Cloud.configure.subconfig?(:trace)
|
|
157
|
+
|
|
158
|
+
config = Google::Cloud.configure.trace
|
|
159
|
+
config[key] if config.respond_to? key
|
|
160
|
+
end
|
|
126
161
|
end
|
|
127
162
|
end
|
|
128
163
|
end
|
data/lib/google/cloud/trace.rb
CHANGED
|
@@ -70,6 +70,9 @@ module Google
|
|
|
70
70
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
|
71
71
|
# @param [String] endpoint Override of the endpoint host name. Optional.
|
|
72
72
|
# If the param is nil, uses the default endpoint.
|
|
73
|
+
# @param [String] universe_domain Override of the universe domain. Optional.
|
|
74
|
+
# If the param is nil, uses the configured `universe_domain`,
|
|
75
|
+
# `ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"]`, or `"googleapis.com"`.
|
|
73
76
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
|
74
77
|
# @param [String] keyfile Alias for the `credentials` argument.
|
|
75
78
|
# Deprecated.
|
|
@@ -91,13 +94,15 @@ module Google
|
|
|
91
94
|
scope: nil,
|
|
92
95
|
timeout: nil,
|
|
93
96
|
endpoint: nil,
|
|
97
|
+
universe_domain: nil,
|
|
94
98
|
project: nil,
|
|
95
99
|
keyfile: nil
|
|
96
|
-
project_id
|
|
97
|
-
scope
|
|
98
|
-
timeout
|
|
99
|
-
endpoint
|
|
100
|
-
|
|
100
|
+
project_id ||= project || default_project_id
|
|
101
|
+
scope ||= configure.scope
|
|
102
|
+
timeout ||= configure.timeout
|
|
103
|
+
endpoint ||= configure.endpoint
|
|
104
|
+
universe_domain ||= configure.universe_domain
|
|
105
|
+
credentials ||= keyfile || default_credentials(scope: scope)
|
|
101
106
|
|
|
102
107
|
credentials = resolve_credentials credentials, scope
|
|
103
108
|
if credentials.respond_to? :project_id
|
|
@@ -106,7 +111,9 @@ module Google
|
|
|
106
111
|
project_id = project_id.to_s # Always cast to a string
|
|
107
112
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
|
108
113
|
|
|
109
|
-
service = Trace::Service.new project_id, credentials,
|
|
114
|
+
service = Trace::Service.new project_id, credentials,
|
|
115
|
+
host: endpoint, timeout: timeout,
|
|
116
|
+
universe_domain: universe_domain
|
|
110
117
|
Trace::Project.new service
|
|
111
118
|
end
|
|
112
119
|
|
|
@@ -128,6 +135,9 @@ module Google
|
|
|
128
135
|
# * `timeout` - (Integer) Default timeout to use in requests.
|
|
129
136
|
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
|
130
137
|
# to use the default endpoint.
|
|
138
|
+
# * `universe_domain` - (String) Override of the universe domain, or
|
|
139
|
+
# `nil` to use `ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"]` or the default
|
|
140
|
+
# universe domain (`"googleapis.com"`).
|
|
131
141
|
# * `capture_stack` - (Boolean) Whether to capture stack traces for each
|
|
132
142
|
# span. Default: `false`
|
|
133
143
|
# * `sampler` - (Proc) A sampler Proc makes the decision whether to record
|
data/lib/google-cloud-trace.rb
CHANGED
|
@@ -130,7 +130,6 @@ Google::Cloud.configure.add_config! :trace do |config|
|
|
|
130
130
|
"TRACE_KEYFILE", "TRACE_KEYFILE_JSON"
|
|
131
131
|
)
|
|
132
132
|
end
|
|
133
|
-
endpoint = "cloudtrace.googleapis.com".freeze
|
|
134
133
|
scopes = [
|
|
135
134
|
"https://www.googleapis.com/auth/cloud-platform",
|
|
136
135
|
"https://www.googleapis.com/auth/trace.append",
|
|
@@ -146,7 +145,8 @@ Google::Cloud.configure.add_config! :trace do |config|
|
|
|
146
145
|
config.add_alias! :keyfile, :credentials
|
|
147
146
|
config.add_field! :scope, scopes, match: [String, Array]
|
|
148
147
|
config.add_field! :timeout, nil, match: Integer
|
|
149
|
-
config.add_field! :endpoint,
|
|
148
|
+
config.add_field! :endpoint, nil, match: String, allow_nil: true
|
|
149
|
+
config.add_field! :universe_domain, nil, match: String, allow_nil: true
|
|
150
150
|
config.add_field! :capture_stack, nil, enum: [true, false]
|
|
151
151
|
config.add_field! :sampler, nil
|
|
152
152
|
config.add_field! :span_id_generator, nil, match: Proc
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.47.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Azuma
|
|
@@ -57,7 +57,7 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
60
|
+
version: 0.8.0
|
|
61
61
|
- - "<"
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
63
|
version: 2.a
|
|
@@ -67,7 +67,7 @@ dependencies:
|
|
|
67
67
|
requirements:
|
|
68
68
|
- - ">="
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
|
-
version:
|
|
70
|
+
version: 0.8.0
|
|
71
71
|
- - "<"
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
73
|
version: 2.a
|
|
@@ -77,7 +77,7 @@ dependencies:
|
|
|
77
77
|
requirements:
|
|
78
78
|
- - ">="
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
|
-
version:
|
|
80
|
+
version: 0.8.0
|
|
81
81
|
- - "<"
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
83
|
version: 2.a
|
|
@@ -87,7 +87,7 @@ dependencies:
|
|
|
87
87
|
requirements:
|
|
88
88
|
- - ">="
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
|
-
version:
|
|
90
|
+
version: 0.8.0
|
|
91
91
|
- - "<"
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
93
|
version: 2.a
|