{"id":27974693,"url":"https://github.com/scoutapp/ruby_server_timing","last_synced_at":"2025-05-16T11:06:43.238Z","repository":{"id":56895106,"uuid":"123516577","full_name":"scoutapp/ruby_server_timing","owner":"scoutapp","description":"Bring Rails server-side performance metrics 📈 to Chrome's Developer Tools via the Server Timing API. Production Safe™.","archived":false,"fork":false,"pushed_at":"2018-03-24T13:08:29.000Z","size":63,"stargazers_count":514,"open_issues_count":1,"forks_count":6,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-05-08T00:28:32.454Z","etag":null,"topics":["apm","monitoring","performance"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scoutapp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-02T02:01:04.000Z","updated_at":"2025-05-03T20:18:37.000Z","dependencies_parsed_at":"2022-08-21T01:20:41.927Z","dependency_job_id":null,"html_url":"https://github.com/scoutapp/ruby_server_timing","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutapp%2Fruby_server_timing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutapp%2Fruby_server_timing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutapp%2Fruby_server_timing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutapp%2Fruby_server_timing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scoutapp","download_url":"https://codeload.github.com/scoutapp/ruby_server_timing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"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":["apm","monitoring","performance"],"created_at":"2025-05-08T00:19:38.759Z","updated_at":"2025-05-16T11:06:38.219Z","avatar_url":"https://github.com/scoutapp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Server Timing Response Headers for Rails\n\nBring Ruby on Rails server-side performance metrics 📈 to Chrome's Developer Tools (and other browsers that support the [Server Timing API](https://w3c.github.io/server-timing/)) via the `server_timing` gem. Production Safe™.\n\nMetrics are collected from the [scout_apm](https://github.com/scoutapp/scout_apm_ruby) gem. A [Scout](https://scoutapp.com) account is not required.\n\n![server timing screenshot](https://s3-us-west-1.amazonaws.com/scout-blog/ruby_server_timing.png?x)\n\n## Gem Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'server_timing'\n```\n\nAnd then execute:\n\n    $ bundle\n\n## Configuration\n\nA minimal Scout config file is required. The `server_timing` gem reports metrics collected by the [scout_apm](https://github.com/scoutapp/scout_apm_ruby) gem (added as a dependency of `server_timing`).\n\nIf you don't have a Scout account, copy and paste the following minimal configuration into a `RAILS_ROOT/config/scout_apm.yml` file:\n\n```yaml\ncommon: \u0026defaults\n  monitor: true\n\nproduction:\n  \u003c\u003c: *defaults\n```\n\nIf you have a Scout account, no extra configuration is required. If you wish to see server timing metrics in development, ensure `monitor: true` is set for the `development` environment in the `scout_apm.yml` file.\n\n[See the scout_apm configuration reference](http://help.apm.scoutapp.com/#ruby-configuration-options) for more information.\n\n## Browser Support\n\n- Chrome 65+ (Chrome 64 uses an [old format](https://github.com/scoutapp/ruby_server_timing/issues/5#issuecomment-370504687) of the server timing headers. This isn't supported by the gem).\n- Firefox 59+\n- Opera 52+\n\n## Instrumentation\n\n### Auto-Instrumentation\n\nBy default, the total time consumed by each of the libraries `scout_apm` instruments is reported. This includes ActiveRecord, HTTP, Redis, and more. [View the full list of supported libraries](http://help.apm.scoutapp.com/#ruby-instrumented-libs). \n\n### Custom Instrumentation\n\nCollect performance data on additional method calls by adding custom instrumentation via `scout_apm`. [See the docs for instructions](http://help.apm.scoutapp.com/#ruby-custom-instrumentation).\n\n## Security\n\n* Non-Production Environments (ex: development, staging) - Server timing response headers are sent by default. \n* Production - The headers must be enabled.\n\nResponse headers can be enabled in production by calling `ServerTiming::Auth.ok!`:\n\n```ruby\n# app/controllers/application_controller.rb\n\nbefore_action do\n  if current_user \u0026\u0026 current_user.admin?\n    ServerTiming::Auth.ok!\n  end\nend\n```\n\nTo only enable response headers in development and for admins in production:\n\n```ruby\n# app/controllers/application_controller.rb\n\nbefore_action do\n  if current_user \u0026\u0026 current_user.admin?\n    ServerTiming::Auth.ok!\n  elsif Rails.env.development?\n    ServerTiming::Auth.ok!\n  else\n    ServerTiming::Auth.deny!\n  end\nend\n```\n\n## Overhead\n\nThe `scout_apm` gem, a dependency of `server_timing`, applies [low overhead instrumentation](http://blog.scoutapp.com/articles/2016/02/07/overhead-benchmarks-new-relic-vs-scout) designed for production use.\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/scoutapp/ruby_server_timing.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscoutapp%2Fruby_server_timing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscoutapp%2Fruby_server_timing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscoutapp%2Fruby_server_timing/lists"}