{"id":16697343,"url":"https://github.com/ryandotsmith/instruments","last_synced_at":"2025-04-10T02:52:54.383Z","repository":{"id":2941193,"uuid":"3953988","full_name":"ryandotsmith/instruments","owner":"ryandotsmith","description":"simple instrumentation of popular ruby libs","archived":false,"fork":false,"pushed_at":"2012-09-12T21:53:23.000Z","size":142,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T15:58:44.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ryandotsmith.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":"2012-04-06T22:14:53.000Z","updated_at":"2017-05-31T05:08:49.000Z","dependencies_parsed_at":"2022-09-21T07:46:31.335Z","dependency_job_id":null,"html_url":"https://github.com/ryandotsmith/instruments","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryandotsmith%2Finstruments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryandotsmith%2Finstruments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryandotsmith%2Finstruments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryandotsmith%2Finstruments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryandotsmith","download_url":"https://codeload.github.com/ryandotsmith/instruments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248147196,"owners_count":21055496,"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-10-12T17:47:09.085Z","updated_at":"2025-04-10T02:52:54.358Z","avatar_url":"https://github.com/ryandotsmith.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instruments\n\nInstruments enables out-of-the-box instrumentation on database \u0026 HTTP\nactivities. Instruments supports the following libraries:\n\n* sinatra\n* sequel\n\n## Usage\n\nProvide Instruments with an object (or module) and a method\nand it will call the method passing a Hash containing the\ninstrumentation data for each time instruments records a metric.\n\n### Sinatra\n\n#### Modular Application\n\n```ruby\nrequire \"sinatra/base\"\nrequire \"instruments\"\nInstruments.defaults = {\n  :logger =\u003e Kernel,\n  :method =\u003e :puts,\n  :default_data =\u003e {:app =\u003e \"your-app-name\"}\n}\n\nclass API \u003c Sinatra::Base\n  register Sinatra::Instrumentation\n  instrument_routes\n\n  get \"/hello/:name\" do\n    params[:name]\n  end\nend\n```\n\n#### Classic Application\n\n```ruby\nrequire \"sinatra\"\nrequire \"instruments\"\nInstruments.defaults = {\n  :logger =\u003e Kernel,\n  :method =\u003e :puts\n}\n\ninstrument_routes\nget \"/hello/:name\" do\n  params[:name]\nend\n```\n\nWhen you hit this endpoint, you will see the following\nin your log stream:\n\n```\nlib=sinatra action=\"http-request\" method=\"get\" route=\"/hello/:name\" status=200 elapsed=0.001\n```\n\n### Sequel\n\n```ruby\nrequire \"sequel\"\nrequire \"instruments\"\n\ndb = Sequel.connect(ENV[\"DATABASE_URL\"])\ndb.execute(\"select 1\")\n```\n\nWill produce:\n\n```\nlib=sequel action=select elapsed_time=0.1 sql=\"select 1\"\n```\n\n### Excon\n\n```ruby\nrequire \"excon\"\nrequire \"instruments\"\n\nconn = Excon.new(\"https://www.heroku.com\")\nconn.get\n```\n\nWill produce:\n\n```\nlib=excon action=http-request elapsed=0\n```\n\n## TODO\n\n* rest-client\n* queue_classic\n* redis\n\n## Links\n\n* https://github.com/sinatra/sinatra/issues/499\n* https://github.com/jeremyevans/sequel/pull/465\n\n## Contributors\n\n* @konstantinhaase\n* @mmcgrana\n* @nzoschke\n* @jeremyevans\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryandotsmith%2Finstruments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryandotsmith%2Finstruments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryandotsmith%2Finstruments/lists"}