opentrace 0.2.1 → 0.3.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/lib/opentrace/config.rb +3 -1
- data/lib/opentrace/rails.rb +9 -0
- data/lib/opentrace/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 415cb9523a3c54703221a0604c9a301eb47b9f71c99737fcc194ced1d28ea178
|
|
4
|
+
data.tar.gz: cb6d7f5a295c27bb68ff51a79b196297b18fe3ef568ac9e788c3d010828d2092
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e1a1a6f4d72827d11d4d879c867afd98e96e8fead065232a1e64fd32c74c309c3db52fde64ab60f24b0a40884cac78177e5b368a998cf14b026c0ca85388277
|
|
7
|
+
data.tar.gz: 3d3c85e68ac60f2d25824a2ec687fec9f7e31f40ba25c6fb3ca3fa031c9f2abff677ffbde978a93de430538cb7adeea9e1f907ba4f8481ecf32270121dea5196
|
data/lib/opentrace/config.rb
CHANGED
|
@@ -8,7 +8,8 @@ module OpenTrace
|
|
|
8
8
|
attr_accessor :endpoint, :api_key, :service, :environment, :timeout, :enabled,
|
|
9
9
|
:context, :min_level, :hostname, :pid, :git_sha,
|
|
10
10
|
:batch_size, :flush_interval,
|
|
11
|
-
:sql_logging, :sql_duration_threshold_ms
|
|
11
|
+
:sql_logging, :sql_duration_threshold_ms,
|
|
12
|
+
:ignore_paths
|
|
12
13
|
|
|
13
14
|
def initialize
|
|
14
15
|
@endpoint = nil
|
|
@@ -26,6 +27,7 @@ module OpenTrace
|
|
|
26
27
|
@flush_interval = 5.0
|
|
27
28
|
@sql_logging = true
|
|
28
29
|
@sql_duration_threshold_ms = 0.0
|
|
30
|
+
@ignore_paths = []
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
def valid?
|
data/lib/opentrace/rails.rb
CHANGED
|
@@ -60,6 +60,7 @@ if defined?(::Rails::Railtie)
|
|
|
60
60
|
return unless OpenTrace.enabled?
|
|
61
61
|
|
|
62
62
|
payload = event.payload
|
|
63
|
+
return if ignored_path?(payload[:path])
|
|
63
64
|
metadata = {
|
|
64
65
|
request_id: payload[:headers]&.env&.dig("action_dispatch.request_id"),
|
|
65
66
|
controller: payload[:controller],
|
|
@@ -220,6 +221,14 @@ if defined?(::Rails::Railtie)
|
|
|
220
221
|
end
|
|
221
222
|
end
|
|
222
223
|
|
|
224
|
+
def ignored_path?(path)
|
|
225
|
+
return false if path.nil?
|
|
226
|
+
|
|
227
|
+
OpenTrace.config.ignore_paths.any? do |entry|
|
|
228
|
+
entry.is_a?(Regexp) ? entry.match?(path) : path == entry
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
223
232
|
def truncate_hash(hash, max_bytes)
|
|
224
233
|
json = JSON.generate(hash)
|
|
225
234
|
return hash if json.bytesize <= max_bytes
|
data/lib/opentrace/version.rb
CHANGED