minato-trace 0.1.6.pre.4 → 0.1.6.pre.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39b8bb1197b7ed2ff178447704bcd7874622a271607515f9a88f09c16238b5fb
|
4
|
+
data.tar.gz: d9c9d19e94f4ba106dd967912be6da96cf55f568ff4afbb9f9a8cf037501a6ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acedef97441ea61b9318c9bcfab7e4a967f5d23996a1cf61c31859a40d3ba8154fd98dd63f48c845920f86cf914b6cbbeee412620c72b87f6345ba45e052a4d8
|
7
|
+
data.tar.gz: 0a96cd5a060a194eaba77350928b3d46b52afe67e0853e2f8c6a329a2351557ddd22c426a19b7a9ab99778c9a31e4fe2da69142b3608460b96bae3479712537d
|
@@ -13,6 +13,8 @@ module Minato
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def add_trace_to_logs(log)
|
16
|
+
return log if current_cloud_trace.nil?
|
17
|
+
|
16
18
|
trace_log = "projects/#{current_cloud_trace.trace.project_id}/traces/#{current_cloud_trace.trace.trace_id}"
|
17
19
|
|
18
20
|
log.merge({ "logging.googleapis.com/trace": trace_log,
|
@@ -20,10 +22,10 @@ module Minato
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def current_cloud_trace
|
23
|
-
@current_cloud_trace ||=
|
25
|
+
@current_cloud_trace ||= current_cloud_trace_from_google_cloud
|
24
26
|
end
|
25
27
|
|
26
|
-
def
|
28
|
+
def current_cloud_trace_from_google_cloud
|
27
29
|
_trace_client = Google::Cloud::Trace.new
|
28
30
|
Google::Cloud::Trace.get
|
29
31
|
end
|
data/lib/minato/trace/version.rb
CHANGED
data/lib/minato/trace.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "minato/trace/version"
|
4
|
-
require "minato/trace/railtie"
|
5
4
|
require "minato/trace/middleware"
|
6
|
-
|
5
|
+
|
6
|
+
if defined? Rails::Railtie
|
7
|
+
require "google/cloud/trace/rails"
|
8
|
+
require "minato/trace/railtie"
|
9
|
+
end
|
7
10
|
|
8
11
|
module Minato
|
9
12
|
module Trace
|
@@ -12,7 +15,7 @@ module Minato
|
|
12
15
|
def self.init(app)
|
13
16
|
if Minato::Trace.enabled?
|
14
17
|
Minato::Trace.configure_loggging(app)
|
15
|
-
Minato::Trace.configure_trace
|
18
|
+
Minato::Trace.configure_trace
|
16
19
|
end
|
17
20
|
|
18
21
|
app
|
@@ -22,18 +25,25 @@ module Minato
|
|
22
25
|
ENV["MINATO_TRACE_DISABLED"] != "true"
|
23
26
|
end
|
24
27
|
|
25
|
-
def self.configure_trace
|
26
|
-
|
27
|
-
config.
|
28
|
-
config.
|
29
|
-
config.minato_logger.trace_logs = Minato::Trace::Middleware::IntegrateWithCloudLogging.new
|
28
|
+
def self.configure_trace
|
29
|
+
Google::Cloud.configure do |config|
|
30
|
+
config.use_trace = true
|
31
|
+
config.trace.sampler = Google::Cloud::Trace::TimeSampler.new(path_blacklist: BLACKLIST_PATHS.dup)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def self.configure_loggging(app)
|
36
|
+
Google::Cloud.configure do |config|
|
37
|
+
config.use_logging = false
|
38
|
+
end
|
39
|
+
|
34
40
|
app.configure do
|
35
|
-
config.
|
41
|
+
config.minato_logger.middleware.use Minato::Trace::Middleware::IntegrateWithCloudLogging
|
36
42
|
end
|
37
43
|
end
|
44
|
+
|
45
|
+
def self.skip_trace?(trace)
|
46
|
+
BLACKLIST_PATHS.any? { |path| trace.name.start_with?(path) }
|
47
|
+
end
|
38
48
|
end
|
39
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minato-trace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.6.pre.
|
4
|
+
version: 0.1.6.pre.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ferreri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-trace
|