librato-metrics 2.1.0.beta → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -3,10 +3,10 @@ sudo: false
3
3
 
4
4
  rvm:
5
5
  - 1.9.3
6
- - 2.1.7
7
- - 2.2.3
8
- - 2.3.0
9
- - 2.3.1
6
+ - 2.1.10
7
+ - 2.2.6
8
+ - 2.3.3
9
+ - 2.4.0
10
10
  - jruby-19mode
11
11
  # - rbx
12
12
  - ruby-head
@@ -1,8 +1,11 @@
1
1
  ## Changelog
2
2
 
3
- ### Version 2.1.0.beta
3
+ ### Version 2.1.0
4
4
  * Add support for tagged measurements (#121)
5
5
 
6
+ ### Version 2.0.2
7
+ * Filter sensitive headers in exception output (#130, Yannick Schutz)
8
+
6
9
  ### Version 2.0.1
7
10
  * Fix SmartJSON delegation bug for ruby 2.3.1 (#123)
8
11
 
data/README.md CHANGED
@@ -184,6 +184,31 @@ Both options are driven by the addition of measurements. *If you are adding meas
184
184
 
185
185
  If your goal is to collect metrics every _x_ seconds and submit them, [check out this code example](https://github.com/librato/librato-metrics/blob/master/examples/submit_every.rb).
186
186
 
187
+ ## Submitting tagged measurements
188
+
189
+ Librato Metrics supports tagged measurements that are associated with a metric, one or more tag pairs, and a point in time.
190
+
191
+ **Tags** are a set of name=value tag pairs that describe the particular data stream. Tags behave as extra dimensions that data streams can be filtered and aggregated along.
192
+
193
+ ### Top-Level Tags
194
+
195
+ You can initialize `Queue` and/or `Aggregator` with top-level tags that will be applied to every measurement:
196
+
197
+ ```ruby
198
+ queue = Librato::Metrics::Queue.new(tags: { service: 'auth', environment: 'prod', host: 'auth-prod-1' })
199
+ queue.add my_metric: 10
200
+ ```
201
+
202
+ ### Per-Measurement Tags
203
+
204
+ Optionally, you can submit per-measurement tags by passing a tags Hash when adding measurements:
205
+
206
+ ```ruby
207
+ queue.add my_other_metric: { value: 25, tags: { db: 'rr1' } }
208
+ ```
209
+
210
+ For more information, visit the [API documentation](https://www.librato.com/docs/api/#create-a-measurement).
211
+
187
212
  ## Querying Metrics
188
213
 
189
214
  Get name and properties for all metrics you have in the system:
@@ -216,9 +241,26 @@ Get the 5 minute moving average for `temperature` for the last hour, assuming te
216
241
 
217
242
  data = Librato::Metrics.get_composite 'moving_average(mean(series("temperature", "*"), {size: "5"}))', start_time: Time.now.to_i - 60*60, resolution: 300
218
243
 
219
- There are many more options supported for querying, take a look at the
244
+ There are many more options supported for querying, take a look at the
220
245
  [REST API docs](https://www.librato.com/docs/api/#retrieve-metrics) or the individual method documentation for more details.
221
246
 
247
+ ## Retrieving tagged measurements (beta)
248
+
249
+ Get the series for `exceptions` in **production** grouped by **sum** within the **last hour**:
250
+
251
+ ```ruby
252
+ query = {
253
+ resolution: 1,
254
+ duration: 3600,
255
+ group_by: "environment",
256
+ group_by_function: "sum",
257
+ tags_search: "environment=prod*"
258
+ }
259
+ Librato::Metrics.get_series :exceptions, query
260
+ ```
261
+
262
+ For more information, visit the [API documentation](https://www.librato.com/docs/api/#retrieve-a-measurement).
263
+
222
264
  ## Setting Metric Properties
223
265
 
224
266
  Setting custom [properties](https://www.librato.com/docs/api/#metric-attributes) on your metrics is easy:
@@ -292,4 +334,4 @@ We also maintain a set of [examples of common uses](https://github.com/librato/l
292
334
 
293
335
  ## Copyright
294
336
 
295
- Copyright (c) 2011-2015 [Librato Inc.](http://librato.com) See LICENSE for details.
337
+ Copyright (c) 2011-2016 [Librato Inc.](http://librato.com) See LICENSE for details.
@@ -1,20 +1,20 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDLjCCAhagAwIBAgIBADANBgkqhkiG9w0BAQUFADA9MQ0wCwYDVQQDDARtYXR0
2
+ MIIDLjCCAhagAwIBAgIBADANBgkqhkiG9w0BAQUFADA9MQ0wCwYDVQQDDARydWJ5
3
3
  MRcwFQYKCZImiZPyLGQBGRYHbGlicmF0bzETMBEGCgmSJomT8ixkARkWA2NvbTAe
4
- Fw0xNTEwMTIyMjA0MzVaFw0xNjEwMTEyMjA0MzVa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0BAQEFAAOCAQ8AMIIBCgKCAQEA58LirwsWnKL1uuClQ0uwA1XL
7
+ GpxDuFzSosipiPkzZY3hiHazC8SHDREZQXlm7ITX/o+dueNoB7dt0BR3RPVipH7V
8
+ 7cvbCUaZNjEXR5Lal6PsmUsbMTrddkvj3e7flmJv+kMj+teeJ7MDeJTU5wXXV9pD
9
+ ThiCDILJMF5CdP8Jru4rSBOP6RmmzYU+0cN5+5pt9xqrycA+Poo2ZuoUMCMsSBvl
10
+ PimM3PPvoWTuE41GTn/bLoOVoXQmdwZIbwUSVH8rCDjZSlttOst+xrBw4KG0dYUp
11
+ 2UvEe8iCyqEMQ8fEZ7EXuP2WMVICutFbz8Pt4hIMq+OTnDX+mIfma7GvPaKAFwID
12
+ AQABozkwNzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQBSxu9Jj4VTrXTpLujPwk9Kzwp
13
+ 2jALBgNVHQ8EBAMCBLAwDQYJKoZIhvcNAQEFBQADggEBACvNsw1pGv72xp3LiDlZ
14
+ 0tphNP/85RcYyJMklslG3tIYblyo71xHW1UbK5ArUK6k0BN43MuDn3pqLJQttVmi
15
+ bUdA3yYi13GeSrrAMlr4nH8Yt/Bn/XpZGliouJUBwh1BjG6dSj1iuR4/9pt9/LtO
16
+ QTdIc+07qGspypT0Uh/w/BodEcGuAaZZFlkU9vottTe6wWNnM6hfRExiSIsr+oVe
17
+ s8s83ObshjuSzjOqS56IBtNlPEL+D6ghjZZLP3lS6l9p70Pcpcl+IcE4veqZmmKC
18
+ sGepgRclC6UbZh+yQ3alXVghM2qsonAwI/rTNmFJN9kQn6nP9+f1Uf/qZFNcjn4L
19
+ 9bg=
20
20
  -----END CERTIFICATE-----
@@ -5,25 +5,34 @@ module Librato
5
5
  class ExpectsStatus < Faraday::Response::Middleware
6
6
 
7
7
  def on_complete(env)
8
- # TODO: make exception output prettier
8
+ sanitized = sanitize_request(env)
9
9
  case env[:status]
10
10
  when 401
11
- raise Unauthorized.new(env.to_s, env)
11
+ raise Unauthorized.new(sanitized.to_s, sanitized)
12
12
  when 403
13
- raise Forbidden.new(env.to_s, env)
13
+ raise Forbidden.new(sanitized.to_s, sanitized)
14
14
  when 404
15
- raise NotFound.new(env.to_s, env)
15
+ raise NotFound.new(sanitized.to_s, sanitized)
16
16
  when 422
17
- raise EntityAlreadyExists.new(env.to_s, env)
17
+ raise EntityAlreadyExists.new(sanitized.to_s, sanitized)
18
18
  when 400..499
19
- raise ClientError.new(env.to_s, env)
19
+ raise ClientError.new(sanitized.to_s, sanitized)
20
20
  when 500..599
21
- raise ServerError.new(env.to_s, env)
21
+ raise ServerError.new(sanitized.to_s, sanitized)
22
22
  end
23
23
  end
24
24
 
25
+ def sanitize_request(env)
26
+ {
27
+ status: env.status,
28
+ url: env.url.to_s,
29
+ user_agent: env.request_headers["User-Agent"],
30
+ request_body: env[:request_body],
31
+ response_headers: env.response_headers,
32
+ response_body: env.body
33
+ }
34
+ end
25
35
  end
26
-
27
36
  end
28
37
  end
29
- end
38
+ end
@@ -1,5 +1,5 @@
1
1
  module Librato
2
2
  module Metrics
3
- VERSION = "2.1.0.beta"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.description = "An easy to use ruby wrapper for Librato's Metrics API"
18
18
 
19
19
  s.authors = ["Matt Sanders"]
20
- s.email = 'matt@librato.com'
20
+ s.email = ['matt@librato.com', 'ruby@librato.com']
21
21
  s.homepage = 'https://github.com/librato/librato-metrics'
22
22
 
23
23
  s.require_paths = %w[lib]
@@ -220,7 +220,7 @@ module Librato
220
220
  Metrics.submit foo: {type: :counter, value: 12}
221
221
  expect {
222
222
  Metrics.submit foo: 15 # submitting as gauge
223
- }.to raise_error
223
+ }.to raise_error(Librato::Metrics::ClientError)
224
224
  expect {
225
225
  Metrics.submit foo: {type: :counter, value: 17}
226
226
  }.not_to raise_error
@@ -273,7 +273,7 @@ module Librato
273
273
  attributes: {
274
274
  display_max: 1000
275
275
  }
276
- }.to raise_error
276
+ }.to raise_error(Librato::Metrics::ClientError)
277
277
  end
278
278
  end
279
279
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librato-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.beta
5
- prerelease: 6
4
+ version: 2.1.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matt Sanders
@@ -11,32 +11,32 @@ bindir: bin
11
11
  cert_chain:
12
12
  - !binary |-
13
13
  LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURMakNDQWhhZ0F3SUJB
14
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE5TVEwd0N3WURWUVFEREFSdFlY
15
- UjAKTVJjd0ZRWUtDWkltaVpQeUxHUUJHUllIYkdsaWNtRjBiekVUTUJFR0Nn
16
- bVNKb21UOGl4a0FSa1dBMk52YlRBZQpGdzB4TlRFd01USXlNakEwTXpWYUZ3
17
- MHhOakV3TVRFeU1qQTBNelZhTUQweERUQUxCZ05WQkFNTUJHMWhkSFF4CkZ6
14
+ Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE5TVEwd0N3WURWUVFEREFSeWRX
15
+ SjUKTVJjd0ZRWUtDWkltaVpQeUxHUUJHUllIYkdsaWNtRjBiekVUTUJFR0Nn
16
+ bVNKb21UOGl4a0FSa1dBMk52YlRBZQpGdzB4TnpBeE1URXhPREkzTURkYUZ3
17
+ MHhPREF4TVRFeE9ESTNNRGRhTUQweERUQUxCZ05WQkFNTUJISjFZbmt4CkZ6
18
18
  QVZCZ29Ka2lhSmsvSXNaQUVaRmdkc2FXSnlZWFJ2TVJNd0VRWUtDWkltaVpQ
19
19
  eUxHUUJHUllEWTI5dE1JSUIKSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4
20
- QU1JSUJDZ0tDQVFFQXZmTjhSbEFzVXMrSzVrSzQ2U2tocFlleQo1NG01Ylh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gvdy9Cb2RFY0d1QWFaWkZsa1U5dm90dFRlNndXTm5NNmhm
35
+ UkV4aVNJc3Irb1ZlCnM4czgzT2JzaGp1U3pqT3FTNTZJQnRObFBFTCtENmdo
36
+ alpaTFAzbFM2bDlwNzBQY3BjbCtJY0U0dmVxWm1tS0MKc0dlcGdSY2xDNlVi
37
+ WmgreVEzYWxYVmdoTTJxc29uQXdJL3JUTm1GSk45a1FuNm5QOStmMVVmL3Fa
38
+ Rk5jam40TAo5Ymc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
39
+ date: 2017-01-25 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday
@@ -71,7 +71,9 @@ dependencies:
71
71
  - !ruby/object:Gem::Version
72
72
  version: 0.2.2
73
73
  description: An easy to use ruby wrapper for Librato's Metrics API
74
- email: matt@librato.com
74
+ email:
75
+ - matt@librato.com
76
+ - ruby@librato.com
75
77
  executables: []
76
78
  extensions: []
77
79
  extra_rdoc_files:
@@ -141,9 +143,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
143
  required_rubygems_version: !ruby/object:Gem::Requirement
142
144
  none: false
143
145
  requirements:
144
- - - ! '>'
146
+ - - ! '>='
145
147
  - !ruby/object:Gem::Version
146
- version: 1.3.1
148
+ version: '0'
147
149
  requirements: []
148
150
  rubyforge_project:
149
151
  rubygems_version: 1.8.23.2
metadata.gz.sig CHANGED
Binary file