Module: Elasticsearch::Rails::Instrumentation
- Defined in:
- lib/elasticsearch/rails/instrumentation.rb,
lib/elasticsearch/rails/instrumentation/railtie.rb,
lib/elasticsearch/rails/instrumentation/publishers.rb,
lib/elasticsearch/rails/instrumentation/log_subscriber.rb,
lib/elasticsearch/rails/instrumentation/controller_runtime.rb
Overview
Note:
The displayed duration includes the HTTP transfer -- the time it took Elasticsearch
to process your request is available in the response.took property.
This module adds support for displaying statistics about search duration in the Rails application log
by integrating with the ActiveSupport::Notifications framework and ActionController logger.
Usage
Require the component in your application.rb file:
require 'elasticsearch/rails/instrumentation'
You should see an output like this in your application log in development environment:
Article Search (321.3ms) { index: "articles", type: "article", body: { query: ... } }
Also, the total duration of the request to Elasticsearch is displayed in the Rails request breakdown:
Completed 200 OK in 615ms (Views: 230.9ms | ActiveRecord: 0.0ms | Elasticsearch: 321.3ms)
Defined Under Namespace
Modules: ControllerRuntime, Publishers Classes: LogSubscriber, Railtie