2.3.2.1 Ruby
For the installation steps of Logger, please refer to the following GitHub repository:
When Logger is integrated, request logs are sent to Mx.Load when requests are made to the application. Scenarios are generated based on these logs.
- Add mxload to the Gemfile of Rails where you want to get the logs.
gem 'mxload', github: 'mxload/mxload_rb' , tag: 'v0.2.3'
- Install the gem.
$ bundle install
- Add the following two lines to either
config/application.rborconfig/environments/{RAILS_ENV}.rb.
require "mxload/collector"
config.middleware.insert_before(0, Mxload::Collector)
-
Example of adding to config/application.rb
... abbreviated require "mxload/collector" ... abbreviated module TodoApiMock class Application < Rails::Application ... abbreviated config.middleware.insert_before(0, Mxload::Collector) end end -
Example of adding to config/environments/{RAILS_ENV}.rb
... abbreviated require "mxload/collector" Rails.application.configure do ... abbreviated config.middleware.insert_before(0, Mxload::Collector) end
- Create a
config/initializers/mxload.rbfile and add the following content.
Mxload.configure do |config|
config.enable = true
config.project_id = 1
config.service_key = 'servicekey'
config.custom_header = %w[Content-Type]
config.ignore_paths = %w[/health]
end
The main configuration parameters are as follows:
enable- Switches the enable/disable of this gem. Default is
false.
- Switches the enable/disable of this gem. Default is
project_id- Sets the id of the created project.
project_idcan be confirmed from the home or project details.
project_id
- Sets the id of the created project.
service_key- Sets the service key created in Issue Service Key.
custom_header(Optional)- Required to record the contents of the header.
Example: If you want to include
"Content-Type": "application/json", set the value ofconfig.custom_headerto%w[Content-Type].
- Required to record the contents of the header.
Example: If you want to include
ignore_paths(Optional)- If the request path is within
ignore_paths, ignore sending the request log. Set this when you want to disable paths such as health check paths (/health).
- If the request path is within
The log parameters sent to Mx.Load are as follows:
- Method
- Request path
- Request body
- Query parameters
- Request headers
- Cookies