metricsd 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use ree-1.8.7-2011.03@metricsd --create
1
+ rvm use ree@metricsd --create
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.2.6 (September 20, 2012)
2
+
3
+ Features:
4
+
5
+ - Added Client#record_status method
6
+
1
7
  ## 0.2.5 (November 16, 2011)
2
8
 
3
9
  Bugfixes:
@@ -46,4 +52,4 @@ Features:
46
52
  - Splits metrics to several packets of 250 bytes or less
47
53
  - Allows to specify metrics parts separator (temporary solution until all the metrics will be migrated to "." separator)
48
54
  - Logs network problems to logger and never throws errors like this.
49
- - 100% test coverage
55
+ - 100% test coverage
@@ -53,7 +53,7 @@ module Metricsd
53
53
  # number of seconds.
54
54
  #
55
55
  # It creates two metrics:
56
- # * +your.metric.count+ with counts of failed and succeded events
56
+ # * +your.metric.status+ with counts of failed and succeded events
57
57
  # * +your.metric.time+ with time statistics
58
58
  #
59
59
  # @param [String] metric is the metric name (like app.docs.upload)
@@ -75,7 +75,7 @@ module Metricsd
75
75
  # Record succeded boolean event.
76
76
  #
77
77
  # It creates a single metric:
78
- # * +your.metric.count+ with numbers of failed and succeded events
78
+ # * +your.metric.status+ with numbers of failed and succeded events
79
79
  #
80
80
  # @param [String] metric is the metric name (like app.docs.upload)
81
81
  # @param [Hash] opts options.
@@ -83,14 +83,14 @@ module Metricsd
83
83
  # @option opts [String] :source metric source.
84
84
  #
85
85
  def record_success(metric, opts = {})
86
- record_internal({"#{metric}.status" => 1}, opts)
86
+ record_status(metric, true, opts)
87
87
  end
88
88
  alias :success :record_success
89
89
 
90
90
  # Record failed boolean event.
91
91
  #
92
92
  # It creates a single metric:
93
- # * +your.metric.count+ with numbers of failed and succeded events
93
+ # * +your.metric.status+ with numbers of failed and succeded events
94
94
  #
95
95
  # @param [String] metric is the metric name (like app.docs.upload)
96
96
  # @param [Hash] opts options.
@@ -98,10 +98,26 @@ module Metricsd
98
98
  # @option opts [String] :source metric source.
99
99
  #
100
100
  def record_failure(metric, opts = {})
101
- record_internal({"#{metric}.status" => -1}, opts)
101
+ record_status(metric, false, opts)
102
102
  end
103
103
  alias :failure :record_failure
104
104
 
105
+ # Record status event (success or failure).
106
+ #
107
+ # It creates a single metric:
108
+ # * +your.metric.status+ with numbers of failed and succeded events
109
+ #
110
+ # @param [String] metric is the metric name (like app.docs.upload)
111
+ # @param [Boolean] is_success indicating whether event is successful.
112
+ # @param [Hash] opts options.
113
+ # @option opts [String] :group metrics group.
114
+ # @option opts [String] :source metric source.
115
+ #
116
+ def record_status(metric, is_success, opts = {})
117
+ record_internal({"#{metric}.status" => is_success ? 1 : -1}, opts)
118
+ end
119
+ alias :status :record_status
120
+
105
121
  # Record timing info. Time should be a floating point
106
122
  # number of seconds.
107
123
  #
@@ -219,7 +235,9 @@ module Metricsd
219
235
  # Sends a string to the MetricsD. Should never raise any network-specific
220
236
  # exceptions, but log them instead, and silently return.
221
237
  def safe_send(msg)
222
- collector_socket.send(msg, 0) if collector_socket
238
+ # Check if we could connect to the MetricsD
239
+ return false unless collector_socket
240
+ collector_socket.send(msg, 0)
223
241
  true
224
242
  rescue Errno::ECONNREFUSED => e
225
243
  Metricsd.logger.error("Exception occurred while trying to send data to MetricsD (#{Metricsd.server_host}:#{Metricsd.server_port}): #{e.inspect}")
@@ -1,3 +1,3 @@
1
1
  module Metricsd
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metricsd
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 5
10
- version: 0.2.5
9
+ - 6
10
+ version: 0.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dmytro Shteflyuk
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-16 00:00:00 -05:00
18
+ date: 2012-09-20 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  requirements: []
143
143
 
144
144
  rubyforge_project:
145
- rubygems_version: 1.3.7
145
+ rubygems_version: 1.5.2
146
146
  signing_key:
147
147
  specification_version: 3
148
148
  summary: Client library for MetricsD server