Class: SidekiqProfilingMiddleware::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_profiling_middleware/util.rb

Constant Summary collapse

BOOTED_AT_FORMAT =
"%m-%d-%H-%M-%S"

Class Method Summary collapse

Class Method Details

.current_epoch_msObject



18
19
20
# File 'lib/sidekiq_profiling_middleware/util.rb', line 18

def self.current_epoch_ms
  (Time.now.utc.to_f * 1000).to_i
end

.default_output_prefix(name) ⇒ Object



6
7
8
# File 'lib/sidekiq_profiling_middleware/util.rb', line 6

def self.default_output_prefix(name)
  "tmp/#{name}_bootedat#{Time.now.strftime(BOOTED_AT_FORMAT)}_"
end

.worker_namesObject



10
11
12
13
14
15
16
# File 'lib/sidekiq_profiling_middleware/util.rb', line 10

def self.worker_names
  # allocate hash for quickly converting class names to
  # nice names a file system would like
  @worker_names ||= Hash.new do |hash, worker_name|
    hash[worker_name] = worker_name.to_s.gsub(/\W+/, "_").gsub(/(^_|_$)/, "")
  end
end