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
wvanbergen/request-log-analyzer
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/class_level_inheritable_attributes.rb
lib/request_log_analyzer/class_level_inheritable_attributes.rb
module RequestLogAnalyzer module ClassLevelInheritableAttributes def inheritable_attributes(*args) @inheritable_attributes ||= [:inheritable_attributes] @inheritable_attributes += args args.each do |arg| class_eval %( class << self; attr_accessor :#{arg} end ) 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/database.rb
lib/request_log_analyzer/database.rb
require 'rubygems' require 'active_record' class RequestLogAnalyzer::Database require 'request_log_analyzer/database/connection' include RequestLogAnalyzer::Database::Connection attr_accessor :file_format attr_reader :line_classes def initialize(connection_identifier = nil) @line_classes = [] 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/filter/timespan.rb
lib/request_log_analyzer/filter/timespan.rb
module RequestLogAnalyzer::Filter # Reject all requests not in given timespan # Options # * <tt>:after</tt> Only keep requests after this DateTime. # * <tt>:before</tt> Only keep requests before this DateTime. class Timespan < Base attr_reader :before, :after def initialize(file_format, options = {})...
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/field.rb
lib/request_log_analyzer/filter/field.rb
module RequestLogAnalyzer::Filter # Filter to select or reject a specific field # Options # * <tt>:mode</tt> :reject or :accept. # * <tt>:field</tt> Specific field to accept or reject. # * <tt>:value</tt> Value that the field should match to be accepted or rejected. class Field < Base attr_reader :field...
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/anonymize.rb
lib/request_log_analyzer/filter/anonymize.rb
module RequestLogAnalyzer::Filter # Filter to anonymize parsed values # Options # * <tt>:mode</tt> :reject or :accept. # * <tt>:field</tt> Specific field to accept or reject. # * <tt>:value</tt> Value that the field should match to be accepted or rejected. class Anonymize < Base def generate_random_ip ...
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/frequency.rb
lib/request_log_analyzer/tracker/frequency.rb
module RequestLogAnalyzer::Tracker # Catagorize requests by frequency. # Count and analyze requests for a specific attribute # # === Options # * <tt>:category</tt> Proc that handles the request categorization. # * <tt>:if</tt> Proc that has to return !nil for a request to be passed to the tracker. # * <tt...
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/duration.rb
lib/request_log_analyzer/tracker/duration.rb
module RequestLogAnalyzer::Tracker # Analyze the duration of a specific attribute # # === Options # * <tt>:category</tt> Proc that handles request categorization for given fileformat (REQUEST_CATEGORIZER) # * <tt>:duration</tt> The field containing the duration in the request hash. # * <tt>:if</tt> Proc tha...
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/timespan.rb
lib/request_log_analyzer/tracker/timespan.rb
module RequestLogAnalyzer::Tracker # Determines the datetime of the first request and the last request # Also determines the amount of days inbetween these. # # Accepts the following options: # * <tt>:field</tt> The timestamp field that is looked at. Defaults to :timestamp. # * <tt>:if</tt> Proc that has to...
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/traffic.rb
lib/request_log_analyzer/tracker/traffic.rb
module RequestLogAnalyzer::Tracker # Analyze the average and total traffic of requests # # === Options # * <tt>:category</tt> Proc that handles request categorization for given fileformat (REQUEST_CATEGORIZER) # * <tt>:traffic</tt> The field containing the duration in the request hash. # * <tt>:if</tt> Proc...
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/hourly_spread.rb
lib/request_log_analyzer/tracker/hourly_spread.rb
module RequestLogAnalyzer::Tracker # Determines the average hourly spread of the parsed requests. # This spread is shown in a graph form. # # 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 con...
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/numeric_value.rb
lib/request_log_analyzer/tracker/numeric_value.rb
module RequestLogAnalyzer::Tracker class NumericValue < Base attr_reader :categories # Sets up the numeric value tracker. It will check whether the value and category # options are set that are used to extract and categorize the values during # parsing. Two lambda procedures are created for these tas...
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/log_parser.rb
lib/request_log_analyzer/source/log_parser.rb
module RequestLogAnalyzer::Source # The LogParser class reads log data from a given source and uses a file format definition # to parse all relevent information about requests from the file. A FileFormat module should # be provided that contains the definitions of the lines that occur in the log data. # # De ...
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/mysql.rb
lib/request_log_analyzer/file_format/mysql.rb
module RequestLogAnalyzer::FileFormat class Mysql < Base extend CommonRegularExpressions line_definition :time do |line| line.header = :alternative line.teaser = /\# Time: / line.regexp = /\# Time: (#{timestamp('%y%m%d %k:%M:%S')})/ line.capture(:timestamp).as(:timestamp) 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/file_format/rails.rb
lib/request_log_analyzer/file_format/rails.rb
module RequestLogAnalyzer::FileFormat # Default FileFormat class for Rails logs. # # Instances will be created dynamically based on the lines you want it to parse. You can # specify what lines should be included in the parser by providing a list to the create # method as first argument. class Rails < Base ...
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/oink.rb
lib/request_log_analyzer/file_format/oink.rb
class RequestLogAnalyzer::FileFormat::Oink < RequestLogAnalyzer::FileFormat::Rails # capture the PID HODEL3000_PROCESSING = /\[(\d+)\]: Processing ((?:\w+::)*\w+)#(\w+)(?: to (\w+))? \(for (#{ip_address}) at (#{timestamp('%Y-%m-%d %H:%M:%S')})\) \[([A-Z]+)\]/ # TODO: fix me! line_definition :processing do |lin...
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/delayed_job3.rb
lib/request_log_analyzer/file_format/delayed_job3.rb
module RequestLogAnalyzer::FileFormat # The DelayedJob3 file format parsed log files that are created by DelayedJob 3.0 or higher. # By default, the log file can be found in RAILS_ROOT/log/delayed_job.log class DelayedJob3 < Base extend CommonRegularExpressions line_definition :job_completed do |line| ...
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/delayed_job4.rb
lib/request_log_analyzer/file_format/delayed_job4.rb
module RequestLogAnalyzer::FileFormat # The DelayedJob4 file format parsed log files that are created by DelayedJob 4.0 or higher. # By default, the log file can be found in RAILS_ROOT/log/delayed_job.log class DelayedJob4 < Base extend CommonRegularExpressions line_definition :job_completed do |line| ...
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/rack.rb
lib/request_log_analyzer/file_format/rack.rb
module RequestLogAnalyzer::FileFormat class Rack < Apache def self.create(*args) super(:rack, *args) end end 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/file_format/delayed_job21.rb
lib/request_log_analyzer/file_format/delayed_job21.rb
module RequestLogAnalyzer::FileFormat # The DelayedJob21 file format parsed log files that are created by DelayedJob 2.1 or higher. # By default, the log file can be found in RAILS_ROOT/log/delayed_job.log class DelayedJob21 < Base extend CommonRegularExpressions line_definition :job_lock do |line| ...
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/apache.rb
lib/request_log_analyzer/file_format/apache.rb
module RequestLogAnalyzer::FileFormat # The Apache file format is able to log Apache access.log files. # # The access.log can be configured in Apache to have many different formats. In theory, this # FileFormat can handle any format, but it must be aware of the log formatting that is used # by sending the for...
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/haproxy.rb
lib/request_log_analyzer/file_format/haproxy.rb
module RequestLogAnalyzer::FileFormat class Haproxy < RequestLogAnalyzer::FileFormat::Base extend CommonRegularExpressions # substitute version specific parts of the haproxy entry regexp. def self.compose_regexp(millisecs, backends, counters, connections, queues) %r{ (#{ip_address}):\d+\s #...
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/amazon_s3.rb
lib/request_log_analyzer/file_format/amazon_s3.rb
module RequestLogAnalyzer::FileFormat # FileFormat for Amazon S3 access logs. # # Access logs are disabled by default on Amazon S3. To enable logging, see # http://docs.amazonwebservices.com/AmazonS3/latest/index.html?ServerLogs.html class AmazonS3 < Base extend CommonRegularExpressions line_definiti...
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/delayed_job2.rb
lib/request_log_analyzer/file_format/delayed_job2.rb
module RequestLogAnalyzer::FileFormat # The DelayedJob2 file format parsed log files that are created by DelayedJob 2.0. # By default, the log file can be found in RAILS_ROOT/log/delayed_job.log class DelayedJob2 < Base extend CommonRegularExpressions line_definition :job_lock do |line| line.header...
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/rails3.rb
lib/request_log_analyzer/file_format/rails3.rb
module RequestLogAnalyzer::FileFormat # Default FileFormat class for Rails 3 logs. # # For now, this is just a basic implementation. It will probaby change after # Rails 3 final has been released. class Rails3 < Base extend CommonRegularExpressions # beta4: Started GET "/" for 127.0.0.1 at Wed Jul 07...
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/delayed_job.rb
lib/request_log_analyzer/file_format/delayed_job.rb
module RequestLogAnalyzer::FileFormat # The DelayedJob file format parsed log files that are created by DelayedJob. # By default, the log file can be found in RAILS_ROOT/log/delayed_job.log class DelayedJob < Base line_definition :job_lock do |line| line.header = true line.regexp = /\* \[JOB\] acq...
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/postgresql.rb
lib/request_log_analyzer/file_format/postgresql.rb
module RequestLogAnalyzer::FileFormat # PostgresQL spec 8.3.7 class Postgresql < Base extend CommonRegularExpressions line_definition :query do |line| line.header = true line.teaser = /.*LOG\:/ line.regexp = /(#{timestamp('%Y-%m-%d %k:%M:%S')})\ \S+ \[\d+\]\:\ \[.*\]\ LOG\:\ \ \d+\:\ dura...
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/rails_development.rb
lib/request_log_analyzer/file_format/rails_development.rb
module RequestLogAnalyzer::FileFormat # The RailsDevelopment FileFormat is an extention to the default Rails file format. It includes # all lines of the normal Rails file format, but parses SQL queries and partial rendering lines # as well. class RailsDevelopment < Rails def self.create # puts 'DEPREC...
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/w3c.rb
lib/request_log_analyzer/file_format/w3c.rb
module RequestLogAnalyzer::FileFormat # FileFormat for W3C access logs. class W3c < Base extend CommonRegularExpressions line_definition :access do |line| line.header = true line.footer = true line.regexp = /^(#{timestamp('%Y-%m-%d %H:%M:%S')}) (#{ip_address}) (.*) (#{ip_address}) (\d+) (...
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/merb.rb
lib/request_log_analyzer/file_format/merb.rb
module RequestLogAnalyzer::FileFormat # The Merb file format parses the request header with the timestamp, the params line # with the most important request information and the durations line which contains # the different request durations that can be used for analysis. class Merb < Base extend CommonRegul...
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/nginx.rb
lib/request_log_analyzer/file_format/nginx.rb
module RequestLogAnalyzer::FileFormat class Nginx < Apache def self.create(*args) super(:combined, *args) end end 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/database/source.rb
lib/request_log_analyzer/database/source.rb
class RequestLogAnalyzer::Database::Source < RequestLogAnalyzer::Database::Base def self.create_table! unless database.connection.table_exists?(:sources) database.connection.create_table(:sources) do |t| t.column :filename, :string t.column :mtime, :datetime t.column :filesize, :i...
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/database/warning.rb
lib/request_log_analyzer/database/warning.rb
class RequestLogAnalyzer::Database::Warning < RequestLogAnalyzer::Database::Base def self.create_table! unless database.connection.table_exists?(:warnings) database.connection.create_table(:warnings) do |t| t.column :warning_type, :string, limit: 30, null: false t.column :message, :string ...
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/database/base.rb
lib/request_log_analyzer/database/base.rb
class RequestLogAnalyzer::Database::Base < ActiveRecord::Base self.abstract_class = true def <=>(other) if (source_id.nil? && other.source_id.nil?) || (source_comparison = source_id <=> other.source_id) == 0 lineno <=> other.lineno else source_comparison end end # Handle format manuall...
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/database/connection.rb
lib/request_log_analyzer/database/connection.rb
module RequestLogAnalyzer::Database::Connection def self.from_string(string) hash = {} if string =~ /^(?:\w+=(?:[^;])*;)*\w+=(?:[^;])*$/ string.scan(/(\w+)=([^;]*);?/) { |variable, value| hash[variable.to_sym] = value } elsif string =~ /^(\w+)\:\/\/(?:(?:([^:]+)(?:\:([^:]+))?\@)?([\w\.-]+)\/)?([\w\:...
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/database/request.rb
lib/request_log_analyzer/database/request.rb
class RequestLogAnalyzer::Database::Request < RequestLogAnalyzer::Database::Base # Returns an array of all the Line objects of this request in the correct order. def lines @lines ||= begin lines = [] self.class.reflections.each { |r, _d| lines += send(r).all } lines.sort end end # Cre...
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/database_inserter.rb
lib/request_log_analyzer/aggregator/database_inserter.rb
module RequestLogAnalyzer::Aggregator # The database aggregator will create an SQLite3 database with all parsed request information. # # The prepare method will create a database schema according to the file format definitions. # It will also create ActiveRecord::Base subclasses to interact with the created tab...
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/echo.rb
lib/request_log_analyzer/aggregator/echo.rb
module RequestLogAnalyzer::Aggregator # Echo Aggregator. Writes everything to the screen when it is passed to this aggregator class Echo < Base attr_accessor :warnings def prepare @warnings = [] end # Display every parsed line immediately to the terminal def aggregate(request) puts...
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/summarizer.rb
lib/request_log_analyzer/aggregator/summarizer.rb
module RequestLogAnalyzer::Aggregator class Summarizer < Base class Definer attr_reader :trackers # Initialize tracker array def initialize @trackers = [] end # Initialize tracker summarizer by duping the trackers of another summarizer # <tt>other</tt> The other Summa...
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/fixed_width.rb
lib/request_log_analyzer/output/fixed_width.rb
# coding: utf-8 module RequestLogAnalyzer::Output # Fixed Width output class. # Outputs a fixed width ASCII or UF8 report. class FixedWidth < Base # Mixin module. Will disable any colorizing. module Monochrome def colorize(text, *_options) text end end # Colorize module mo...
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/html.rb
lib/request_log_analyzer/output/html.rb
module RequestLogAnalyzer::Output # HTML Output class. Generated a HTML-formatted report, including CSS. class HTML < Base # def initialize(io, options = {}) # super(io, options) # end def colorize(text, *style) if style.include?(:bold) tag(:strong, text) else text ...
ruby
MIT
b83865d440278583ac8e4901bb33878244fd7c75
2026-01-04T15:56:56.698958Z
false
wvanbergen/request-log-analyzer
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/cli/command_line_arguments.rb
lib/cli/command_line_arguments.rb
module CommandLine class Option attr_reader :name, :alias attr_reader :parameter_count attr_reader :default_value # Rewrites a command line keyword by replacing the underscores with dashes # <tt>sym</tt> The symbol to rewrite def self.rewrite(sym) sym.to_s.gsub(/_/, '-').to_sym 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/cli/database_console_init.rb
lib/cli/database_console_init.rb
# Setup the include path $LOAD_PATH.unshift(File.expand_path('..', File.dirname(__FILE__))) require 'request_log_analyzer' require 'request_log_analyzer/database' $database = RequestLogAnalyzer::Database.new(ENV['RLA_DBCONSOLE_DATABASE']) $database.load_database_schema! $database.register_default_orm_classes! require...
ruby
MIT
b83865d440278583ac8e4901bb33878244fd7c75
2026-01-04T15:56:56.698958Z
false
wvanbergen/request-log-analyzer
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/cli/tools.rb
lib/cli/tools.rb
module CommandLine module Tools extend self # Try to determine the terminal with. # If it is not possible to to so, it returns the default_width. # <tt>default_width</tt> Defaults to 81 def terminal_width(default_width = 81, out = STDOUT) tiocgwinsz = 0x5413 data = [0, 0, 0, 0].pack('...
ruby
MIT
b83865d440278583ac8e4901bb33878244fd7c75
2026-01-04T15:56:56.698958Z
false
wvanbergen/request-log-analyzer
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/cli/database_console.rb
lib/cli/database_console.rb
class DatabaseConsole IRB = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' def initialize(arguments) @arguments = arguments end def run! libraries = ['irb/completion', 'rubygems', 'cli/database_console_init'] libaries_string = libraries.map { |l| "-r #{l}" }.join(' ') ENV['RLA_DBCONSO...
ruby
MIT
b83865d440278583ac8e4901bb33878244fd7c75
2026-01-04T15:56:56.698958Z
false
wvanbergen/request-log-analyzer
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/cli/progressbar.rb
lib/cli/progressbar.rb
# # Ruby/ProgressBar - a text progress bar library # # Copyright (C) 2001-2005 Satoru Takabayashi <satoru@namazu.org> # All rights reserved. # This is free software with ABSOLUTELY NO WARRANTY. # # You can redistribute it and/or modify it under the terms # of Ruby's license. module CommandLine class Progress...
ruby
MIT
b83865d440278583ac8e4901bb33878244fd7c75
2026-01-04T15:56:56.698958Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/acceptance_test_helper.rb
test/acceptance_test_helper.rb
require_relative 'support/current_bundle' Tests::CurrentBundle.instance.assert_appraisal! #--- require 'test_helper' require_relative 'support/acceptance/rails_application_with_shoulda' require_relative 'support/acceptance/matchers/have_output' require_relative 'support/acceptance/matchers/indicate_that_tests_were_...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/test_helper.rb
test/test_helper.rb
require 'pry' require 'pry-byebug' require 'minitest/autorun' require 'minitest/reporters' require 'warnings_logger' require 'shoulda' Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new) WarningsLogger::Spy.call( project_name: 'shoulda', project_directory: Pathname.new('../..').expand_path(__FILE__),...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/support/snowglobe.rb
test/support/snowglobe.rb
require 'snowglobe' Snowglobe.configure do |config| config.project_name = 'shoulda_test' config.temporary_directory = Pathname.new('../../tmp').expand_path(__dir__) end Snowglobe::Project.class_eval do # Snowglobe is missing a delegator for run_n_unit_test_suite, so add it in def_delegators :command_runner, :...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/support/current_bundle.rb
test/support/current_bundle.rb
require 'bundler' require 'appraisal' module Tests class CurrentBundle AppraisalNotSpecified = Class.new(ArgumentError) include Singleton def assert_appraisal! unless appraisal_in_use? message = <<MSG Please run tests starting with `appraisal <appraisal_name>`. Possible appraisals are: ...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/support/acceptance/add_shoulda_to_project.rb
test/support/acceptance/add_shoulda_to_project.rb
module AcceptanceTests class AddShouldaToProject ROOT_DIRECTORY = Pathname.new('../../..').expand_path(__dir__) def self.call(app, options) new(app, options).call end def initialize(app, options) @app = app @options = options end def call app.add_gem 'shoulda', gem_o...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/support/acceptance/rails_application_with_shoulda.rb
test/support/acceptance/rails_application_with_shoulda.rb
require_relative 'add_shoulda_to_project' require_relative '../snowglobe' module AcceptanceTests class RailsApplicationWithShoulda < Snowglobe::RailsApplication def create super bundle.updating do bundle.add_gem 'minitest-reporters' AddShouldaToProject.call( self, ...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/support/acceptance/helpers/pluralization_helpers.rb
test/support/acceptance/helpers/pluralization_helpers.rb
module AcceptanceTests module PluralizationHelpers def pluralize(count, singular_version, plural_version = nil) plural_version ||= "#{singular_version}s" if count == 1 "#{count} #{singular_version}" else "#{count} #{plural_version}" end end end end
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/support/acceptance/helpers/array_helpers.rb
test/support/acceptance/helpers/array_helpers.rb
module AcceptanceTests module ArrayHelpers def to_sentence(array) if array.size == 1 array[0] elsif array.size == 2 array.join(' and ') else to_sentence(array[1..-2].join(', '), [array[-1]]) end end end end
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/support/acceptance/matchers/indicate_that_tests_were_run.rb
test/support/acceptance/matchers/indicate_that_tests_were_run.rb
require_relative '../helpers/array_helpers' require_relative '../helpers/pluralization_helpers' module AcceptanceTests module Matchers def indicate_that_tests_were_run(series) IndicateThatTestsWereRunMatcher.new(series) end class IndicateThatTestsWereRunMatcher include ArrayHelpers inc...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/support/acceptance/matchers/have_output.rb
test/support/acceptance/matchers/have_output.rb
module AcceptanceTests module Matchers def have_output(output) HaveOutputMatcher.new(output) end # rubocop:enable Naming/PredicateName class HaveOutputMatcher def initialize(output) @output = output end def matches?(runner) @runner = runner runner.has_...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/test/acceptance/integrates_with_rails_test.rb
test/acceptance/integrates_with_rails_test.rb
require 'acceptance_test_helper' class ShouldaIntegratesWithRailsTest < AcceptanceTest # rubocop:disable Metrics/MethodLength def setup app.create app.write_file 'db/migrate/1_create_users.rb', <<-FILE class CreateUsers < #{app.migration_class_name} def self.up create_table :catego...
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/lib/shoulda.rb
lib/shoulda.rb
require 'shoulda/version' require 'shoulda/matchers' require 'shoulda/context'
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
thoughtbot/shoulda
https://github.com/thoughtbot/shoulda/blob/9d2b2e23921b3c7f6973582fea88961306734963/lib/shoulda/version.rb
lib/shoulda/version.rb
module Shoulda VERSION = '5.0.0.rc1'.freeze end
ruby
MIT
9d2b2e23921b3c7f6973582fea88961306734963
2026-01-04T15:57:11.669788Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/gzip_helper.rb
spec/gzip_helper.rb
require 'stringio' require 'zlib' # Simple gzip encoder/decoder for testing def gzip_compress(s) io = StringIO.new('w') w = Zlib::GzipWriter.new(io) w.write(s) w.close io.string end def gzip_decompress(s) Zlib::GzipReader.new(StringIO.new(s, 'rb')).read end
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/spec_helper.rb
spec/spec_helper.rb
require 'bundler/setup' require 'simplecov' require 'resolv' require 'pry-byebug' SimpleCov.start do add_filter "/spec/" end require 'minitest/autorun' require 'rr' def compose_or_localhost(key) Resolv::DNS.new.getaddress(key) rescue "localhost" end
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/worker_handlers_spec.rb
spec/sneakers/worker_handlers_spec.rb
require 'spec_helper' require 'sneakers' require 'sneakers/handlers/oneshot' require 'sneakers/handlers/maxretry' require 'json' # Specific tests of the Handler implementations you can use to deal with job # results. These tests only make sense with a worker that requires acking. class HandlerTestWorker include Sn...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/workergroup_spec.rb
spec/sneakers/workergroup_spec.rb
require 'logger' require 'spec_helper' require 'sneakers' require 'sneakers/runner' class DummyFlag def wait_for_set(*) true end end class DummyEngine include Sneakers::WorkerGroup attr_reader :config def initialize(config) @config = config @stop_flag = DummyFlag.new end end class DefaultsW...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/content_encoding_spec.rb
spec/sneakers/content_encoding_spec.rb
require 'spec_helper' require 'gzip_helper' require 'sneakers/content_encoding' describe Sneakers::ContentEncoding do after do Sneakers::ContentEncoding.reset! end describe '.decode' do it 'uses the given decoder' do Sneakers::ContentEncoding.register( content_encoding: 'gzip', enc...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/sneakers_spec.rb
spec/sneakers/sneakers_spec.rb
require 'spec_helper' require 'sneakers' class EnvWorker include Sneakers::Worker from_queue 'defaults' def work(msg) end end describe Sneakers do before do Sneakers.clear! end describe 'self' do it 'should have defaults set up' do _(Sneakers::CONFIG[:log]).must_equal(STDOUT) end ...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/integration_spec.rb
spec/sneakers/integration_spec.rb
require 'spec_helper' require 'sneakers' require 'sneakers/runner' require 'fixtures/integration_worker' require "rabbitmq/http/client" require 'timeout' describe "integration" do describe 'first' do before :each do skip unless ENV['INTEGRATION'] prepare end def integration_log(msg) ...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/configuration_spec.rb
spec/sneakers/configuration_spec.rb
require 'spec_helper' describe Sneakers::Configuration do describe 'with a connection' do let(:connection) { Object.new } it 'does not use vhost option if it is specified' do url = 'amqp://foo:bar@localhost:5672/foobarvhost' with_env('RABBITMQ_URL', url) do config = Sneakers::Configurat...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/queue_spec.rb
spec/sneakers/queue_spec.rb
require 'spec_helper' require 'sneakers' describe Sneakers::Queue do let :queue_vars do { :prefetch => 25, :ack => true, :heartbeat => 2, :vhost => '/', :exchange => "sneakers", :exchange_options => { :type => :direct, durable: true, :arguments => { 'x-...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/cli_spec.rb
spec/sneakers/cli_spec.rb
require 'spec_helper' require 'sneakers' require 'sneakers/cli' require 'sneakers/runner' describe Sneakers::CLI do describe "#work" do before do any_instance_of(Sneakers::Runner) do |runner| stub(runner).run{ true } end end after do # require cleanup Object.send(:remove_...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/worker_spec.rb
spec/sneakers/worker_spec.rb
require 'spec_helper' require 'gzip_helper' require 'sneakers' require 'serverengine' class DummyWorker include Sneakers::Worker from_queue 'downloads', :exchange_options => { :type => :topic, :durable => false, :auto_delete => true, :argumen...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/publisher_spec.rb
spec/sneakers/publisher_spec.rb
require 'spec_helper' require 'gzip_helper' require 'sneakers' require 'serverengine' describe Sneakers::Publisher do let :pub_vars do { :prefetch => 25, :durable => true, :ack => true, :heartbeat => 2, :vhost => '/', :exchange => "sneakers", :exchange_type => :direct, ...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/runner_spec.rb
spec/sneakers/runner_spec.rb
require 'logger' require 'spec_helper' require 'sneakers' require 'sneakers/runner' describe Sneakers::Runner do let(:logger) { Logger.new('log/logtest.log') } describe "with configuration that specifies a logger object" do before do Sneakers.configure(log: logger) @runner = Sneakers::Runner.new([...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/content_type_spec.rb
spec/sneakers/content_type_spec.rb
require 'spec_helper' require 'sneakers/content_type' require 'base64' describe Sneakers::ContentType do after do Sneakers::ContentType.reset! end describe '.deserialize' do it 'uses the given deserializer' do Sneakers::ContentType.register( content_type: 'application/json', serial...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/tasks/sneakers_run_spec.rb
spec/sneakers/tasks/sneakers_run_spec.rb
require 'spec_helper' require 'sneakers' require 'rake' require 'sneakers/tasks' describe 'Worker classes run by rake sneakers:run' do class TestWorker include Sneakers::Worker end class TestClass1 < TestWorker; end class TestClass2 < TestWorker; end def with_workers_env(workers) undefine, restore =...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/support/utils_spec.rb
spec/sneakers/support/utils_spec.rb
require 'spec_helper' require 'sneakers' describe Sneakers::Utils do describe '::parse_workers' do before(:all) do class Foo; end class Bar; end class Baz class Quux; end class Corge; end end end describe 'given a single class name' do describe 'without name...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/concerns/metrics_spec.rb
spec/sneakers/concerns/metrics_spec.rb
require 'spec_helper' require 'sneakers' require 'logger' class Foometrics include Sneakers::Concerns::Metrics end describe Sneakers::Concerns::Metrics do describe ".configure" do before do Foometrics.metrics = nil end it "should configure a default logger when included" do _(Foometrics....
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/sneakers/concerns/logging_spec.rb
spec/sneakers/concerns/logging_spec.rb
require 'spec_helper' require 'sneakers' require 'logger' class Foobar include Sneakers::Concerns::Logging end describe Sneakers::Concerns::Logging do describe ".configure" do before do Foobar.logger = nil end it "should configure a default logger when included" do _(Foobar.logger).must_...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/fixtures/integration_worker.rb
spec/fixtures/integration_worker.rb
require 'sneakers' require 'thread' require 'redis' redis_addr = compose_or_localhost("redis") puts "REDIS is at #{redis_addr}" $redis = Redis.new(:host => redis_addr) class IntegrationWorker include Sneakers::Worker def work(msg) $redis.incr(self.class.queue_name) ack! end end
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/spec/fixtures/require_worker.rb
spec/fixtures/require_worker.rb
require 'sneakers' require 'open-uri' class TitleScraper include Sneakers::Worker from_queue 'downloads' def work(msg) title = extract_title(open(msg)) logger.info "FOUND <#{title}>" ack! end private def extract_title(html) html =~ /<title>(.*?)<\/title>/ $1 end end
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/examples/middleware_worker.rb
examples/middleware_worker.rb
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' require 'sneakers/runner' class MiddlewareWorker include Sneakers::Worker from_queue 'middleware-demo', ack: false def work(message) puts "******** MiddlewareWorker -> #{message}" end end class DemoMiddleware def initializ...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/examples/metrics_worker.rb
examples/metrics_worker.rb
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' require 'sneakers/runner' require 'sneakers/metrics/logging_metrics' require 'open-uri' class MetricsWorker include Sneakers::Worker from_queue 'downloads' def work(msg) title = extract_title(open(msg)) logger.info "FOUND <#{t...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/examples/newrelic_metrics_worker.rb
examples/newrelic_metrics_worker.rb
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' require 'sneakers/runner' require 'sneakers/metrics/newrelic_metrics' require 'open-uri' require 'newrelic_rpm' # With this configuration will send two types of data to newrelic server: # 1. Transaction data which you would see under 'Applica...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/examples/profiling_worker.rb
examples/profiling_worker.rb
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' require 'sneakers/runner' require 'logger' profiling = ARGV[0] messages = 100_000 if profiling require 'ruby-prof' messages /= 100 # profiling makes everything much slower (around 300req/s) end Sneakers.configure Sneakers.logger.level ...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/examples/max_retry_handler.rb
examples/max_retry_handler.rb
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' require 'sneakers/runner' require 'sneakers/handlers/maxretry' require 'logger' Sneakers.configure(:handler => Sneakers::Handlers::Maxretry, :workers => 1, :threads => 1, :prefetch => 1,...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/examples/workflow_worker.rb
examples/workflow_worker.rb
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' class WorkflowWorker include Sneakers::Worker from_queue 'downloads', exchange_options: { durable: false }, queue_options: { durable: false }, :ack => true, :threads => 50, :...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/examples/benchmark_worker.rb
examples/benchmark_worker.rb
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' class BenchmarkWorker include Sneakers::Worker from_queue 'downloads', exchange_options: { durable: false }, queue_options: { durable: false }, :ack => true, :threads => 50, ...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/examples/title_scraper.rb
examples/title_scraper.rb
require "sneakers" require 'open-uri' require 'logger' def compose_or_localhost(key) Resolv::DNS.new.getaddress(key) rescue "localhost" end rmq_addr = compose_or_localhost("rabbitmq") Sneakers.configure :log => STDOUT, :amqp => "amqp://guest:guest@#{rmq_addr}:5672" Sneakers.logger.level = Logger::INFO class Ti...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers.rb
lib/sneakers.rb
require 'sneakers/version' require 'concurrent/executors' require 'bunny' require 'logger' require 'serverengine' module Sneakers module Handlers end module Concerns end end require 'sneakers/configuration' require 'sneakers/errors' require 'sneakers/support/production_formatter' require 'sneakers/concerns/lo...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/workergroup.rb
lib/sneakers/workergroup.rb
module Sneakers module WorkerGroup @workers = [] def initialize @stop_flag = ServerEngine::BlockingFlag.new end def before_fork fbefore = Sneakers::CONFIG[:hooks][:before_fork] fbefore.call if fbefore end def after_fork # note! this is not Serverengine#after_start, this is...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/version.rb
lib/sneakers/version.rb
module Sneakers VERSION = "2.13.0.pre" end
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/content_type.rb
lib/sneakers/content_type.rb
module Sneakers class ContentType def self.register(content_type: nil, serializer: nil, deserializer: nil) # This can be removed when support is dropped for ruby 2.0 and replaced # by a keyword arg with no default value fail ArgumentError, 'missing keyword: content_type' if content_type.nil? ...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/error_reporter.rb
lib/sneakers/error_reporter.rb
# Ripped off from https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/exception_handler.rb module Sneakers module ErrorReporter class DefaultLogger def call(exception, worker, context_hash) Sneakers.logger.warn(context_hash) unless context_hash.empty? log_string = '' log_strin...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/errors.rb
lib/sneakers/errors.rb
module Sneakers end
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/publisher.rb
lib/sneakers/publisher.rb
module Sneakers class Publisher attr_reader :exchange, :channel def initialize(opts = {}) @mutex = Mutex.new @opts = Sneakers::CONFIG.merge(opts) # If we've already got a bunny object, use it. This allows people to # specify all kinds of options we don't need to know about (e.g. for...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/queue.rb
lib/sneakers/queue.rb
class Sneakers::Queue attr_reader :name, :opts, :exchange, :channel def initialize(name, opts) @name = name @opts = opts @handler_klass = Sneakers::CONFIG[:handler] end # # :exchange # :heartbeat_interval # :prefetch # :durable # :ack # def subscribe(worker) # If we've already g...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/configuration.rb
lib/sneakers/configuration.rb
require 'sneakers/error_reporter' require 'forwardable' module Sneakers class Configuration extend Forwardable def_delegators :@hash, :to_hash, :[], :[]=, :==, :fetch, :delete, :has_key? EXCHANGE_OPTION_DEFAULTS = { :type => :direct, :durable => true, :auto_de...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/runner.rb
lib/sneakers/runner.rb
require 'serverengine' require 'sneakers/workergroup' module Sneakers class Runner def initialize(worker_classes, opts={}) @runnerconfig = RunnerConfig.new(worker_classes, opts) end def run @se = ServerEngine.create(nil, WorkerGroup) { @runnerconfig.reload_config! } @se.run end ...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/cli.rb
lib/sneakers/cli.rb
require 'thor' require 'sneakers/runner' # # $ sneakers work TitleWorker,FooWorker # $ sneakers stop # $ sneakers recycle # $ sneakers reload # $ sneakers init # # module Sneakers class CLI < Thor SNEAKERS=<<-EOF __ ,--' > Sneakers `===== EOF BANNER = SNEAKERS method_option :d...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/spawner.rb
lib/sneakers/spawner.rb
require 'yaml' require 'erb' module Sneakers class Spawner def self.spawn worker_group_config_file = ENV['WORKER_GROUP_CONFIG'] || './config/sneaker_worker_groups.yml' unless File.exist?(worker_group_config_file) puts 'No worker group file found.' puts "Specify via ENV 'WORKER_GROUP_C...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/worker.rb
lib/sneakers/worker.rb
require 'sneakers/queue' require 'sneakers/support/utils' module Sneakers module Worker attr_reader :queue, :id, :opts # For now, a worker is hardly dependant on these concerns # (because it uses methods from them directly.) include Concerns::Logging include Concerns::Metrics include Sneaker...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false
jondot/sneakers
https://github.com/jondot/sneakers/blob/9780692624c666b6db8266d2d5710f709cb0f2e2/lib/sneakers/tasks.rb
lib/sneakers/tasks.rb
require 'sneakers' require 'sneakers/runner' task :environment namespace :sneakers do desc "Start work (set $WORKERS=Klass1,Klass2)" task :run do Sneakers.server = true Rake::Task['environment'].invoke if defined?(::Rails) if Rails.autoloaders.zeitwerk_enabled? ::Zeitwerk::Loader.eager_...
ruby
MIT
9780692624c666b6db8266d2d5710f709cb0f2e2
2026-01-04T15:56:53.982751Z
false