timber 1.1.8 → 1.1.9

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
  SHA1:
3
- metadata.gz: 3c9b324e70feb9ff1373222ba8a5f713a7c3137a
4
- data.tar.gz: 73ec3459c15d1a9438f762c9aec975eefd1e2852
3
+ metadata.gz: cbe987d8fbffcd959912acd47bdca88392cb6639
4
+ data.tar.gz: 80f5e3d9615a6a1d31f0bf29708a9f14b32f4698
5
5
  SHA512:
6
- metadata.gz: ac167d0a6d8ae1f7968d3df367203d75df9405f26dd89d6d4bb6a0641182f45d6290c771f187099f6858633f593bac5d49da086fc1b35b4028745c377385ae98
7
- data.tar.gz: 9b6d80aae0f5f44c821ea73f00ff9418e2656b52d007840c292f189182b4480e6b9907beae8bf365ace3d255f68494ac36668a84a9d40ab34f17ca51fa2ed302
6
+ metadata.gz: 46c5cf19a12a27e92a8891b340af164429e6983343cfcd2dfb013ebfc167dd714863874ece6350619a7c58a6253cf44059b8d903249ffb35419b5b3d6b027523
7
+ data.tar.gz: 4f8e29cef3c8337df09f6c05541a67f00f89312eedccc667c692bf0afb7d6d08b9578e361346a336e343c270f25403214f07c7f2ce226e3b2f1bdb6e3195b295
@@ -4,9 +4,9 @@ module Timber
4
4
  #
5
5
  # @note This event should be installed automatically through probes,
6
6
  # such as the {Probes::ActionControllerLogSubscriber} probe.
7
- class HTTPRequest < Timber::Event
7
+ class HTTPServerRequest < Timber::Event
8
8
  attr_reader :host, :method, :path, :port, :query_params, :content_type,
9
- :remote_addr, :referrer, :request_id, :user_agent
9
+ :remote_addr, :referrer, :request_id, :scheme, :user_agent
10
10
 
11
11
  def initialize(attributes)
12
12
  @host = attributes[:host] || raise(ArgumentError.new(":host is required"))
@@ -18,13 +18,14 @@ module Timber
18
18
  @remote_addr = attributes[:remote_addr]
19
19
  @referrer = attributes[:referrer]
20
20
  @request_id = attributes[:request_id]
21
+ @scheme = attributes[:scheme] || raise(ArgumentError.new(":scheme is required"))
21
22
  @user_agent = attributes[:user_agent]
22
23
  end
23
24
 
24
25
  def to_hash
25
26
  {host: host, method: method, path: path, port: port, query_params: query_params,
26
27
  headers: {content_type: content_type, remote_addr: remote_addr, referrer: referrer,
27
- request_id: request_id, user_agent: user_agent}}
28
+ request_id: request_id, scheme: scheme, user_agent: user_agent}}
28
29
  end
29
30
  alias to_h to_hash
30
31
 
@@ -4,7 +4,7 @@ module Timber
4
4
  #
5
5
  # @note This event should be installed automatically through probes,
6
6
  # such as the {Probes::ActionControllerLogSubscriber} probe.
7
- class HTTPResponse < Timber::Event
7
+ class HTTPServerResponse < Timber::Event
8
8
  attr_reader :status, :time_ms, :additions
9
9
 
10
10
  def initialize(attributes)
@@ -33,7 +33,7 @@ module Timber
33
33
  status = extract_status(exception_class_name)
34
34
  end
35
35
 
36
- Events::HTTPResponse.new(
36
+ Events::HTTPServerResponse.new(
37
37
  status: status,
38
38
  time_ms: event.duration,
39
39
  additions: additions
@@ -23,7 +23,7 @@ module Timber
23
23
  def http_request_event(request)
24
24
  # No idea why rails 3.X returns a "/" :/
25
25
  referrer = request.referer == "/" ? nil : request.referer
26
- Events::HTTPRequest.new(
26
+ Events::HTTPServerRequest.new(
27
27
  host: request.host,
28
28
  method: request.request_method,
29
29
  path: request.filtered_path,
@@ -33,6 +33,7 @@ module Timber
33
33
  remote_addr: request.ip,
34
34
  referrer: referrer,
35
35
  request_id: request_id(request.env),
36
+ scheme: request.scheme,
36
37
  user_agent: request.user_agent
37
38
  )
38
39
  end
@@ -1,3 +1,3 @@
1
1
  module Timber
2
- VERSION = "1.1.8"
2
+ VERSION = "1.1.9"
3
3
  end
@@ -2,7 +2,7 @@ require "rails"
2
2
 
3
3
  # Defualt the rails logger to nothing, each test shoould be
4
4
  # responsible for setting up the logger
5
- logger = ::Logger.new(STDOUT)
5
+ logger = ::Logger.new(nil) # change to STDOUT to see rails logs
6
6
  Rails.logger = logger
7
7
 
8
8
  class RailsApp < Rails::Application
@@ -39,7 +39,7 @@ describe Timber::Probes::RailsRackLogger do
39
39
  allow_any_instance_of(::Rails::Rack::Logger).to receive(:logger).and_return(logger)
40
40
  dispatch_rails_request("/rails_rack_logger")
41
41
  expect(io.string).to start_with("Started GET \"/rails_rack_logger\" for 123.456.789.10 @metadata {\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\"")
42
- expect(io.string).to include("\"event\":{\"server_side_app\":{\"http_server_request\":{\"host\":\"example.org\",\"method\":\"GET\",\"path\":\"/rails_rack_logger\",\"port\":80,\"headers\":{\"remote_addr\":\"123.456.789.10\",\"request_id\":\"unique-request-id-1234\"}}}")
42
+ expect(io.string).to include("\"event\":{\"server_side_app\":{\"http_server_request\":{\"host\":\"example.org\",\"method\":\"GET\",\"path\":\"/rails_rack_logger\",\"port\":80,\"headers\":{\"remote_addr\":\"123.456.789.10\",\"request_id\":\"unique-request-id-1234\",\"scheme\":\"http\"}}}")
43
43
  end
44
44
  end
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timber Technologies, Inc.