newrelic-elasticsearch 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3066767a18763e54c5f8bfbcba170ce1c47d7470
4
- data.tar.gz: 21c5355934a6e2b8de09ae4e3f8fcdf4d546183f
3
+ metadata.gz: ff0277a9cfce36ea2c9b420c4cdf50b8f53e5a36
4
+ data.tar.gz: 32221514a558e500a6d490e876d7fb398420343c
5
5
  SHA512:
6
- metadata.gz: 8d1b7bae4579942e68660cb53ffa8cb27966a651124d2284e4fcbe7103e0d9e4547e2c48c0148f4216f5c86a43cf4151bfe41638291000189809b1bf17e7086c
7
- data.tar.gz: 196027f6d2006c93cc84ff3c9378a44fdbfc999519a536958291a4a4b06175b6a52c6b67df34323329ca2f8da7634984ff52d6b8daf8353ee001a78d4ceb954a
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 'new_relic-elasticsearch'
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 new_relic-elasticsearch
21
+ $ gem install newrelic-elasticsearch
22
22
 
23
23
  ## Usage
24
24
 
data/Rakefile CHANGED
@@ -10,6 +10,7 @@ task :test do
10
10
  end
11
11
  end
12
12
 
13
+ desc "Generate a new resolver class from the endpoint_list"
13
14
  task :generate_resolver do
14
15
  list = File.read(File.expand_path('test/endpoint_list.txt', __dir__))
15
16
 
@@ -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" ] => :ambigous_cluster_resolver,
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(&:capitalize).join
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(&:capitalize).join
219
+ "Indicies" + operands.map { |s| s.legalize }.join
206
220
  end
207
221
 
208
222
  def ambiguous_cluster_resolver
@@ -1,5 +1,5 @@
1
1
  module NewRelic
2
2
  module Elasticsearch
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
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.1.2
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: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2017-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler