{"id":13747325,"url":"https://github.com/kirillshevch/query_track","last_synced_at":"2025-10-08T17:23:28.356Z","repository":{"id":35028952,"uuid":"196345245","full_name":"kirillshevch/query_track","owner":"kirillshevch","description":"Find time-consuming database queries for ActiveRecord-based Rails Apps","archived":false,"fork":false,"pushed_at":"2025-08-19T08:36:03.000Z","size":338,"stargazers_count":303,"open_issues_count":1,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-09-22T04:39:27.446Z","etag":null,"topics":["database","development-tools","performance","query-optimization","rails","slack"],"latest_commit_sha":null,"homepage":"https://link.medium.com/owCvid7iJZ","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/kirillshevch.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-11T07:44:29.000Z","updated_at":"2025-09-10T14:37:31.000Z","dependencies_parsed_at":"2024-06-20T23:24:27.182Z","dependency_job_id":"16ac1956-f24d-4a2a-8189-d22788b1b0c4","html_url":"https://github.com/kirillshevch/query_track","commit_stats":{"total_commits":62,"total_committers":7,"mean_commits":8.857142857142858,"dds":0.4193548387096774,"last_synced_commit":"15261a340e0b61a805a629247bb9b681d83c143f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kirillshevch/query_track","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillshevch%2Fquery_track","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillshevch%2Fquery_track/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillshevch%2Fquery_track/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillshevch%2Fquery_track/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirillshevch","download_url":"https://codeload.github.com/kirillshevch/query_track/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillshevch%2Fquery_track/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278882031,"owners_count":26062213,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["database","development-tools","performance","query-optimization","rails","slack"],"created_at":"2024-08-03T06:01:25.162Z","updated_at":"2025-10-08T17:23:28.341Z","avatar_url":"https://github.com/kirillshevch.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# QueryTrack\n\n[![Gem Version](https://badge.fury.io/rb/query_track.svg)](https://badge.fury.io/rb/query_track)\n[![Maintainability](https://api.codeclimate.com/v1/badges/15b0a6c0a1838b216db8/maintainability)](https://codeclimate.com/github/kirillshevch/query_track/maintainability)\n\nTool for finding time-consuming database queries for ActiveRecord-based Rails Apps. Provides Slack notifications with backtrace, raw SQL, time duration, etc.\n\n## Installation\n\nAdd this line to your application's `Gemfile` and then execute `bundle install`:\n\n```ruby\ngem 'query_track'\n```\n\n## Usage\n\n### SQL Duration Limit\n\nSpecify SQL duration query limit (in seconds):\n\n```ruby\nQueryTrack::Settings.configure do |config|\n  config.duration = 0.5\nend\n```\n\n### Console Log\n\nEnable console logs from config:\n\n```ruby\nQueryTrack::Settings.configure do |config|\n  config.duration = 0.5\n  config.logs = true\nend\n```\n\n# \u003cimg src='https://github.com/kirillshevch/query_track/blob/master/examples/console.jpg' alt='Log Example' /\u003e\n\n### Filters\n\nTo avoid noisy warnings from used gems, and places where fat queries are justified, you can filters SQL by backtrace.\nFor example, you have installed `activeadmin` and want to skip everything from `app/admin`:\n\n```ruby\nQueryTrack::Settings.configure do |config|\n  config.duration = 0.5\n  config.filters = ['app/admin']\nend\n```\n### App Directory\n\nQueryTrack finds the trace by filtering the caller by the app directory.\nBy default, the app directory is set to 'app', the default for Rails apps.\nFor apps that have a non-stanard app directory, this can be set with the `app_dir` config field:\n\n```ruby\nQueryTrack::Settings.configure do |config|\n  config.duration = 0.5\n  config.app_dir = 'backend'\nend\n```\n\n### Enable/Disable toggle\n\nEnable/disable with ENV variables to turn it on/off without code push. By default *QueryTrack* is enabled.\n\n```ruby\nQueryTrack::Settings.configure do |config|\n  config.duration = 0.5\n  config.enabled = ENV['QUERY_TRACK_ENABLED']\nend\n```\n\n### Slack Notifications\n\nTo receive notifications about slow queries into Slack, you need to install [incoming-webhooks](https://slack.com/apps/A0F7XDUAZ-incoming-webhooks) and put link into config file:\n\n```ruby\nQueryTrack::Settings.configure do |config|\n  config.duration = 0.5\n  config.notifications.slack = 'https://hooks.slack.com/services/T0000000/B0000000/C0000000'\nend\n```\n\n# \u003cimg src='https://github.com/kirillshevch/query_track/blob/master/examples/slack.jpg' alt='Incoming Hook Example' /\u003e\n\n## Custom Notifications (Handlers)\n\nYou can write your own handler for slow queries. Send data to any source(for e.g. to logs storage) or make notification for another source(Email, Messengers, etc.)\n\n```ruby\nQueryTrack::Settings.configure do |config|\n  config.duration = 0.5\n  config.notifications.custom_handler = -\u003e (sql, duration, trace) {\n    # data processing...\n  }\nend\n```\n\n## Production Usage Notes\n\nWhen [QueryTrack](https://github.com/kirillshevch/query_track/blob/master/lib/query_track/notifications/slack.rb#L21) send slack hooks, request is executed in separate thread. So there should be no synchronous delays.\n\nSubscription to SQL events and checking duration time actually take insignificant time in milliseconds.\n\nIf your project is horizontally scaled, you can install `query_track` for one of the node to avoid performance degrade for whole application.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/kirillshevch/query_track.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirillshevch%2Fquery_track","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirillshevch%2Fquery_track","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirillshevch%2Fquery_track/lists"}