{"id":20836301,"url":"https://github.com/igrigorik/rack-speedtracer","last_synced_at":"2025-04-09T17:22:37.210Z","repository":{"id":56890242,"uuid":"781044","full_name":"igrigorik/rack-speedtracer","owner":"igrigorik","description":"SpeedTracer middleware for server side debugging","archived":false,"fork":false,"pushed_at":"2014-01-31T16:40:24.000Z","size":225,"stargazers_count":155,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T11:47:13.802Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.igvita.com/2010/07/19/speed-tracer-server-side-tracing-with-rack/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igrigorik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-07-17T23:29:58.000Z","updated_at":"2024-10-13T20:25:50.000Z","dependencies_parsed_at":"2022-08-21T00:50:27.139Z","dependency_job_id":null,"html_url":"https://github.com/igrigorik/rack-speedtracer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Frack-speedtracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Frack-speedtracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Frack-speedtracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Frack-speedtracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igrigorik","download_url":"https://codeload.github.com/igrigorik/rack-speedtracer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248075265,"owners_count":21043556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T00:29:27.717Z","updated_at":"2025-04-09T17:22:37.187Z","avatar_url":"https://github.com/igrigorik.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Rack::SpeedTracer\n=========\n\nBlog post: [Speed Tracer Server-side Tracing with Rack](http://www.igvita.com/2010/07/19/speed-tracer-server-side-tracing-with-rack/)\n\nRack::SpeedTracer middleware provides server-side tracing capabilities to any Rack compatible app. Include the middleware, instrument your application, and then load it in your Google Chrome + SpeedTracer to view detailed breakdown of your JavaScript/CSS load times, GC cycles, as well as, server side performance data provided by this middleware - you can preview both server side and client side performance data all within the same view in SpeedTracer!\n\nPreview of a sample, server side Rails trace (see below for setup) in SpeedTracer:\n![rails trace](http://img.skitch.com/20100717-cd31bhd5dh13sge7c2q1hefh4p.png)\n\nFeatures\n---------\n\n* Auto Rails 3 instrumentation (see example below)\n* Memory, or Redis storage backend\n  * Redis backend allows trace expiration (via :trace_ttl), and custom namespaces (via :namespace)\n\nTodo / Wishlist\n---------------\n\n* Authentication / optional enable, ala rack-bug: IP-based, password based\n  * At the moment, every request will record \u0026 store a trace\n  * Could also do conditional tracing based on a request header: 'X-SpeedTracer: true'\n\nWithout authentication, I wouldn't recommend running this middleware in production, unless you add some extra logic. For a capped memory footprint, use Redis backend with a TTL to expire your traces after some reasonable amount of time.\n\nHow it works\n------------\n\nRack::SpeedTracer provides a Tracer class which you can use to instrument your code. From there, the trace details are stored as a JSON blob, and a special X-TraceUrl header is sent back to the client. If the user clicks on the network resource that corresponds to a request which returned a X-TraceUrl header, then SpeedTracer will make a request to our app to load the server side trace. Rack::SpeedTracer responds to this request and returns the full trace - aka, the data is provided on demand.\n\n### Quickstart Guide with Rack ###\n\n```ruby\ngem install rack-speedtracer\n\n# in your rack app / rackup file\nuse Rack::SpeedTracer\n\n# in your app\nenv['st.tracer'].run('name of operation') do\n  ... your code ...\nend\n```\n\nCheck out a full sample rack app: examples/runner.rb\n\n### Instrumenting Rails 3 application ###\nRails 3 provides new [Notifications API](http://edgeapi.rubyonrails.org/classes/ActiveSupport/Notifications.html), which we can use to automatically instrument your Rails applications! It's as easy as:\n\n```ruby\n# in your Gemfile\ngem 'rack-speedtracer', :require =\u003e 'rack/speedtracer'\n\n# in development.rb environment\nconfig.middleware.use Rack::SpeedTracer\n```\n\n### Manually instrumenting Rails ###\nTo produce a server-side trace equivalent to one in the screenshot above:\n\n```ruby\n# in your Gemfile\ngem 'rack-speedtracer', :require =\u003e 'rack/speedtracer'\n\n# in development.rb environment\nconfig.middleware.use Rack::SpeedTracer\n\n# define a widgets controller\nclass WidgetsController \u003c ApplicationController\n  def index\n    env['st.tracer'].run('Widgets#index') do\n      env['st.tracer'].run(\"ActiveRecord: Widgets.all\") do\n        Widget.all\n      end\n\n      env['st.tracer'].run('Render') { render :text =\u003e 'oh hai' }\n    end\n  end\nend\n```\n\nSpeed Tracer\n------------\n\nSpeed Tracer is a Google Chrome extension to help you identify and fix performance problems in your web applications. It visualizes metrics that are taken from low level instrumentation points inside of the browser and analyzes them as your application runs. Speed Tracer is available as a Chrome extension and works on all platforms where extensions are currently supported (Windows and Linux).\n\nUsing Speed Tracer you are able to get a better picture of where time is being spent in your application. This includes problems caused by JavaScript parsing and execution, layout, CSS style recalculation and selector matching, DOM event handling, network resource loading, timer fires, XMLHttpRequest callbacks, painting, and more.\n\n* [Official SpeedTracer site](http://code.google.com/webtoolkit/speedtracer/)\n* [Install SpeedTracer](http://code.google.com/webtoolkit/speedtracer/get-started.html#downloading)\n* [Getting Started](http://code.google.com/webtoolkit/speedtracer/speed-tracer-examples.html)\n* [Google Group](https://groups.google.com/group/speedtracer/topics)\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright © 2010 Ilya Grigorik\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrigorik%2Frack-speedtracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figrigorik%2Frack-speedtracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrigorik%2Frack-speedtracer/lists"}