Ruby
Installation
Currently Metlo’s Ruby Agent supports frameworks compatible with rack middleware. An incomplete set of frameworks that support this are: installed
- Puma
- Sinatra
- Iodine
- Unicorn
- uWSGI
It can be installed from gem
by running:
Alternatively, on a bundle install:
Note: Metlo uses platform native gems. Unfortunately, older versions of the gem tool don’t fully support fetching the correct platform’s gem. We recommend verifying that that the lockfile generated on install contains the correct gem. If upgrading the gem tool isn’t an option, then the gem can be installed manually. For example, in a gemfile:
Or, through the shell:
Configuration
Rails
Once installed, Metlo’s middleware can be added by adding it to the middlewares list (generally in the application.rb
file) like so:
Optional Parameters:
:backend_port
: Backend port used by Metlo:collector_port
: Collector port used to capture traces. Defaults to 8081:encryption_key
: Key used to encrypt sensitive data, such as User session keys:log_level
: The log level Metlo should log at. The debug levels and above correspond to values used by the python logging module. A specialtrace
level is also present, that provides verbose logging info. Can be- ”trace"
- "debug"
- "info"
- "warn"
- "error”
:block_response
: Function that produces a reponse when Metlo is set to block malicious requests. It takes in a param for the env and expects a tuple containing the status code, response headers, and response (as an array of strings).:get_user
: A function that takes in the rack env scope parameter and returns the user for that request as a string. By default, Metlo collects no information about user of a request.
Optional params can be supplied as keyword arguments. The key being the symbol shown above.
Sinatra
Once installed, Metlo’s middleware can be added by simply doing:
Optional Parameters:
:backend_port
: Backend port used by Metlo:collector_port
: Collector port used to capture traces. Defaults to 8081:encryption_key
: Key used to encrypt sensitive data, such as User session keys:log_level
: The log level Metlo should log at. The debug levels and above correspond to values used by the python logging module. A specialtrace
level is also present, that provides verbose logging info. Can be- ”trace"
- "debug"
- "info"
- "warn"
- "error”
:block_response
: Function that produces a reponse when Metlo is set to block malicious requests. It takes in a param for the env and expects a tuple containing the status code, response headers, and response (as an array of strings).:get_user
: A function that takes in the rack env scope parameter and returns the user for that request as a string. By default, Metlo collects no information about user of a request.
Optional params can be supplied as keyword arguments. The key being the symbol shown above.