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 +4 -4
- data/lib/hallmonitor/outputters/new_relic.rb +30 -0
- data/lib/hallmonitor/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa7771b4a13639ff7de87b023e02772dedc74f8f
|
4
|
+
data.tar.gz: f695b69bda1f8528ee71a50244ddd54770a605c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/hallmonitor/version.rb
CHANGED
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.
|
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-
|
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
|