repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/always.rb | lib/god/conditions/always.rb | module God
module Conditions
# Always trigger or never trigger.
#
# Examples
#
# # Always trigger.
# on.condition(:always) do |c|
# c.what = true
# end
#
# # Never trigger.
# on.condition(:always) do |c|
# c.what = false
# end
class Always < ... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/tries.rb | lib/god/conditions/tries.rb | module God
module Conditions
class Tries < PollCondition
attr_accessor :times, :within
def prepare
@timeline = Timeline.new(self.times)
end
def reset
@timeline.clear
end
def valid?
valid = true
valid &= complain("Attribute 'times' must be spe... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/socket_responding.rb | lib/god/conditions/socket_responding.rb | require 'socket'
include Socket::Constants
module God
module Conditions
# Condition Symbol :socket_running
# Type: Poll
#
# Trigger when a TCP or UNIX socket is running or not
#
# Parameters
# Required
# +family+ is the family of socket: either 'tcp' or 'unix'
# --one of port ... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/process_running.rb | lib/god/conditions/process_running.rb | module God
module Conditions
# Trigger when a process is running or not running depending on attributes.
#
# Examples
#
# # Trigger if process IS NOT running.
# on.condition(:process_running) do |c|
# c.running = false
# end
#
# # Trigger if process IS running.
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/memory_usage.rb | lib/god/conditions/memory_usage.rb | module God
module Conditions
# Condition Symbol :memory_usage
# Type: Poll
#
# Trigger when the resident memory of a process is above a specified limit.
#
# Paramaters
# Required
# +pid_file+ is the pid file of the process in question. Automatically
# populate... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/http_response_code.rb | lib/god/conditions/http_response_code.rb | require 'net/http'
require 'net/https'
module God
module Conditions
# Condition Symbol :http_response_code
# Type: Poll
#
# Trigger based on the response from an HTTP request.
#
# Paramaters
# Required
# +host+ is the hostname to connect [required]
# --one of code_is or... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/flapping.rb | lib/god/conditions/flapping.rb | module God
module Conditions
# Condition Symbol :flapping
# Type: Trigger
#
# Trigger when a Task transitions to or from a state or states a given number
# of times within a given period.
#
# Paramaters
# Required
# +times+ is the number of times that the Task must transitio... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/file_mtime.rb | lib/god/conditions/file_mtime.rb | module God
module Conditions
class FileMtime < PollCondition
attr_accessor :path, :max_age
def initialize
super
self.path = nil
self.max_age = nil
end
def valid?
valid = true
valid &= complain("Attribute 'path' must be specified", self) if self.pa... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/process_exits.rb | lib/god/conditions/process_exits.rb | module God
module Conditions
# Trigger when a process exits.
#
# +pid_file+ is the pid file of the process in question. Automatically
# populated for Watches.
#
# Examples
#
# # Trigger if process exits (from a Watch).
# on.condition(:process_exits)
#
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/complex.rb | lib/god/conditions/complex.rb | module God
module Conditions
class Complex < PollCondition
AND = 0x1
OR = 0x2
NOT = 0x4
def initialize()
super
@oper_stack = []
@op_stack = []
@this = nil
end
def valid?
@oper_stack.inject(true) { |acc, oper| acc & oper.valid? }
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/file_touched.rb | lib/god/conditions/file_touched.rb | module God
module Conditions
# Condition Symbol :file_touched
# Type: Poll
#
# Trigger when a specified file is touched.
#
# Paramaters
# Required
# +path+ is the path to the file to watch.
#
# Examples
#
# Trigger if 'tmp/restart.txt' file is touched (from a W... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/disk_usage.rb | lib/god/conditions/disk_usage.rb | module God
module Conditions
class DiskUsage < PollCondition
attr_accessor :above, :mount_point
def initialize
super
self.above = nil
self.mount_point = nil
end
def valid?
valid = true
valid &= complain("Attribute 'mount_point' must be specified",... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/cpu_usage.rb | lib/god/conditions/cpu_usage.rb | module God
module Conditions
# Condition Symbol :cpu_usage
# Type: Poll
#
# Trigger when the percent of CPU use of a process is above a specified limit.
# On multi-core systems, this number could conceivably be above 100.
#
# Paramaters
# Required
# +pid_file+ is the pid fil... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/degrading_lambda.rb | lib/god/conditions/degrading_lambda.rb | module God
module Conditions
# This condition degrades its interval by a factor of two for 3 tries before failing
class DegradingLambda < PollCondition
attr_accessor :lambda
def initialize
super
@tries = 0
end
def valid?
valid = true
valid &= complain... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/conditions/lambda.rb | lib/god/conditions/lambda.rb | module God
module Conditions
class Lambda < PollCondition
attr_accessor :lambda
def valid?
valid = true
valid &= complain("Attribute 'lambda' must be specified", self) if self.lambda.nil?
valid
end
def test
if self.lambda.call()
self.info = "lam... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/hipchat.rb | lib/god/contacts/hipchat.rb | # Send a notice to a Hipchat room (http://hipchat.com).
#
# token - The String token used for authentication.
# room - The String room name to which the message should be sent.
# ssl - A Boolean determining whether or not to use SSL
# (default: false).
# from - The String representi... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/statsd.rb | lib/god/contacts/statsd.rb | # Send a notice to statsd
#
# host - statsd host
# port - statsd port (optional)
require 'statsd-ruby'
module God
module Contacts
class Statsd < Contact
class << self
attr_accessor :host, :port
end
attr_accessor :host, :port
def valid?
valid = true
valid &= com... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/sensu.rb | lib/god/contacts/sensu.rb | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Send a notice to a SENSU client socket, port 3030 on 'localhost' only.
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/twitter.rb | lib/god/contacts/twitter.rb | # Send a notice to a Twitter account (http://twitter.com/).
#
# consumer_token - The String OAuth consumer token (defaults to God's
# existing consumer token).
# consumer_secret - The String OAuth consumer secret (defaults to God's
# existing consumer secret).
# access_token - Th... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/prowl.rb | lib/god/contacts/prowl.rb | # Send a notice to Prowl (http://prowl.weks.net/).
#
# apikey - The String API key.
CONTACT_DEPS[:prowl] = ['prowly']
CONTACT_DEPS[:prowl].each do |d|
require d
end
module God
module Contacts
class Prowl < Contact
class << self
attr_accessor :apikey
end
def valid?
valid = t... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/email.rb | lib/god/contacts/email.rb | # Send a notice to an email address.
#
# to_email - The String email address to which the email will be sent.
# to_name - The String name corresponding to the recipient.
# from_email - The String email address from which the email will be sent.
# from_name - The String name corresponding to th... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/slack.rb | lib/god/contacts/slack.rb | # Send a message to a Slack channel
#
# account - The name of your Slack account (visible in URL, e.g. foo.slack.com)
# token - The token of the webhook created in Slack
# channel - The name of the channel to send the message to, prefixed with #
# notify_channel - Whether to send an "@channel" in... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/airbrake.rb | lib/god/contacts/airbrake.rb | # Send a notice to Airbrake (http://airbrake.io/).
#
# apikey - The String API key.
CONTACT_DEPS[:airbrake] = ['airbrake']
CONTACT_DEPS[:airbrake].each do |d|
require d
end
module God
module Contacts
class Airbrake < Contact
class << self
attr_accessor :apikey
end
def valid?
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/campfire.rb | lib/god/contacts/campfire.rb | # Send a notice to a Campfire room (http://campfirenow.com).
#
# subdomain - The String subdomain of the Campfire account. If your URL is
# "foo.campfirenow.com" then your subdomain is "foo".
# token - The String token used for authentication.
# room - The String room name to which the message ... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/jabber.rb | lib/god/contacts/jabber.rb | # Send a notice to a Jabber address.
#
# host - The String hostname of the Jabber server.
# port - The Integer port of the Jabber server (default: 5222).
# from_jid - The String Jabber ID of the sender.
# password - The String password of the sender.
# to_jid - The String Jabber ID of the recipient.
# subject... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/webhook.rb | lib/god/contacts/webhook.rb | # Send a notice to a webhook.
#
# url - The String webhook URL.
# format - The Symbol format [ :form | :json ] (default: :form).
require 'net/http'
require 'uri'
CONTACT_DEPS[:webhook] = ['json']
CONTACT_DEPS[:webhook].each do |d|
require d
end
module God
module Contacts
class Webhook < Contact
cla... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contacts/scout.rb | lib/god/contacts/scout.rb | # Send a notice to Scout (http://scoutapp.com/).
#
# client_key - The String client key.
# plugin_id - The String plugin id.
require 'net/http'
require 'uri'
module God
module Contacts
class Scout < Contact
class << self
attr_accessor :client_key, :plugin_id
attr_accessor :format
e... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/cli/command.rb | lib/god/cli/command.rb | module God
module CLI
class Command
def initialize(command, options, args)
@command = command
@options = options
@args = args
dispatch
end
def setup
# connect to drb unix socket
@server = DRbObject.new(nil, God::Socket.socket(@options[:port]))
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/cli/version.rb | lib/god/cli/version.rb | module God
module CLI
class Version
def self.version
require 'god'
# print version
puts "Version #{God.version}"
exit
end
def self.version_extended
puts "Version: #{God.version}"
puts "Polls: enabled"
puts "Events: " + God::EventHandler.... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/cli/run.rb | lib/god/cli/run.rb | module God
module CLI
class Run
def initialize(options)
@options = options
dispatch
end
def dispatch
# have at_exit start god
$run = true
if @options[:syslog]
require 'god/sys_logger'
end
# run
if @options[:daemonize]... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/event_handlers/dummy_handler.rb | lib/god/event_handlers/dummy_handler.rb | module God
class DummyHandler
EVENT_SYSTEM = "none"
def self.register_process(pid, events)
raise NotImplementedError
end
def self.handle_events
raise NotImplementedError
end
end
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/event_handlers/netlink_handler.rb | lib/god/event_handlers/netlink_handler.rb | require 'netlink_handler_ext'
module God
class NetlinkHandler
EVENT_SYSTEM = "netlink"
def self.register_process(pid, events)
# netlink doesn't need to do this
# it just reads from the eventhandler actions to see if the pid
# matches the list we're looking for -- Kev
end
end
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/event_handlers/kqueue_handler.rb | lib/god/event_handlers/kqueue_handler.rb | require 'kqueue_handler_ext'
module God
class KQueueHandler
EVENT_SYSTEM = "kqueue"
def self.register_process(pid, events)
monitor_process(pid, events_mask(events))
end
def self.events_mask(events)
events.inject(0) do |mask, event|
mask |= event_mask(event)
end
end
e... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/ideas/execve/extconf.rb | ideas/execve/extconf.rb | # Loads mkmf which is used to make makefiles for Ruby extensions
require 'mkmf'
# Give it a name
extension_name = 'execve'
# The destination
dir_config(extension_name)
# Do the work
create_makefile(extension_name)
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/ideas/execve/go.rb | ideas/execve/go.rb | require 'execve'
my_env = ENV.to_hash.merge('HOME' => '/foo')
# my_env = ENV.to_hash
env = my_env.keys.inject([]) { |acc, k| acc << "#{k}=#{my_env[k]}"; acc }
execve(%Q{ruby -e "puts ENV['HOME']"}, env)
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
require 'bundler/setup'
require 'rspec'
require 'request_log_analyzer'
require 'stringio'
module RequestLogAnalyzer::RSpec
end
# Include all files in the spec_helper directory
Dir[File.dirname(__FILE__) + '/lib/**/*.rb'].each do |file|
require file
end
Dir.mkdir("#{File.dirname(__FILE__)}/../tm... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/integration/scout_spec.rb | spec/integration/scout_spec.rb | require 'spec_helper'
def capture_stdout_and_stderr_with_warnings_on
$stdout, $stderr, warnings, $VERBOSE =
StringIO.new, StringIO.new, $VERBOSE, true
yield
return $stdout.string, $stderr.string
ensure
$stdout, $stderr, $VERBOSE = STDOUT, STDERR, warnings
end
describe RequestLogAnalyzer, 'when using the r... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/integration/mailer_spec.rb | spec/integration/mailer_spec.rb | require 'spec_helper'
require 'socket'
unless defined?(JRUBY_VERSION) # No Fork on JRUBY
describe RequestLogAnalyzer, 'running mailer integration' do
before(:each) do
@log_file = temp_output_file('mailtrap.log')
Process.fork do
Mailtrap.new('localhost', 2525, true, @log_file)
Proce... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/integration/command_line_usage_spec.rb | spec/integration/command_line_usage_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer, 'running from command line' do
before(:each) do
cleanup_temp_files!
end
after(:each) do
cleanup_temp_files!
end
it 'should find 4 requests in default mode' do
output = run("#{log_fixture(:rails_1x)}")
output.any? { |line| /^Parsed requests... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/integration/munin_plugins_rails_spec.rb | spec/integration/munin_plugins_rails_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer, 'when harvesting like munin-plugins-rails the YAML output' do
before(:each) do
cleanup_temp_files!
run("#{log_fixture(:rails_1x)} --dump #{temp_output_file(:yaml)}")
@rla = YAML.load(File.read(temp_output_file(:yaml)))
end
after(:each) do
clean... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/lib/macros.rb | spec/lib/macros.rb | module RequestLogAnalyzer::RSpec::Macros
def test_databases
require 'yaml'
hash = YAML.load(File.read("#{File.dirname(__FILE__)}/../database.yml"))
hash.reduce({}) { |res, (name, h)| res[name] = h.map { |(k, v)| "#{k}=#{v}" }.join(';'); res }
end
# Create or return a new TestingFormat
def testing_... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/lib/testing_format.rb | spec/lib/testing_format.rb | # Simple log file specification, used to test log parser.
class TestingFormat < RequestLogAnalyzer::FileFormat::Base
format_definition.first do |line|
line.header = true
line.teaser = /processing /
line.regexp = /processing request (\d+)/
line.captures = [{ name: :request_no, type: :integer }]
end
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/lib/matchers.rb | spec/lib/matchers.rb | module RequestLogAnalyzer::RSpec::Matchers
class HasLineDefinition
def initialize(line_type)
@line_type = line_type.to_sym
@captures = []
end
def and_capture(*captures)
@captures += captures
self
end
alias_method :capturing, :and_capture
def description
descri... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/lib/mocks.rb | spec/lib/mocks.rb | module RequestLogAnalyzer::RSpec::Mocks
def mock_source
source = double('RequestLogAnalyzer::Source::Base')
source.stub(:file_format).and_return(testing_format)
source.stub(:parsed_requests).and_return(2)
source.stub(:skipped_requests).and_return(1)
source.stub(:parse_lines).and_return(10)
so... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/lib/helpers.rb | spec/lib/helpers.rb | module RequestLogAnalyzer::RSpec::Helpers
# Create or return a new TestingFormat
def testing_format
@testing_format ||= TestingFormat.create
end
# Load a log file from the fixture folder
def log_fixture(name, extention = 'log')
File.dirname(__FILE__) + "/../fixtures/#{name}.#{extention}"
end
# d... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/request_spec.rb | spec/unit/request_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Request do
before(:each) do
@request = testing_format.request
end
it 'should be empty without any captured lines in it' do
@request.should be_empty
end
context :incomplete do
before(:each) do
@request << { line_type: :test, lineno: 1, t... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/mailer_spec.rb | spec/unit/mailer_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Mailer, 'mailer' do
it 'should initialize correctly' do
@mailer = RequestLogAnalyzer::Mailer.new('alfa@beta.com', 'localhost', debug: true)
@mailer.host.should eql('localhost')
@mailer.port.should eql(25)
end
it 'should allow alternate port setting... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/controller/log_processor_spec.rb | spec/unit/controller/log_processor_spec.rb | require 'spec_helper'
require 'request_log_analyzer/log_processor'
describe RequestLogAnalyzer::LogProcessor, 'stripping log files' do
before(:each) do
@log_stripper = RequestLogAnalyzer::LogProcessor.new(testing_format, :strip, {})
end
it 'should remove a junk line' do
@log_stripper.strip_line("junk ... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/controller/controller_spec.rb | spec/unit/controller/controller_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Controller do
it 'should use a custom output generator correctly' do
mock_output = double('RequestLogAnalyzer::Output::Base')
mock_output.stub(:io).and_return(mock_io)
mock_output.should_receive(:header)
mock_output.should_receive(:footer)
con... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/filter/timespan_filter_spec.rb | spec/unit/filter/timespan_filter_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Filter::Timespan, 'both before and after' do
before(:each) do
@filter = RequestLogAnalyzer::Filter::Timespan.new(testing_format, after: DateTime.parse('2009-01-01'), before: DateTime.parse('2009-02-02'))
end
it 'should reject a request before the after da... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/filter/anonymize_filter_spec.rb | spec/unit/filter/anonymize_filter_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Filter::Anonymize, 'anonymize request' do
before(:each) do
@filter = RequestLogAnalyzer::Filter::Anonymize.new(testing_format)
end
it 'should anonimize ip' do
@filter.filter(request(ip: '123.123.123.123'))[:ip].should_not eql('123.123.123.123')
end
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/filter/filter_spec.rb | spec/unit/filter/filter_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Filter::Base, 'base filter' do
before(:each) do
@filter = RequestLogAnalyzer::Filter::Base.new(testing_format)
end
it 'should return everything' do
@filter.filter(request(ip: '123.123.123.123'))[:ip].should eql('123.123.123.123')
end
it 'should re... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/filter/field_filter_spec.rb | spec/unit/filter/field_filter_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Filter::Field, 'string in accept mode' do
before(:each) do
@filter = RequestLogAnalyzer::Filter::Field.new(testing_format, field: :test, value: 'test', mode: :select)
end
it 'should reject a request if the field value does not match' do
@filter.filter(... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/tracker/traffic_tracker_spec.rb | spec/unit/tracker/traffic_tracker_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Tracker::Traffic do
describe '#report' do
before(:each) do
@tracker = RequestLogAnalyzer::Tracker::Traffic.new(category: :category, traffic: :traffic)
@tracker.prepare
end
it 'should generate a report without errors when one category is pre... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/tracker/tracker_api_spec.rb | spec/unit/tracker/tracker_api_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Tracker::Base do
describe 'API' do
before(:each) do
@tracker = Class.new(RequestLogAnalyzer::Tracker::Base).new
@summarizer = RequestLogAnalyzer::Aggregator::Summarizer.new(mock_source)
@summarizer.trackers << @tracker
end
it 'sh... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/tracker/timespan_tracker_spec.rb | spec/unit/tracker/timespan_tracker_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Tracker::Timespan do
before(:each) do
@tracker = RequestLogAnalyzer::Tracker::Timespan.new
@tracker.prepare
end
it 'should set the first request timestamp correctly' do
@tracker.update(request(timestamp: 20_090_102_000_000))
@tracker.update(req... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/tracker/frequency_tracker_spec.rb | spec/unit/tracker/frequency_tracker_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Tracker::Frequency do
context 'static category' do
before(:each) do
@tracker = RequestLogAnalyzer::Tracker::Frequency.new(category: :category)
@tracker.prepare
end
it 'should register a request in the right category' do
@tracker.updat... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/tracker/hourly_spread_spec.rb | spec/unit/tracker/hourly_spread_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Tracker::HourlySpread do
before(:each) do
@tracker = RequestLogAnalyzer::Tracker::HourlySpread.new
@tracker.prepare
end
it 'should store timestamps correctly' do
@tracker.update(request(timestamp: 20_090_102_000_000))
@tracker.update(request(ti... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/tracker/numeric_value_tracker_spec.rb | spec/unit/tracker/numeric_value_tracker_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Tracker::NumericValue do
context 'static category' do
before(:each) do
@tracker = RequestLogAnalyzer::Tracker::NumericValue.new(category: :category, value: :blah)
@tracker.prepare
end
it 'should register a request in the right category' do
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/tracker/duration_tracker_spec.rb | spec/unit/tracker/duration_tracker_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Tracker::Duration do
describe '#report' do
before(:each) do
@tracker = RequestLogAnalyzer::Tracker::Duration.new(category: :category, value: :duration)
@tracker.prepare
end
it 'should generate a report without errors when one category is p... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/source/log_parser_spec.rb | spec/unit/source/log_parser_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Source::LogParser do
describe 'parsing request' do
before(:each) do
@log_parser = RequestLogAnalyzer::Source::LogParser.new(testing_format)
end
it "should have multiple line definitions" do
@log_parser.file_format.line_definitions.length.sho... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/common_regular_expressions_spec.rb | spec/unit/file_format/common_regular_expressions_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::CommonRegularExpressions do
include RequestLogAnalyzer::FileFormat::CommonRegularExpressions
describe '.timestamp' do
it 'should parse timestamps with a given format' do
anchored(timestamp('%Y-%m-%dT%H:%M:%S%z')).should =~ '2009-12-03T00:12... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/delayed_job4_format_spec.rb | spec/unit/file_format/delayed_job4_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::DelayedJob do
subject { RequestLogAnalyzer::FileFormat.load(:delayed_job4) }
it { should be_well_formed }
it { should have_line_definition(:job_completed).capturing(:timestamp, :duration, :host, :pid, :job) }
it { should have_line_definition(:job... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/haproxy_format_spec.rb | spec/unit/file_format/haproxy_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Haproxy do
subject { RequestLogAnalyzer::FileFormat.load(:haproxy) }
let(:log_parser) { RequestLogAnalyzer::Source::LogParser.new(subject) }
it { should be_well_formed }
it { should have_line_definition(:haproxy13).capturing(:client_ip, :timesta... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/oink_format_spec.rb | spec/unit/file_format/oink_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Oink do
subject { RequestLogAnalyzer::FileFormat.load(:oink) }
it { should have_line_definition(:memory_usage).capturing(:pid, :memory) }
it { should have_line_definition(:processing).capturing(:pid, :controller, :action, :ip) }
it { should have_... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/line_definition_spec.rb | spec/unit/file_format/line_definition_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::LineDefinition do
subject do
RequestLogAnalyzer::LineDefinition.new(:test,
teaser: /Testing /,
regexp: /Testing (\w+), tries\: (\d+)/,
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/postgresql_format_spec.rb | spec/unit/file_format/postgresql_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Postgresql do
subject { RequestLogAnalyzer::FileFormat.load(:Postgresql) }
let(:log_parser) { RequestLogAnalyzer::Source::LogParser.new(subject) }
it { should be_well_formed }
describe '#parse_line' do
it 'should parse a :query line correct... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/file_format_api_spec.rb | spec/unit/file_format/file_format_api_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat do
describe '.format_definition' do
before(:each) do
@first_file_format = Class.new(RequestLogAnalyzer::FileFormat::Base)
@second_file_format = Class.new(RequestLogAnalyzer::FileFormat::Base)
end
it 'should specify line definit... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/amazon_s3_format_spec.rb | spec/unit/file_format/amazon_s3_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::AmazonS3 do
subject { RequestLogAnalyzer::FileFormat.load(:amazon_s3) }
it { should be_well_formed }
it do
should have_line_definition(:access).capturing(:bucket_owner, :bucket, :timestamp, :remote_ip, :requester,
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/delayed_job_format_spec.rb | spec/unit/file_format/delayed_job_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::DelayedJob do
subject { RequestLogAnalyzer::FileFormat.load(:delayed_job) }
it { should be_well_formed }
it { should have_line_definition(:job_lock).capturing(:job) }
it { should have_line_definition(:job_completed).capturing(:completed_job, :dur... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/w3c_format_spec.rb | spec/unit/file_format/w3c_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::W3c do
subject { RequestLogAnalyzer::FileFormat.load(:w3c) }
it { should be_well_formed }
it do
should have_line_definition(:access).capturing(:timestamp, :remote_ip, :username, :local_ip, :port,
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/inheritance_spec.rb | spec/unit/file_format/inheritance_spec.rb | require 'spec_helper'
class DummyInheritedFromRails3 < RequestLogAnalyzer::FileFormat::Rails3
end
describe DummyInheritedFromRails3 do
subject { RequestLogAnalyzer::FileFormat.load(DummyInheritedFromRails3) }
it { should be_well_formed }
it { subject.report_trackers.length.should == 11 }
end
| ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/delayed_job3_format_spec.rb | spec/unit/file_format/delayed_job3_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::DelayedJob do
subject { RequestLogAnalyzer::FileFormat.load(:delayed_job3) }
it { should be_well_formed }
it { should have_line_definition(:job_completed).capturing(:timestamp, :duration, :host, :pid, :job) }
it { should have_line_definition(:job... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/rails3_format_spec.rb | spec/unit/file_format/rails3_format_spec.rb | # encoding: utf-8
require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Rails3 do
subject { RequestLogAnalyzer::FileFormat.load(:rails3) }
it { should be_well_formed }
it { should satisfy { |ff| ff.report_trackers.length == 11 } }
describe '#parse_line' do
it 'should parse :started lines corre... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/apache_format_spec.rb | spec/unit/file_format/apache_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Apache do
describe '.access_line_definition' do
let(:format_string) { '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i" %T' }
let(:line_definition) { RequestLogAnalyzer::FileFormat::Apache.access_line_definition(format_string) }
it 's... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/format_autodetection_spec.rb | spec/unit/file_format/format_autodetection_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat do
describe '.autodetect' do
it 'should autodetect a Merb log' do
file_format = RequestLogAnalyzer::FileFormat.autodetect(log_fixture(:merb))
file_format.should be_instance_of(RequestLogAnalyzer::FileFormat::Merb)
end
it 'should ... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/rails_format_spec.rb | spec/unit/file_format/rails_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Rails do
describe '.create' do
context 'without providing a lines argument' do
subject { RequestLogAnalyzer::FileFormat::Rails.create }
it { should be_well_formed }
it { should satisfy { |ff| ff.report_trackers.length >= 11 } }
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/delayed_job21_format_spec.rb | spec/unit/file_format/delayed_job21_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::DelayedJob do
subject { RequestLogAnalyzer::FileFormat.load(:delayed_job21) }
it { should be_well_formed }
it { should have_line_definition(:job_lock).capturing(:timestamp, :job, :host, :pid) }
it { should have_line_definition(:job_completed).cap... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/delayed_job2_format_spec.rb | spec/unit/file_format/delayed_job2_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::DelayedJob2 do
subject { RequestLogAnalyzer::FileFormat.load(:delayed_job2) }
it { should be_well_formed }
it { should have_line_definition(:job_lock).capturing(:timestamp, :job, :host, :pid) }
it { should have_line_definition(:job_completed).cap... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/merb_format_spec.rb | spec/unit/file_format/merb_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Merb do
subject { RequestLogAnalyzer::FileFormat.load(:merb) }
it { should be_well_formed }
it { should have_line_definition(:started).capturing(:timestamp) }
it { should have_line_definition(:params).capturing(:controller, :action, :namespace) }... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/rack_format_spec.rb | spec/unit/file_format/rack_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Rack do
subject { RequestLogAnalyzer::FileFormat.load(:rack) }
let(:log_parser) { RequestLogAnalyzer::Source::LogParser.new(subject) }
it { should be_well_formed }
it do
should have_line_definition(:access).capturing(:remote_host, :user, :rem... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/file_format/mysql_format_spec.rb | spec/unit/file_format/mysql_format_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::FileFormat::Mysql do
subject { RequestLogAnalyzer::FileFormat.load(:mysql) }
it { should be_well_formed }
it { should have_line_definition(:time).capturing(:timestamp) }
it { should have_line_definition(:user_host).capturing(:user, :host, :ip) }
it { shoul... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/database/database_spec.rb | spec/unit/database/database_spec.rb | require 'spec_helper'
require 'request_log_analyzer/database'
describe RequestLogAnalyzer::Database do
describe '#load_database_schema!' do
context 'for a Rails request database' do
before(:each) do
@database = RequestLogAnalyzer::Database.new(log_fixture(:rails, :db))
@database.load_data... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/database/base_class_spec.rb | spec/unit/database/base_class_spec.rb | require 'spec_helper'
require 'request_log_analyzer/database'
describe RequestLogAnalyzer::Database::Base do
describe '.subclass_from_line_definition' do
before(:all) do
@line_definition = RequestLogAnalyzer::LineDefinition.new(:test, regexp: /Testing (\w+), tries\: (\d+)/,
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/database/connection_spec.rb | spec/unit/database/connection_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Database::Connection do
describe '.from_string' do
it 'should parse a name-value based string' do
string = 'adapter=sqlite3;database=filename.db'
RequestLogAnalyzer::Database::Connection.from_string(string).should == { adapter: 'sqlite3', database: ... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/aggregator/database_inserter_spec.rb | spec/unit/aggregator/database_inserter_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Aggregator::DatabaseInserter do
before(:all) do
@log_parser = RequestLogAnalyzer::Source::LogParser.new(testing_format)
end
# The prepare method is called before the parsing starts. It should establish a connection
# to a database that is suitable for in... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/spec/unit/aggregator/summarizer_spec.rb | spec/unit/aggregator/summarizer_spec.rb | require 'spec_helper'
describe RequestLogAnalyzer::Aggregator::Summarizer do
before(:each) do
@summarizer = RequestLogAnalyzer::Aggregator::Summarizer.new(mock_source, output: mock_output)
@summarizer.prepare
end
it 'not raise exception when creating a report after aggregating multiple requests' do
... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer.rb | lib/request_log_analyzer.rb | require 'date'
# RequestLogAnalyzer is the base namespace in which all functionality of RequestLogAnalyzer is implemented.
# This module itself contains some functions to help with class and source file loading. The actual
# application startup code resides in the {RequestLogAnalyzer::Controller} class.
#
# The {Reque... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/aggregator.rb | lib/request_log_analyzer/aggregator.rb | module RequestLogAnalyzer::Aggregator
# The base class of an aggregator. This class provides the interface to which
# every aggregator should comply (by simply subclassing this class).
class Base
attr_reader :options, :source
# Intializes a new RequestLogAnalyzer::Aggregator::Base instance
# It will ... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker.rb | lib/request_log_analyzer/tracker.rb | module RequestLogAnalyzer::Tracker
# Base Tracker class. All other trackers inherit from this class
#
# Accepts the following options:
# * <tt>:if</tt> Proc that has to return !nil for a request to be passed to the tracker.
# * <tt>:line_type</tt> The line type that contains the duration field (determined by ... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/mailer.rb | lib/request_log_analyzer/mailer.rb | module RequestLogAnalyzer
# Mail report to a specified emailaddress
class Mailer
attr_accessor :data, :to, :host, :port
# Initialize a mailer
# <tt>to</tt> to email address to mail to
# <tt>host</tt> the mailer host (defaults to localhost)
# <tt>options</tt> Specific style options
#
# O... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/log_processor.rb | lib/request_log_analyzer/log_processor.rb | module RequestLogAnalyzer
# The Logprocessor class is used to perform simple processing actions over log files.
# It will go over the log file/stream line by line, pass the line to a processor and
# write the result back to the output file or stream. The processor can alter the
# contents of the line, remain it... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/source.rb | lib/request_log_analyzer/source.rb | # The RequestLogAnalyzer::Source module contains all functionality that loads requests from a given source
# and feed them to the pipeline for further processing. The requests (see RequestLogAnalyzer::Request) that
# will be parsed from a source, will be piped throug filters (see RequestLogAnalyzer::Filter) and are the... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/version.rb | lib/request_log_analyzer/version.rb | module RequestLogAnalyzer
VERSION = '1.13.4'
end
| ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/filter.rb | lib/request_log_analyzer/filter.rb | module RequestLogAnalyzer::Filter
# Base filter class used to filter input requests.
# All filters should interit from this base.
class Base
attr_reader :file_format, :options
# Initializer
# <tt>format</tt> The file format
# <tt>options</tt> Are passed to the filters.
def initialize(format, ... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/output.rb | lib/request_log_analyzer/output.rb | # Module for generating output
module RequestLogAnalyzer::Output
# Loads a Output::Base subclass instance.
def self.load(file_format, *args)
klass = nil
if file_format.is_a?(RequestLogAnalyzer::Output::Base)
# this already is a file format! return itself
return file_format
elsif file_format... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/file_format.rb | lib/request_log_analyzer/file_format.rb | require 'request_log_analyzer/request'
module RequestLogAnalyzer::FileFormat
autoload :Rails, 'request_log_analyzer/file_format/rails'
autoload :Rails3, 'request_log_analyzer/file_format/rails3'
autoload :RailsDevelopment, 'request_log_analyzer/file_format/rails_development'
autoload :Oink... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/controller.rb | lib/request_log_analyzer/controller.rb | module RequestLogAnalyzer
# The RequestLogAnalyzer::Controller class creates a LogParser instance for the
# requested file format and connect it with sources and aggregators.
#
# Sources are streams or files from which the requests will be parsed.
# Aggregators will handle every passed request to yield a mean... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/request.rb | lib/request_log_analyzer/request.rb | module RequestLogAnalyzer
# The Request class represents a parsed request from the log file.
# Instances are created by the LogParser and are passed to the different aggregators, so they
# can do their aggregating work.
#
# This class provides several methods to access the data that was parsed from the log fi... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
wvanbergen/request-log-analyzer | https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/line_definition.rb | lib/request_log_analyzer/line_definition.rb | module RequestLogAnalyzer
# The line definition class is used to specify what lines should be parsed from the log file.
# It contains functionality to match a line against the definition and parse the information
# from this line. This is used by the LogParser class when parsing a log file..
class LineDefinitio... | ruby | MIT | b83865d440278583ac8e4901bb33878244fd7c75 | 2026-01-04T15:56:56.698958Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.