fozzie 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,19 +10,25 @@ module Fozzie
10
10
  class Configuration
11
11
  include Sys
12
12
 
13
- attr_accessor :env, :config_path, :host, :port, :appname, :namespaces, :timeout, :monitor_classes, :sniff_envs
13
+ attr_accessor :env, :config_path, :host, :port, :appname, :namespaces, :timeout, :monitor_classes, :sniff_envs, :ignore_prefix
14
14
 
15
15
  def initialize(args = {})
16
16
  merge_and_assign_config(args)
17
17
  self.origin_name
18
18
  end
19
19
 
20
+ def disable_prefix
21
+ @ignore_prefix = true
22
+ end
23
+
20
24
  # Returns the prefix for any stat requested to be registered
21
25
  def data_prefix
22
- s = [appname, origin_name, env].collect do |s|
26
+ return nil if @ignore_prefix
27
+
28
+ @data_prefix ||= [appname, origin_name, env].collect do |s|
23
29
  s.empty? ? nil : s.gsub('.', '-')
24
30
  end.compact.join('.').strip
25
- (s.empty? ? nil : s)
31
+ (@data_prefix.empty? ? nil : @data_prefix)
26
32
  end
27
33
 
28
34
  # Returns the origin name of the current machine to register the stat against
@@ -56,7 +62,8 @@ module Fozzie
56
62
  :namespaces => %w{Stats S Statistics Warehouse},
57
63
  :timeout => 0.5,
58
64
  :monitor_classes => [],
59
- :sniff_envs => [:development, :staging, :production]
65
+ :sniff_envs => [:development, :staging, :production],
66
+ :ignore_prefix => false
60
67
  }.dup
61
68
  end
62
69
 
data/lib/fozzie/socket.rb CHANGED
@@ -3,7 +3,7 @@ require 'socket'
3
3
  module Fozzie
4
4
  module Socket
5
5
 
6
- RESERVED_CHARS_REGEX = /[\:\|\@]/
6
+ RESERVED_CHARS_REGEX = /[\:\|\@\s]/
7
7
 
8
8
  private
9
9
 
@@ -1,3 +1,3 @@
1
1
  module Fozzie
2
- VERSION = "0.0.25"
2
+ VERSION = "0.0.26"
3
3
  end
@@ -84,4 +84,13 @@ describe Fozzie::Configuration do
84
84
 
85
85
  end
86
86
 
87
+ describe "ignoring prefix" do
88
+
89
+ it "does not use prefix when set to ignore" do
90
+ subject.disable_prefix
91
+ subject.ignore_prefix.should eq(true)
92
+ end
93
+
94
+ end
95
+
87
96
  end
@@ -166,4 +166,15 @@ describe Fozzie::Interface do
166
166
  end
167
167
  end
168
168
 
169
+ describe "without prefix" do
170
+
171
+ it "registers stats without app, etc" do
172
+ Fozzie.c.disable_prefix
173
+ subject.expects(:send_to_socket).with {|bin| bin.match(/^mystat/) }
174
+
175
+ subject.gauge("mystat", 99)
176
+ end
177
+
178
+ end
179
+
169
180
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fozzie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-15 00:00:00.000000000 Z
13
+ date: 2012-07-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sys-uname
@@ -262,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
262
  version: '0'
263
263
  segments:
264
264
  - 0
265
- hash: -3285934498168800248
265
+ hash: -2413055484564325442
266
266
  required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  none: false
268
268
  requirements:
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  segments:
273
273
  - 0
274
- hash: -3285934498168800248
274
+ hash: -2413055484564325442
275
275
  requirements: []
276
276
  rubyforge_project: fozzie
277
277
  rubygems_version: 1.8.24