nexaas-auditor 1.0.2 → 1.0.3

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: 97c934a97ebfb5dfdab737c7c4a6807c8e70cdd9
4
- data.tar.gz: eb88338679bc55d16e301b2bc131d859fd2b6441
3
+ metadata.gz: c08401a6d6365bf876971aa27083a52b05bd439d
4
+ data.tar.gz: d19eb0e9021bdc97b32f1798d4c540effbac9409
5
5
  SHA512:
6
- metadata.gz: 1820f36fadcb65604c15b7160b62009fe77d525fd976c5342bffc0d74678a9f7f04a88e52855e2aab86211604a232cfaf8eddd2ce2cf8ad2b93eb9a9eff31e62
7
- data.tar.gz: f1b006f1a0608ea35d092c8685073f9daaac92cb07665f5137272b57ae967377aa72f1a97d0e83126f5cac71fe977494ef60330bf5be1de1a87fc08a6234f9da
6
+ metadata.gz: 3f912ad859cfe4342e3ae78a884cec21ad7641b3424faaea3c740d1f35cb6e043a866b0d603bcc75b9af344dd5ccf58eaea7419efd40d09c1d852ae706fd9255
7
+ data.tar.gz: a709f06fac327e6c2b41908b397d36237b3a86f8cf152d9684242944f4bc135bfb80375e5246161b9d716c7a23c8fe75c8926197a155a509b6d43533164d753c
data/README.md CHANGED
@@ -70,6 +70,10 @@ Nexaas::Auditor.configure do |config|
70
70
  end
71
71
  end
72
72
 
73
+ # make sure all subscribers are loaded before subscribing below
74
+ Dir[Rails.root.join("app/loggers/*.rb")].each { |f| require f }
75
+ Dir[Rails.root.join("app/statistics/*.rb")].each { |f| require f }
76
+
73
77
  # setup all subscribers
74
78
  Nexaas::Auditor.subscribe_all
75
79
  ```
data/TODO.md CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  Tasks yet to be done, in order of importance. Feel free to help out ;-)
4
4
 
5
- - Only require [Nunes](https://github.com/jnunemaker/nunes) gem if the configuration says `track_rails_events = true`, and "fail fast" if `Nunes` is not loaded
6
- - Only require [StatHat](https://github.com/patrickxb/stathat) gem if the configuration says `statistics_service = 'stathat'`, and "fail fast" if `StatHat` is not loaded
7
- - Extract log formating logic out of Nexaas::Auditor::AuditLogger into a proper log formating class
8
- - Add possibility of supporting more log formats (currently only logfmt format is supported)
9
- - Add options to limit the metrics subscribed by default when `track_rails_events = true`; by default [Nunes](https://github.com/jnunemaker/nunes) sends **a lot** of metrics, some of them may not be so useful and end up "polluting" the statistics service (or, more importantly, cost unnecessary money if the service restricts the number of metrics created)
10
- - Add more statistic services support ([Instrumental](https://instrumentalapp.com/), [self-hosted StatsD](https://github.com/etsy/statsd), [Librato](https://www.librato.com/), [DataDoc](https://www.datadoghq.com/), etc)
5
+ - Figure out a way to make sure all app-level subscribers (subclasses of `Nexaas::Auditor::LogsSubscriber` and `Nexaas::Auditor::StatsSubscriber`) are loaded by Rails before calling `Nexaas::Auditor.subscribe_all` automatically, without having to require them manually first.
6
+ - Only require [Nunes](https://github.com/jnunemaker/nunes) gem if the configuration says `track_rails_events = true`, and "fail fast" if `Nunes` is not loaded.
7
+ - Only require [StatHat](https://github.com/patrickxb/stathat) gem if the configuration says `statistics_service = 'stathat'`, and "fail fast" if `StatHat` is not loaded.
8
+ - Extract log formating logic out of Nexaas::Auditor::AuditLogger into a proper log formating class.
9
+ - Add possibility of supporting more log formats (currently only logfmt format is supported).
10
+ - Add options to limit the metrics subscribed by default when `track_rails_events = true`; by default [Nunes](https://github.com/jnunemaker/nunes) sends **a lot** of metrics, some of them may not be so useful and end up "polluting" the statistics service (or, more importantly, cost unnecessary money if the service restricts the number of metrics created).
11
+ - Add more statistic services support ([Instrumental](https://instrumentalapp.com/), [self-hosted StatsD](https://github.com/etsy/statsd), [Librato](https://www.librato.com/), [DataDoc](https://www.datadoghq.com/), etc).
11
12
  - Separate the audit logging part from the statistics tracking part, maybe in separate gems as well, but in a way that they could just as easily be all used togheter and share common code.
12
13
  - Separate the bussiness-logic statistics tracking part from the Rails (Nunes) statistics tracking, maybe in separate gems as well, but in a way that they could just as easily be all used togheter and share common code.
14
+ - Separeate log-formatting logic into a gem, that requires and uses lograge, etc, and is compatible with the Rails logger and also Sidekiq, RPush and other common gems and etc.
@@ -5,6 +5,7 @@ module Nexaas
5
5
  class Subscriber
6
6
 
7
7
  def self.subscribe_all
8
+ validate_subclasses!
8
9
  subscribers = []
9
10
  subclasses.each do |klass|
10
11
  subscribers << klass.subscribe()
@@ -35,6 +36,13 @@ module Nexaas
35
36
  raise "Not Implemented, override in subclass."
36
37
  end
37
38
 
39
+ # raise error if no app-level subclasses (of StatsSubscriber and
40
+ # LogsSubscriber) are found.
41
+ def self.validate_subclasses!
42
+ raise RuntimeError,
43
+ "no subclasses of #{self} found!" if subclasses.empty?
44
+ end
45
+
38
46
  end
39
47
  end
40
48
  end
@@ -1,5 +1,5 @@
1
1
  module Nexaas
2
2
  module Auditor
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexaas-auditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Tassinari de Oliveira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler