logtail-rack 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logtail-rack/http_context.rb +3 -2
- data/lib/logtail-rack/http_events.rb +6 -6
- data/lib/logtail-rack/user_context.rb +5 -3
- data/lib/logtail-rack/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ee36c5262e866052f62ff09219455f11fee21f613182d01da7a84b6b6270df4
|
4
|
+
data.tar.gz: 88967a4936350f2ae1aaa104b5e4fc2789ad1e9858f637992df904731e203fbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a61667c988b7ad5b6a0adbcc43bd14e49fc5e664fc5be1b033ecdb57b3f60063b902e1b1724427313705eec7f6e396cd9ec4fdd62e0acffe2357d99ae38d30b
|
7
|
+
data.tar.gz: 0cc11c57b700edd81a1f9280306140ec9b0b111dcf465ec321286038f802b0dafd5b5efb7f156d491f3573d14611405eaae88a72bdee7ccc795b6a91a526d946
|
@@ -136,14 +136,14 @@ module Logtail
|
|
136
136
|
end
|
137
137
|
|
138
138
|
elsif collapse_into_single_event?
|
139
|
-
|
140
|
-
|
139
|
+
request_start = Time.now
|
141
140
|
status, headers, body = @app.call(env)
|
141
|
+
request_end = Time.now
|
142
142
|
|
143
143
|
Config.instance.logger.info do
|
144
144
|
http_context = CurrentContext.fetch(:http)
|
145
145
|
content_length = safe_to_i(headers[CONTENT_LENGTH_KEY])
|
146
|
-
duration_ms = (
|
146
|
+
duration_ms = (request_end - request_start) * 1000.0
|
147
147
|
|
148
148
|
http_response = HTTPResponse.new(
|
149
149
|
content_length: content_length,
|
@@ -174,8 +174,6 @@ module Logtail
|
|
174
174
|
|
175
175
|
[status, headers, body]
|
176
176
|
else
|
177
|
-
start = Time.now
|
178
|
-
|
179
177
|
Config.instance.logger.info do
|
180
178
|
event_body = capture_request_body? ? request.body_content : nil
|
181
179
|
http_request = HTTPRequest.new(
|
@@ -213,12 +211,14 @@ module Logtail
|
|
213
211
|
}
|
214
212
|
end
|
215
213
|
|
214
|
+
request_start = Time.now
|
216
215
|
status, headers, body = @app.call(env)
|
216
|
+
request_end = Time.now
|
217
217
|
|
218
218
|
Config.instance.logger.info do
|
219
219
|
event_body = capture_response_body? ? body : nil
|
220
220
|
content_length = safe_to_i(headers[CONTENT_LENGTH_KEY])
|
221
|
-
duration_ms = (
|
221
|
+
duration_ms = (request_end - request_start) * 1000.0
|
222
222
|
|
223
223
|
http_response = HTTPResponse.new(
|
224
224
|
body: event_body,
|
@@ -67,10 +67,12 @@ module Logtail
|
|
67
67
|
def call(env)
|
68
68
|
user_hash = get_user_hash(env)
|
69
69
|
if user_hash
|
70
|
-
CurrentContext.
|
70
|
+
CurrentContext.with({user: user_hash}) do
|
71
|
+
@app.call(env)
|
72
|
+
end
|
73
|
+
else
|
74
|
+
@app.call(env)
|
71
75
|
end
|
72
|
-
|
73
|
-
@app.call(env)
|
74
76
|
end
|
75
77
|
|
76
78
|
private
|
data/lib/logtail-rack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logtail-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logtail
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logtail
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.3.3
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Logtail integration for Rack
|