All Projects → Shopify → Rotoscope

Shopify / Rotoscope

Licence: mit
High-performance logger of Ruby method invocations

Programming Languages

ruby
36898 projects - #4 most used programming language
introspection
24 projects

Projects that are alternatives of or similar to Rotoscope

Tlaplus
TLC is an explicit state model checker for specifications written in TLA+. The TLA+Toolbox is an IDE for TLA+.
Stars: ✭ 1,618 (+971.52%)
Mutual labels:  high-performance
Threadsx.jl
Parallelized Base functions
Stars: ✭ 126 (-16.56%)
Mutual labels:  high-performance
Lindb
LinDB is a scalable, high performance, high availability distributed time series database.
Stars: ✭ 2,105 (+1294.04%)
Mutual labels:  high-performance
Nanolog
Nanolog is an extremely performant nanosecond scale logging system for C++ that exposes a simple printf-like API.
Stars: ✭ 1,710 (+1032.45%)
Mutual labels:  high-performance
Blasfeo
Basic linear algebra subroutines for embedded optimization
Stars: ✭ 120 (-20.53%)
Mutual labels:  high-performance
Actors
Evaluation of API and performance of different actor libraries
Stars: ✭ 125 (-17.22%)
Mutual labels:  high-performance
Mofuw
mofuw is *MO*re *F*aster, *U*ltra minimal *W*ebserver.
Stars: ✭ 107 (-29.14%)
Mutual labels:  high-performance
Tendis
Tendis is a high-performance distributed storage system fully compatible with the Redis protocol.
Stars: ✭ 2,295 (+1419.87%)
Mutual labels:  high-performance
Rapidoid
Rapidoid - Extremely Fast, Simple and Powerful Java Web Framework and HTTP Server!
Stars: ✭ 1,571 (+940.4%)
Mutual labels:  high-performance
Beecp
A High Performance JDBC Connection Pool
Stars: ✭ 131 (-13.25%)
Mutual labels:  high-performance
Edgedb Python
EdgeDB Python Driver
Stars: ✭ 113 (-25.17%)
Mutual labels:  high-performance
Nnpack
Acceleration package for neural networks on multi-core CPUs
Stars: ✭ 1,538 (+918.54%)
Mutual labels:  high-performance
Easylogger
An ultra-lightweight(ROM<1.6K, RAM<0.3k), high-performance C/C++ log library. | 一款超轻量级(ROM<1.6K, RAM<0.3k)、高性能的 C/C++ 日志库
Stars: ✭ 1,968 (+1203.31%)
Mutual labels:  high-performance
Zanphp
PHP开发面向C10K+的高并发SOA服务 和RPC服务首选框架
Stars: ✭ 1,451 (+860.93%)
Mutual labels:  high-performance
Go Sessions
🔐 The sessions manager for the Go Programming Language. Supports both net/http and fasthttp.
Stars: ✭ 134 (-11.26%)
Mutual labels:  high-performance
Netty Rest
Yet another high performance REST server based on Netty
Stars: ✭ 107 (-29.14%)
Mutual labels:  high-performance
Shadesmar
Fast C++ IPC using shared memory (with msgpack)
Stars: ✭ 126 (-16.56%)
Mutual labels:  high-performance
Siris
DEPRECATED: The community driven fork of Iris. The fastest web framework for Golang!
Stars: ✭ 146 (-3.31%)
Mutual labels:  high-performance
Nuster
A high performance HTTP proxy cache server and RESTful NoSQL cache server based on HAProxy
Stars: ✭ 1,825 (+1108.61%)
Mutual labels:  high-performance
Sunengine
SunEngine – site engine with blog, forum and articles sections features support.
Stars: ✭ 130 (-13.91%)
Mutual labels:  high-performance

Rotoscope

Rotoscope is a high-performance logger of Ruby method invocations.

Status

Build Status Gem Version

Rotoscope is subject to breaking changes in minor versions until 1.0 is available.

Example

require 'rotoscope'

class Dog
  def bark
    Noisemaker.speak('woof!')
  end
end

class Noisemaker
  def self.speak(str)
    puts(str)
  end
end

log_file = File.expand_path('dog_trace.log')
puts "Writing to #{log_file}..."

Rotoscope::CallLogger.trace(log_file) do
  dog1 = Dog.new
  dog1.bark
end

The resulting method calls are saved in the specified dest in the order they were received.

Sample output:

entity,method_name,method_level,filepath,lineno,caller_entity,caller_method_name,caller_method_level
Dog,new,class,example/dog.rb,19,<ROOT>,<UNKNOWN>,<UNKNOWN>
Dog,initialize,instance,example/dog.rb,19,Dog,new,class
Dog,bark,instance,example/dog.rb,20,<ROOT>,<UNKNOWN>,<UNKNOWN>
Noisemaker,speak,class,example/dog.rb,5,Dog,bark,instance
Noisemaker,puts,class,example/dog.rb,11,Noisemaker,speak,class
IO,puts,instance,example/dog.rb,11,Noisemaker,puts,class
IO,write,instance,example/dog.rb,11,IO,puts,instance
IO,write,instance,example/dog.rb,11,IO,puts,instance

API


Public Class Methods

Rotoscope::CallLogger::trace(dest, blacklist: [])

Writes all calls of methods to dest, except for those whose filepath contains any entry in blacklist. dest is either a filename or an IO. Methods invoked at the top of the trace will have a caller entity of <ROOT> and a caller method name of <UNKNOWN>.

Rotoscope::CallLogger.trace(dest) { |rs| ... }
# or...
Rotoscope::CallLogger.trace(dest, blacklist: ["/.gem/"]) { |rs| ... }

Rotoscope::CallLogger::new(dest, blacklist: [])

Same interface as Rotoscope::CallLogger::trace, but returns a Rotoscope::CallLogger instance, allowing fine-grain control via Rotoscope::CallLogger#start_trace and Rotoscope::CallLogger#stop_trace.

rs = Rotoscope::CallLogger.new(dest)
# or...
rs = Rotoscope::CallLogger.new(dest, blacklist: ["/.gem/"])

Public Instance Methods

Rotoscope::CallLogger#trace(&block)

Similar to Rotoscope::CallLogger::trace, but does not need to create a file handle on invocation.

rs = Rotoscope::CallLogger.new(dest)
rs.trace do |rotoscope|
  # code to trace...
end

Rotoscope::CallLogger#start_trace

Begins writing method calls to the dest specified in the initializer.

rs = Rotoscope::CallLogger.new(dest)
rs.start_trace
# code to trace...
rs.stop_trace

Rotoscope::CallLogger#stop_trace

Stops writing method invocations to the dest. Subsequent calls to Rotoscope::CallLogger#start_trace may be invoked to resume tracing.

rs = Rotoscope::CallLogger.new(dest)
rs.start_trace
# code to trace...
rs.stop_trace

Rotoscope::CallLogger#mark(str = "")

Inserts a marker '--- ' to divide output. Useful for segmenting multiple blocks of code that are being profiled. If str is provided, the line will be prefixed by '--- ', followed by the string passed.

rs = Rotoscope::CallLogger.new(dest)
rs.start_trace
# code to trace...
rs.mark('Something goes wrong here') # produces `--- Something goes wrong here` in the output
# more code ...
rs.stop_trace

Rotoscope::CallLogger#close

Flushes the buffer and closes the file handle. Once this is invoked, no more writes can be performed on the Rotoscope::CallLogger object. Sets state to :closed.

rs = Rotoscope::CallLogger.new(dest)
rs.trace { |rotoscope| ... }
rs.close

Rotoscope::CallLogger#state

Returns the current state of the Rotoscope::CallLogger object. Valid values are :open, :tracing and :closed.

rs = Rotoscope::CallLogger.new(dest)
rs.state # :open
rs.trace do
  rs.state # :tracing
end
rs.close
rs.state # :closed

Rotoscope::CallLogger#closed?

Shorthand to check if the state is set to :closed.

rs = Rotoscope::CallLogger.new(dest)
rs.closed? # false
rs.close
rs.closed? # true
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].