ocean-rails 2.2.1 → 2.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87e447d4f5093f7cafc67fd52f9fea8fe563f7c7
4
- data.tar.gz: b9d938fcd817ca784af0bb7278239166dc5e73df
3
+ metadata.gz: 6a249ef526086a2b4e138e5e54d3b1e634671b20
4
+ data.tar.gz: 3f3dc81fca5f468771891cdd1364d8de15af68c4
5
5
  SHA512:
6
- metadata.gz: 94c578ceaa77bae5eca755263d68434dbdf87c6b16ce57de1efac0e1a6c04b51b9b841fe3c15a69d10cdd8f512bbac65ad0da8f12b8b15210124ff52bc42d512
7
- data.tar.gz: dc87dfae698a8bb3aaef8000c40cce655db9820a3114555f626de5e47a6ef40e555ab0eec9d7735b2446ee99159d76f2f58554ea6586c8d9defaacb6bd76b3bb
6
+ metadata.gz: d2a2e8ba731cae49376517c6bd6ac2d25ee0fc7e0a19fce4deaf923c93eb24b43badff2ebc0599b6573d5493aa85d6732305ef9a77618af3a7add1fa8edd474c
7
+ data.tar.gz: 99218c4cf33998ad2e6cb5212d1fc0bfdefea34555591803f17eb467829aee4d6daab435f013d71e9de49d0a9b4fb917c4a3dea60d6d69817ea31d347b9dd75c
@@ -48,9 +48,14 @@ if Rails.env == 'production' && ENV['NO_ZEROMQ_LOGGING'].blank?
48
48
  data[:params] = params if params.present?
49
49
  data[:filter] = Thread.current[:filter] if Thread.current[:filter]
50
50
  data[:token] = Thread.current[:x_api_token] if Thread.current[:x_api_token].present?
51
+ data[:username] = Thread.current[:username] if Thread.current[:username].present?
52
+ data[:max_age] = Thread.current[:max_age] if Thread.current[:max_age].present?
51
53
 
52
54
  Thread.current[:logdata] = data
53
55
  Thread.current[:filter] = nil
56
+ Thread.current[:x_api_token] = nil
57
+ Thread.current[:username] = nil
58
+ Thread.current[:max_age] = nil
54
59
  end
55
60
  end
56
61
 
@@ -66,6 +66,8 @@ module OceanApplicationController
66
66
  if response.status == 200
67
67
  @auth_api_user_id = response.body['authentication']['user_id'] # Deprecate and remove
68
68
  @auth_api_user_uri = response.body['authentication']['_links']['creator']['href'] # Keep
69
+ Thread.current[:username] = response.body['authentication']['username']
70
+ Thread.current[:max_age] = response.body['authentication']['max_age']
69
71
  return true
70
72
  end
71
73
  error_messages = response.body['_api_error']
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "2.2.1"
2
+ VERSION = "2.3.1"
3
3
  end
@@ -1,3 +1,4 @@
1
+ data[:token] = Thread.current[:x_api_token] if Thread.current[:x_api_token].present?
1
2
  require 'socket'
2
3
 
3
4
  #
@@ -80,9 +81,11 @@ class ZeromqLogger
80
81
  service: APP_NAME,
81
82
  level: level
82
83
  }
83
- data = data.merge msg if msg.is_a?(Hash)
84
+ data[:token] = Thread.current[:x_api_token] if Thread.current[:x_api_token].present?
85
+ data[:username] = Thread.current[:username] if Thread.current[:username].present?
84
86
  data[:msg] = msg if msg.is_a?(String)
85
87
  data[:timestamp] = (Time.now.utc.to_f * 1000).to_i unless data[:timestamp]
88
+ data = data.merge msg if msg.is_a?(Hash)
86
89
  @logger.log data
87
90
  true
88
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson