wavefront-client 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTRlNTkwNWI5ODhjNTRiOWNjMTEyZGZiZGQ0Y2ZlZmRjNzM3NzMyNg==
4
+ OGE3NGYzMDI5YjZjZmY0NDM0ZDg4ZDViYjhkNGM1MzljNTMwOWM2ZA==
5
5
  data.tar.gz: !binary |-
6
- NTZlODRjMDBmY2UzNTYwZTNmZDRlZmFmNmY4N2NhZTU5ZTg3ZmJjMw==
6
+ OGI1YjVhNjExY2JjNzM4NDg4ZmVjNzljNTEwNjU1ZWMxNmRhMTVlOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTUxZjkzNjAwMDBlNTU4MmMwNTc4ZmMwM2E2N2MyMjk4MjRhYzRiZDNjZGM1
10
- NmZkYmJiOTA3MTY0MDkxMDQ3ZmU2MjAxMDgyOTJhMmZiOTcwYjIwODQ2ZGM1
11
- N2FiMTBhMWU1OGMxMjdhODNhZDNiYmVhZjE4OGY0ZjRmZTNmZjk=
9
+ ZmNhMDAxMGZkMTZiNjQ4ZmFlMDcyNTQyMTk4ZmEyYjNhMDhlYjFlZDcyNGNk
10
+ YWU0Y2Y2YTNjZThmZWQyMDg0MTQxZGI5MWUwMjVjN2U1NDllODgxZWQ1OWNj
11
+ Mzg5ZDQ3MDBhYmVjZWViNGM4ZTM0Nzg3ZGRlODdlZTRlZTgxNTE=
12
12
  data.tar.gz: !binary |-
13
- ZGUyMDFhMzc3YjdkNzFhMmZiMGQxM2E2YmRlMGU4ZjUzMTM3MjFmNGU1NDM5
14
- ZGU1OTUyNTU4NWM1MmNiOTdiZmU4OTU2MGE1ZjlhZjQxZjAzMWM3MTIyMjU2
15
- NDk2OTcyNTU5ZjNkYjI3NjIwODM2NDNhOTcwMGE5MGYxZmNhMzg=
13
+ MTg3NTVlOGQzOTY4NTg3MDM5OTYzNzAyYWJkZGFiNDZlY2NkNTE3NTRmY2Fk
14
+ ODkxYmVmNTI0YWRhZDEwNTY1YmZhYjRjNzY3NjdmZWM2YmVhNTAyOWI3NjRm
15
+ MGY4YjBjYWZkMTYxOTg0ZGM5MTM2NmQ1NTdkNGYxMzM1YTY1NTA=
data/README.md CHANGED
@@ -93,7 +93,21 @@ response = wave.query('<TS_EXPRESSION>', 'm', {:start_time => Time.now - 86400,
93
93
  * `:end_time` - And object of class `Time` that specifies the query end time. Default: `Time.now`.
94
94
  * `:response_format` `[ :raw, :ruby, :graphite, :highcharts ]` - See the section "Response Classes" below. Default: `:raw`.
95
95
  * `:prefix_length` - Used when performing schema manipulations. See the Graphite response format below. Default `1`.
96
-
96
+ * `:strict` - originally Wavefront would return data points
97
+ either side of the requested range. These extra points are
98
+ required by the UI, but when you use the API you almost
99
+ certainly don't want them. In Wavefront 2.4, an API parameter
100
+ `strict` was introduced, which removes this padding. By
101
+ default we set this to `true`, so you will get back exactly
102
+ the range you request with `:start_time` and `:end_time`. If
103
+ you wish to have the old behaviour, set this to `false`.
104
+ * `:passthru` - as Wavefront develops it is hard to keep pace with
105
+ the API changes and cover everything in the SDK. The `passthru`
106
+ hash lets you pass parameters directly to the Wavefront API.
107
+ Thus you can set things like `summarization`, or `listMode`
108
+ directly, without having to implement them explicity in the SDK.
109
+ Obviously no type-checking is done to the `passthru` hash, so
110
+ refer to the Wavefront API docs, and use it with caution.
97
111
 
98
112
  ### Response Classes
99
113
  The `query` method returns a sub-class of `Wavefront::Response`. By default this is `Wavefront::Response::Raw`, which is the raw String returned from the API. By including the `:response_format` key in the options hash when calling the query method you can receive responses as a number of other classes.
@@ -16,6 +16,6 @@ See the License for the specific language governing permissions and
16
16
 
17
17
  module Wavefront
18
18
  class Client
19
- VERSION = "1.0.3"
19
+ VERSION = "1.1.0"
20
20
  end
21
21
  end
@@ -1,4 +1,4 @@
1
- =begin
1
+ =begin
2
2
  Copyright 2015 Wavefront Inc.
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ module Wavefront
28
28
  DEFAULT_PATH = '/chart/api'
29
29
  DEFAULT_FORMAT = :raw
30
30
  DEFAULT_PREFIX_LENGTH = 1
31
+ DEFAULT_STRICT = true
31
32
  FORMATS = [ :raw, :ruby, :graphite, :highcharts ]
32
33
  GRANULARITIES = %w( s m h d )
33
34
 
@@ -45,6 +46,7 @@ module Wavefront
45
46
  options[:start_time] ||= options[:end_time] - DEFAULT_PERIOD_SECONDS
46
47
  options[:response_format] ||= DEFAULT_FORMAT
47
48
  options[:prefix_length] ||= DEFAULT_PREFIX_LENGTH
49
+ options[:strict] = DEFAULT_STRICT unless options.keys.include?(:strict)
48
50
 
49
51
  [ options[:start_time], options[:end_time] ].each { |o| raise Wavefront::Exception::InvalidTimeFormat unless o.is_a?(Time) }
50
52
  raise Wavefront::Exception::InvalidGranularity unless GRANULARITIES.include?(granularity)
@@ -53,7 +55,15 @@ module Wavefront
53
55
 
54
56
  args = {:params =>
55
57
  {:q => query, :g => granularity, :n => 'Unknown',
56
- :s => options[:start_time].to_i, :e => options[:end_time].to_i}}.merge(@headers)
58
+ :s => options[:start_time].to_i,
59
+ :e => options[:end_time].to_i,
60
+ :strict => options[:strict],
61
+ }}.merge(@headers)
62
+
63
+ if options[:passthru]
64
+ args[:params].merge!(options[:passthru])
65
+ end
66
+
57
67
  response = RestClient.get @base_uri.to_s, args
58
68
 
59
69
  klass = Object.const_get('Wavefront').const_get('Response').const_get(options[:response_format].to_s.capitalize)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Pointer
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-09-02 00:00:00.000000000 Z
15
+ date: 2015-12-01 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler