newrelic-elasticsearch 0.1.2 → 0.2.0
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/README.md +2 -2
- data/Rakefile +1 -0
- data/lib/newrelic/elasticsearch/operation_resolver.rb +19 -5
- data/lib/newrelic/elasticsearch/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ff0277a9cfce36ea2c9b420c4cdf50b8f53e5a36
         | 
| 4 | 
            +
              data.tar.gz: 32221514a558e500a6d490e876d7fb398420343c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c66bbacecbcddf4d70e3b379e32967f28f9c3ddd9b2dc724a2c26040d60eb9c49e089f5bcb13fd3fde2dc8b1ab3c6705da81f0c9c44c918f179635b4e6ab5eaf
         | 
| 7 | 
            +
              data.tar.gz: e52cc838ced416aca539c40354c01ac78ce1fc1d189dc34465d769a76c78d79e436cedb284e50a714895d03485bbd34f4fea3b8c01eabfb0772132f5f9849374
         | 
    
        data/README.md
    CHANGED
    
    | @@ -9,7 +9,7 @@ to Elasticsearch queries. | |
| 9 9 | 
             
            Add this line to your application's Gemfile:
         | 
| 10 10 |  | 
| 11 11 | 
             
            ```ruby
         | 
| 12 | 
            -
            gem ' | 
| 12 | 
            +
            gem 'newrelic-elasticsearch'
         | 
| 13 13 | 
             
            ```
         | 
| 14 14 |  | 
| 15 15 | 
             
            And then execute:
         | 
| @@ -18,7 +18,7 @@ And then execute: | |
| 18 18 |  | 
| 19 19 | 
             
            Or install it yourself as:
         | 
| 20 20 |  | 
| 21 | 
            -
                $ gem install  | 
| 21 | 
            +
                $ gem install newrelic-elasticsearch
         | 
| 22 22 |  | 
| 23 23 | 
             
            ## Usage
         | 
| 24 24 |  | 
    
        data/Rakefile
    CHANGED
    
    
| @@ -1,4 +1,15 @@ | |
| 1 1 | 
             
            class NewRelic::ElasticsearchOperationResolver
         | 
| 2 | 
            +
              module Inflector
         | 
| 3 | 
            +
                refine String do
         | 
| 4 | 
            +
                  def legalize
         | 
| 5 | 
            +
                    # elasticsearch indexes cannot have underscores in the name
         | 
| 6 | 
            +
                    # and datastore metrics cannot have dashes
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                    self.split('-').map { |w| w[0].upcase + w[1..-1] }.join.gsub(/(Production)|(Staging)/,'')
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
             | 
| 2 13 | 
             
              ELASTICSEARCH_OPERATION_NAMES =
         | 
| 3 14 | 
             
                {
         | 
| 4 15 | 
             
                  [ "PUT", nil ] => :ambiguous_put_resolver,
         | 
| @@ -21,7 +32,7 @@ class NewRelic::ElasticsearchOperationResolver | |
| 21 32 | 
             
                  [ "GET", "_cat" ] => :ambiguous_cat_resolver,
         | 
| 22 33 | 
             
                  [ "POST", "_close" ] => "CloseIndex",
         | 
| 23 34 | 
             
                  [ "POST", "_cluster" ] => "ClusterReroute",
         | 
| 24 | 
            -
                  [ "GET", "_cluster" ] => : | 
| 35 | 
            +
                  [ "GET", "_cluster" ] => :ambiguous_cluster_resolver,
         | 
| 25 36 | 
             
                  [ "PUT", "_cluster" ] => "ClusterUpdateSettings",
         | 
| 26 37 | 
             
                  [ "GET", "_count" ] => "Count",
         | 
| 27 38 | 
             
                  [ "POST", "_count" ] => "Count",
         | 
| @@ -107,6 +118,8 @@ class NewRelic::ElasticsearchOperationResolver | |
| 107 118 |  | 
| 108 119 | 
             
              attr_accessor :http_method, :path
         | 
| 109 120 |  | 
| 121 | 
            +
              using Inflector
         | 
| 122 | 
            +
             | 
| 110 123 | 
             
              def initialize(http_method, path)
         | 
| 111 124 | 
             
                @http_method = http_method
         | 
| 112 125 | 
             
                @path = path
         | 
| @@ -152,11 +165,12 @@ class NewRelic::ElasticsearchOperationResolver | |
| 152 165 | 
             
              end
         | 
| 153 166 |  | 
| 154 167 | 
             
              def index
         | 
| 155 | 
            -
                scope[0]
         | 
| 168 | 
            +
                index = scope[0]
         | 
| 169 | 
            +
                index.legalize unless index.start_with?('_')
         | 
| 156 170 | 
             
              end
         | 
| 157 171 |  | 
| 158 172 | 
             
              def type
         | 
| 159 | 
            -
                scope[1]
         | 
| 173 | 
            +
                scope[1].legalize
         | 
| 160 174 | 
             
              end
         | 
| 161 175 |  | 
| 162 176 | 
             
              def id
         | 
| @@ -190,7 +204,7 @@ class NewRelic::ElasticsearchOperationResolver | |
| 190 204 | 
             
              end
         | 
| 191 205 |  | 
| 192 206 | 
             
              def ambiguous_nodes_resolver
         | 
| 193 | 
            -
                "Node" + operands[1..-1].map | 
| 207 | 
            +
                "Node" + operands[1..-1].map{ |s| s.legalize }.join
         | 
| 194 208 | 
             
              end
         | 
| 195 209 |  | 
| 196 210 | 
             
              def ambiguous_percolate_resolver
         | 
| @@ -202,7 +216,7 @@ class NewRelic::ElasticsearchOperationResolver | |
| 202 216 | 
             
              end
         | 
| 203 217 |  | 
| 204 218 | 
             
              def ambiguous_stats_resolver
         | 
| 205 | 
            -
                "Indicies" + operands.map | 
| 219 | 
            +
                "Indicies" + operands.map { |s| s.legalize }.join
         | 
| 206 220 | 
             
              end
         | 
| 207 221 |  | 
| 208 222 | 
             
              def ambiguous_cluster_resolver
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: newrelic-elasticsearch
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Stephen Prater
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2017-06-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |