elastics 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.travis.yml +7 -0
- data/README.md +80 -9
- data/Rakefile +3 -8
- data/elastics.gemspec +4 -1
- data/lib/elastics.rb +11 -0
- data/lib/elastics/active_record.rb +19 -4
- data/lib/elastics/active_record/helper_methods.rb +27 -26
- data/lib/elastics/active_record/instrumentation.rb +63 -7
- data/lib/elastics/active_record/model_schema.rb +22 -17
- data/lib/elastics/active_record/search_result.rb +49 -0
- data/lib/elastics/active_record/tasks_config.rb +25 -0
- data/lib/elastics/capistrano.rb +14 -0
- data/lib/elastics/client.rb +49 -22
- data/lib/elastics/client/cluster.rb +70 -0
- data/lib/elastics/railtie.rb +5 -4
- data/lib/elastics/tasks.rb +20 -19
- data/lib/elastics/tasks/config.rb +38 -0
- data/lib/elastics/tasks/indices.rb +72 -10
- data/lib/elastics/tasks/mappings.rb +11 -5
- data/lib/elastics/tasks/migrations.rb +42 -0
- data/lib/elastics/version.rb +1 -1
- data/lib/elastics/version_manager.rb +86 -0
- data/lib/tasks/elastics.rake +31 -8
- data/spec/lib/elastics/client/cluster_spec.rb +108 -0
- data/spec/spec_helper.rb +9 -0
- metadata +62 -7
- data/lib/elastics/active_record/log_subscriber.rb +0 -27
@@ -1,27 +0,0 @@
|
|
1
|
-
module Elastics
|
2
|
-
module ActiveRecord
|
3
|
-
module LogSubscriber
|
4
|
-
def self.included(base)
|
5
|
-
instance_methods.each { |method| base.method_added(method) }
|
6
|
-
end
|
7
|
-
|
8
|
-
def request_elastics(event)
|
9
|
-
return unless logger.debug?
|
10
|
-
|
11
|
-
payload = event.payload
|
12
|
-
|
13
|
-
name = "#{payload[:name]} elastics (#{event.duration.round(1)}ms)"
|
14
|
-
request = payload[:request].to_json
|
15
|
-
|
16
|
-
if odd?
|
17
|
-
name = color(name, ActiveSupport::LogSubscriber::CYAN, true)
|
18
|
-
request = color(request, nil, true)
|
19
|
-
else
|
20
|
-
name = color(name, ActiveSupport::LogSubscriber::MAGENTA, true)
|
21
|
-
end
|
22
|
-
|
23
|
-
debug " #{name} #{request}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|