appsignal-elasticsearch 0.0.1
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 +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +16 -0
- data/Rakefile +8 -0
- data/appsignal-elasticsearch.gemspec +26 -0
- data/lib/appsignal-elasticsearch/version.rb +5 -0
- data/lib/appsignal-elasticsearch.rb +25 -0
- data/spec/appsignal_elasticsearch_spec.rb +37 -0
- data/spec/spec_helper.rb +12 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ecf0ec7d2d0c193c5ff83b47cf9ddfd176b0c544
|
4
|
+
data.tar.gz: d7499be2df4679ddc9da61caa3450f65c52cdab2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 90fd8e4281ab735ed5a7e5e5a78368d6d28b46737f59c5b8ec8ade1a67b431fbc984d6d9f9592322da7829f66248fb01f2be128a6a5717e237b9b0024f6bf1c8
|
7
|
+
data.tar.gz: 357778c1fea233783e88c03812c20abf4df217d6a692213d841b3a0305fd37ba74166b7a3b7f8f2558bab64483ffb165925f7a02dbdabc057ef7eda7c620cae4
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Mike Kim
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
AppSignal Elasticsearch
|
2
|
+
=======================
|
3
|
+
|
4
|
+
`appsignal-elasticsearch` allows AppSignal clients to gain insight in database queries
|
5
|
+
that use the [elasticsearch-ruby](https://github.com/elastic/elasticsearch-ruby) gem.
|
6
|
+
|
7
|
+
For more information, visit:
|
8
|
+
|
9
|
+
* [AppSignal website](http://appsignal.com)
|
10
|
+
* [AppSignal docs](http://docs.appsignal.com/tweaks-in-your-code/integration-gems.html)
|
11
|
+
* [AppSignal client gem](https://github.com/appsignal/appsignal)
|
12
|
+
|
13
|
+
Licence
|
14
|
+
=======
|
15
|
+
|
16
|
+
See [LICENCE](https://github.com/mykoweb/appsignal-elasticsearch/blob/master/LICENSE)
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/appsignal-elasticsearch/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ['Mike Kim']
|
6
|
+
gem.email = ['mykoweb@gmail.com']
|
7
|
+
gem.description = gem.summary = 'Add Active::Support.instrument calls to ElasticSearch queries'
|
8
|
+
gem.homepage = 'https://github.com/mykoweb/appsignal-elasticsearch'
|
9
|
+
gem.license = 'MIT'
|
10
|
+
|
11
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split($\)
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = 'appsignal-elasticsearch'
|
15
|
+
gem.require_paths = ['lib']
|
16
|
+
gem.version = Appsignal::Elasticsearch::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'appsignal', '> 0.7'
|
19
|
+
gem.add_dependency 'elasticsearch', '> 1.0.11'
|
20
|
+
gem.add_dependency 'activesupport'
|
21
|
+
|
22
|
+
gem.add_development_dependency 'rake'
|
23
|
+
gem.add_development_dependency 'rspec'
|
24
|
+
gem.add_development_dependency 'pry'
|
25
|
+
gem.add_development_dependency 'pry-byebug'
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'elasticsearch'
|
2
|
+
require 'active_support'
|
3
|
+
|
4
|
+
module Appsignal
|
5
|
+
module Elasticsearch
|
6
|
+
module Instrumentation
|
7
|
+
|
8
|
+
def perform_request_with_appsignal_instrumentation(method, path, params, body, &block)
|
9
|
+
args = { method: method, path: path, params: params, body: body }
|
10
|
+
ActiveSupport::Notifications.instrument(
|
11
|
+
'query.elasticsearch', :query => args) do
|
12
|
+
perform_request_without_appsignal_instrumentation(method, path, params, body, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
::Elasticsearch::Transport::Client.class_eval do
|
21
|
+
include Appsignal::Elasticsearch::Instrumentation
|
22
|
+
|
23
|
+
alias_method :perform_request_without_appsignal_instrumentation, :perform_request
|
24
|
+
alias_method :perform_request, :perform_request_with_appsignal_instrumentation
|
25
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Appsignal::Elasticsearch do
|
4
|
+
let(:client) { Elasticsearch::Client.new }
|
5
|
+
let(:event) { @events.pop }
|
6
|
+
let(:payload) { event.payload }
|
7
|
+
|
8
|
+
before(:all) do
|
9
|
+
@events = []
|
10
|
+
ActiveSupport::Notifications.subscribe('query.elasticsearch') do |*args|
|
11
|
+
@events << ActiveSupport::Notifications::Event.new(*args)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'client.exists?' do
|
16
|
+
let(:index) { 'foobar4321' }
|
17
|
+
let(:type) { 'sometype' }
|
18
|
+
let(:id) { '1234' }
|
19
|
+
|
20
|
+
before { client.exists? index: index, type: type, id: id }
|
21
|
+
|
22
|
+
context 'payload' do
|
23
|
+
it 'has the correct method' do
|
24
|
+
expect(payload[:query][:method]).to eq 'HEAD'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'has the correct path' do
|
28
|
+
expect(payload[:query][:path]).to eq "#{index}/#{type}/#{id}"
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'has the correct exception' do
|
32
|
+
expect(payload[:exception][0]).to eq 'Elasticsearch::Transport::Transport::Errors::NotFound'
|
33
|
+
expect(payload[:exception][1]).to eq '[404] '
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_support/notifications'
|
3
|
+
require 'appsignal-elasticsearch'
|
4
|
+
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.mock_with :rspec
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: appsignal-elasticsearch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Kim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: appsignal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: elasticsearch
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.11
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.11
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Add Active::Support.instrument calls to ElasticSearch queries
|
112
|
+
email:
|
113
|
+
- mykoweb@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- appsignal-elasticsearch.gemspec
|
125
|
+
- lib/appsignal-elasticsearch.rb
|
126
|
+
- lib/appsignal-elasticsearch/version.rb
|
127
|
+
- spec/appsignal_elasticsearch_spec.rb
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
homepage: https://github.com/mykoweb/appsignal-elasticsearch
|
130
|
+
licenses:
|
131
|
+
- MIT
|
132
|
+
metadata: {}
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.4.5
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: Add Active::Support.instrument calls to ElasticSearch queries
|
153
|
+
test_files:
|
154
|
+
- spec/appsignal_elasticsearch_spec.rb
|
155
|
+
- spec/spec_helper.rb
|