opentsdb-ruby 0.0.7 → 0.0.8
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/opentsdb.rb +5 -1
 - data/lib/opentsdb/client.rb +5 -4
 - data/lib/opentsdb/faraday.rb +4 -3
 - data/lib/opentsdb/version.rb +1 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 396a2a052ae0d82b4274013863dad2facd4b721a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bcbb297f74620263b1c9d898760ed0b12459e416
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bec700d46ca429c3ff43472a2fd113bbe08336864853e06addb1fe65d5e08ff9377c841c474dca1b8c1b958b4add9b70a9921a3e1e159612c43ce1eef5e6bba4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 478d12399e15128b99d7e7b8e16f09df53ab759b051a4c2329cbbe900ac1e60bd696bfde52c1a768ea04456a6971d76fffcf36845f32563c6e8d7e0e562f0155
         
     | 
    
        data/lib/opentsdb.rb
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            module Opentsdb
         
     | 
| 
       3 
3 
     | 
    
         
             
              #:nodoc:
         
     | 
| 
       4 
4 
     | 
    
         
             
              class << self
         
     | 
| 
       5 
     | 
    
         
            -
                attr_accessor :host, :port, :logger
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :host, :port, :logger, :options
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                def configure
         
     | 
| 
       8 
8 
     | 
    
         
             
                  yield self
         
     | 
| 
         @@ -16,6 +16,10 @@ module Opentsdb 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  @port || 4242
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
      
 19 
     | 
    
         
            +
                def options
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @options || {}
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       19 
23 
     | 
    
         
             
                def reset
         
     | 
| 
       20 
24 
     | 
    
         
             
                  @host = nil
         
     | 
| 
       21 
25 
     | 
    
         
             
                  @port = nil
         
     | 
    
        data/lib/opentsdb/client.rb
    CHANGED
    
    | 
         @@ -5,14 +5,15 @@ module Opentsdb 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
                def_instance_delegators :@faraday, :post
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
                attr_reader :host, :port
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :host, :port, :query_options
         
     | 
| 
       9 
9 
     | 
    
         
             
                attr_accessor :query_commads
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                def initialize(options = {})
         
     | 
| 
       12 
12 
     | 
    
         
             
                  @host = options.delete(:host) || Opentsdb.host
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @port = options.delete(:port) || Opentsdb.port
         
     | 
| 
       14 
     | 
    
         
            -
                  @ 
     | 
| 
       15 
     | 
    
         
            -
                  @ 
     | 
| 
      
 14 
     | 
    
         
            +
                  @query_options = options.merge(Opentsdb.options)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @faraday = Opentsdb::Faraday.new(query_url, @query_options)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @query_commads = parse_queries
         
     | 
| 
       16 
17 
     | 
    
         
             
                end
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
                def query
         
     | 
| 
         @@ -29,7 +30,7 @@ module Opentsdb 
     | 
|
| 
       29 
30 
     | 
    
         
             
                  end
         
     | 
| 
       30 
31 
     | 
    
         
             
                end
         
     | 
| 
       31 
32 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                def parse_queries 
     | 
| 
      
 33 
     | 
    
         
            +
                def parse_queries
         
     | 
| 
       33 
34 
     | 
    
         
             
                  [].tap do |qs|
         
     | 
| 
       34 
35 
     | 
    
         
             
                    query_options[:q].split(';').each do |q|
         
     | 
| 
       35 
36 
     | 
    
         
             
                      query = QueryParser.parse(q)
         
     | 
    
        data/lib/opentsdb/faraday.rb
    CHANGED
    
    | 
         @@ -2,7 +2,8 @@ require 'faraday' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            module Opentsdb
         
     | 
| 
       3 
3 
     | 
    
         
             
              # :nodoc:
         
     | 
| 
       4 
4 
     | 
    
         
             
              class Faraday
         
     | 
| 
       5 
     | 
    
         
            -
                attr_reader :url
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_reader :url, :options
         
     | 
| 
      
 6 
     | 
    
         
            +
                DEFAULT_TIMEOUT = 5
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
                def initialize(url, options = {})
         
     | 
| 
       8 
9 
     | 
    
         
             
                  @url = url
         
     | 
| 
         @@ -13,8 +14,8 @@ module Opentsdb 
     | 
|
| 
       13 
14 
     | 
    
         
             
                  connection.post do |req|
         
     | 
| 
       14 
15 
     | 
    
         
             
                    req.headers         = headers
         
     | 
| 
       15 
16 
     | 
    
         
             
                    req.body            = body
         
     | 
| 
       16 
     | 
    
         
            -
                    req.options.timeout =  
     | 
| 
       17 
     | 
    
         
            -
                    req.options.open_timeout =  
     | 
| 
      
 17 
     | 
    
         
            +
                    req.options.timeout = options[:timeout] || DEFAULT_TIMEOUT
         
     | 
| 
      
 18 
     | 
    
         
            +
                    req.options.open_timeout = options[:open_timeout] || DEFAULT_TIMEOUT
         
     | 
| 
       18 
19 
     | 
    
         
             
                  end
         
     | 
| 
       19 
20 
     | 
    
         
             
                end
         
     | 
| 
       20 
21 
     | 
    
         | 
    
        data/lib/opentsdb/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: opentsdb-ruby
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - lizhe
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2017-01-09 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: faraday
         
     | 
| 
         @@ -17,14 +17,14 @@ dependencies: 
     | 
|
| 
       17 
17 
     | 
    
         
             
                requirements:
         
     | 
| 
       18 
18 
     | 
    
         
             
                - - ~>
         
     | 
| 
       19 
19 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       20 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 20 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
       21 
21 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       22 
22 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       23 
23 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       24 
24 
     | 
    
         
             
                requirements:
         
     | 
| 
       25 
25 
     | 
    
         
             
                - - ~>
         
     | 
| 
       26 
26 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       27 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 27 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
       28 
28 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       29 
29 
     | 
    
         
             
              name: rake
         
     | 
| 
       30 
30 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |