hallmonitor 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59821e12e07570bd3f1228ee067960cc983b6b59
4
- data.tar.gz: 849bad68b337b8dd168be233ee7daf78158578ca
3
+ metadata.gz: aa7771b4a13639ff7de87b023e02772dedc74f8f
4
+ data.tar.gz: f695b69bda1f8528ee71a50244ddd54770a605c7
5
5
  SHA512:
6
- metadata.gz: e59406968fee011c43564926e26e090ddd27e6cc79d21433a6e06c2eff39dd07e58e50ad9caea32b21038b30b29a63b7eaa0454e2adbc8603cdc0c4d3ea69078
7
- data.tar.gz: a12b10c4dd56f4496db7f6a71b49b0c7e6ea7b0af67d4142276f470ea17b99174c846693be644696277582908ee117f0b56e4951332f58ed6f9705c269882849
6
+ metadata.gz: 225ea818ac8fd73e71b61e5b6cb69364db2857259feef11dc241a9010c6144f1778b2e57a78bcf94851a3d64ad6d720d7b14363b38f351bb704333c988106414
7
+ data.tar.gz: 647f56b728f3cadec74281bb41d6aee0e4cfa9a458e4e907be22d9bbca3248f9eadf28b48177c0a6e049b14da4ff90d8962316f45283d5051caa8a5fa8bbdfcc
@@ -0,0 +1,30 @@
1
+ module Hallmonitor
2
+ module Outputters
3
+ # Outputs events to NewRelic using their custom metrics API
4
+ class NewRelic < Outputter
5
+ # Initializes a new instance
6
+ # @raise String if {NewRelic::Agent} isn't defined (Library isn't loaded)
7
+ # @param prefix [String] String to prefix all metrics with
8
+ def initialize(prefix='')
9
+ raise "In order to use NewRelic, new_relic gem must be installed" unless defined?(::NewRelic::Agent)
10
+ super(prefix)
11
+ end
12
+
13
+ def process(event)
14
+ if(event.respond_to?(:duration))
15
+ ::NewRelic::Agent.record_metric(new_relic_name(event), event.duration)
16
+ elsif(event.respond_to?(:value))
17
+ ::NewRelic::Agent.record_metric(new_relic_name(event), event.value)
18
+ else
19
+ ::NewRelic::Agent.increment_metric(new_relic_name(event), event.count)
20
+ end
21
+ end
22
+
23
+ private
24
+ # Formats the event name into the naming scheme that NewRelic expects
25
+ def new_relic_name(event)
26
+ "Custom/#{event.name.gsub('.','/')}"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,8 +1,8 @@
1
1
  module Hallmonitor
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
5
- PATCH = 1
4
+ MINOR = 2
5
+ PATCH = 0
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR,MINOR,PATCH,BUILD].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hallmonitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris TenHarmsel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-31 00:00:00.000000000 Z
11
+ date: 2014-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -144,6 +144,7 @@ files:
144
144
  - lib/hallmonitor/monitored.rb
145
145
  - lib/hallmonitor/outputter.rb
146
146
  - lib/hallmonitor/outputters/iooutputter.rb
147
+ - lib/hallmonitor/outputters/new_relic.rb
147
148
  - lib/hallmonitor/outputters/statsd_outputter.rb
148
149
  - lib/hallmonitor/timed_event.rb
149
150
  - lib/hallmonitor/version.rb