Description
Tool for finding time-consuming database queries for ActiveRecord-based Rails Apps. Provides Slack notifications for with backtrace, raw SQL, time duration, etc.
QueryTrack alternatives and similar gems
Based on the "Database Tools" category.
Alternatively, view QueryTrack alternatives based on common mentions on social networks and blogs.
-
Database Cleaner
Strategies for cleaning databases in Ruby. Can be used to ensure a clean state for testing. -
Active Record Doctor
Identify database issues before they hit production. -
Lol DBA
lol_dba is a small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts. -
Foreigner
Adds foreign key helpers to migrations and correctly dumps foreign keys to schema.rb -
Seed Fu
Advanced seed data handling for Rails, combining the best practices of several methods together. -
Seedbank
Seedbank gives your seed data a little structure. Create seeds for each environment, share seeds between environments and specify dependencies to load your seeds in order. All nicely integrated with simple rake tasks. -
BatchLoader
:zap: Powerful tool for avoiding N+1 DB or HTTP queries -
DatabaseConsistency
The tool to avoid various issues due to inconsistencies and inefficiencies between a database schema and application models. -
Polo
Polo travels through your database and creates sample snapshots so you can work with real world data in development. -
SchemaPlus
SchemaPlus provides a collection of enhancements and extensions to ActiveRecord -
Upsert
Upsert on MySQL, PostgreSQL, and SQLite3. Transparently creates functions (UDF) for MySQL and PostgreSQL; on SQLite3, uses INSERT OR IGNORE. -
OnlineMigrations
Catch unsafe PostgreSQL migrations in development and run them easier in production (code helpers for table/column renaming, changing column type, adding columns with default, background migrations, etc). -
FastPage
Blazing fast pagination for ActiveRecord with deferred joins ⚡️ -
Ruby Whatsapp SDK
A lightweight, efficient Ruby gem for interacting with Whatsapp Cloud API. -
Ruby PG Extras
Ruby PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more. -
ocran
Turn ruby files into .exe files on windows (supported safe fork of ocran) -
PgDriveBackup
Simple solution to make encrypted with ccrypt PostgreSQL backups and storing on Google Drive API -
Perfect Shape
Perfect Shape is a collection of geometric algorithms that are mostly useful for GUI manipulation like checking containment of a point in popular geometric shapes such as rectangle, square, arc, circle, polygon, and paths containing lines, quadratic bézier curves, and cubic bezier curves. Also, some general math algorithms like IEEE-754 Remainder. -
Slack Smart Bot
Create a Slack bot that is smart and so easy to expand, create new bots on demand, run ruby code on chat, create shortcuts... The main scope of this gem is to be used internally in the company so teams can create team channels with their own bot to help them on their daily work, almost everything is suitable to be automated!! slack-smart-bot can create bots on demand, create shortcuts, run ruby code... just on a chat channel. You can access it just from your mobile phone if you want and run those tests you forgot to run, get the results, restart a server... no limits. -
ActiveRecord Setops
Union, Intersect, and Difference set operations for ActiveRecord (also, SQL's UnionAll). -
PgDice
Postgres partitioning built on top of https://github.com/ankane/pgslice -
ActiveRecord::DataIntegrity
Check data integrity for your ActiveRecord models -
Rapidity
Simple but fast Redis-backed distributed rate limiter. Allows you to specify time interval and count within to limit distributed operations. -
bundler-download
Bundler plugin for auto-downloading specified extra files after gem install -
SlackHook
A Simple Interface to Slack Incoming Webhooks Integrations -
PRY-BYETYPO 👋
A Pry plugin that captures exceptions that may arise from typos and deduces the correct command.
PopRuby: Clothing and Accessories for Ruby Developers
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of QueryTrack or a related project?
README
QueryTrack
Tool for finding time-consuming database queries for ActiveRecord-based Rails Apps. Provides Slack notifications with backtrace, raw SQL, time duration, etc.
Installation
Add this line to your application's Gemfile
and then execute bundle install
:
gem 'query_track'
Usage
SQL Duration Limit
Specify SQL duration query limit (in seconds):
QueryTrack::Settings.configure do |config|
config.duration = 0.5
end
Console Log
Enable console logs from config:
QueryTrack::Settings.configure do |config|
config.duration = 0.5
config.logs = true
end
Filters
To avoid noisy warnings from used gems, and places where fat queries are justified, you can filters SQL by backtrace.
For example, you have installed activeadmin
and want to skip everything from app/admin
:
QueryTrack::Settings.configure do |config|
config.duration = 0.5
config.filters = ['app/admin']
end
App Directory
QueryTrack finds the trace by filtering the caller by the app directory.
By default, the app directory is set to 'app', the default for Rails apps.
For apps that have a non-stanard app directory, this can be set with the app_dir
config field:
QueryTrack::Settings.configure do |config|
config.duration = 0.5
config.app_dir = 'backend'
end
Enable/Disable toggle
Enable/disable with ENV variables to turn it on/off without code push. By default QueryTrack is enabled.
QueryTrack::Settings.configure do |config|
config.duration = 0.5
config.enabled = ENV['QUERY_TRACK_ENABLED']
end
Slack Notifications
To receive notifications about slow queries into Slack, you need to install incoming-webhooks and put link into config file:
QueryTrack::Settings.configure do |config|
config.duration = 0.5
config.notifications.slack = 'https://hooks.slack.com/services/T0000000/B0000000/C0000000'
end
Custom Notifications (Handlers)
You 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.)
QueryTrack::Settings.configure do |config|
config.duration = 0.5
config.notifications.custom_handler = -> (sql, duration, trace) {
# data processing...
}
end
Production Usage Notes
When QueryTrack send slack hooks, request is executed in separate thread. So there should be no synchronous delays.
Subscription to SQL events and checking duration time actually take insignificant time in milliseconds.
If your project is horizontally scaled, you can install query_track
for one of the node to avoid performance degrade for whole application.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/kirillshevch/query_track.
License
The gem is available as open source under the terms of the MIT License.
*Note that all licence references and agreements mentioned in the QueryTrack README section above
are relevant to that project's source code only.