Skip to content

oslabs-beta/QueryHawk

logo_queryhawk

QueryHawk

Get a hawk-eyed look at your query performance.

Monitor and Analyze Your SQL Performance and Database Health

QueryHawk monitors and visualizes key SQL metrics to help users improve database and query performance. A central dashboard monitors database health. Containers ensure a consistent environment for all users.

Table of Contents

Introduction

QueryHawk delivers comprehensive SQL database monitoring and visualization, empowering developers and database administrators to optimize performance and quickly identify bottlenecks. Built on industry-standard tools including Prometheus, Grafana, and PostgreSQL Exporter, all containerized with Docker for seamless deployment.

  • โœ… Real-time SQL query analysis with millisecond-precision execution metrics
  • โœ… Complete visibility into query execution plans with detailed buffer and cache statistics
  • โœ… Interactive dashboards for visualizing database health and performance trends
  • โœ… Query comparison tool to benchmark and optimize SQL performance
  • โœ… Track query execution paths across entire application with distributed tracing

With QueryHawk's intuitive interface, teams can proactively manage database performance, reduce troubleshooting time, and make data-driven optimization decisions. The containerized architecture ensures easy deployment across development, staging, and production environments.

Gain insights into your SQL databases and enhance how your team approaches database performance optimization with QueryHawk.

Features

๐Ÿ” Deep SQL Query Analysis

  • Execution Plan Visibility: Analyze "EXPLAIN ANALYZE" results with detailed metrics on planning time, execution time, and resource usage.
  • Cache Performance Metrics: Monitor cache hit ratios and buffer statistics to identify memory optimization opportunities.
  • Query Comparison: Evaluate startup and total costs for queries to understand their impact on database resources.
  • Secure Connection Testing: Connect to any PostgreSQL database with SSL support and connection validation.
  • Query Performance Profiling: Test queries before deployment with comprehensive performance metrics.
  • Historical Comparison: Store and compare query performance over time to track optimization progress.

๐Ÿ“Š Real-time Performance Monitoring

Once connected, QueryHawk will display multiple metrics, including:

  • Transaction rate
  • Cache hit ratio
  • Active connections
  • Tuple operations
  • Lock metrics
  • I/O statistics
  • Index usage
  • Transaction commits vs. rollbacks
  • Long-running queries

๐Ÿซฅ Tracing Requests

QueryHawk includes distributed tracing capabilities:

  • View the Jaeger dashboard embedded in the UI
  • Track request flows through your application
  • Identify performance bottlenecks
  • Debug slow queries

๐Ÿ› ๏ธ Enterprise-Ready Architecture

  • Docker-based Deployment: Quickly deploy the entire monitoring stack with Docker Compose.
  • Secure Authentication: GitHub OAuth integration for secure user management.
  • Dynamic Exporters: Automatically create and manage PostgreSQL exporters.

Initial Set-up and Installation

๐Ÿ”ง Prerequisites

  • Docker and Docker Compose
  • PostgreSQL database
  • GitHub account (for OAuth)

๐Ÿ’ป Installation

  1. Clone the repository:
git clone [repository-url]
cd queryhawk
  1. Download Docker Desktop, install, and open.

  2. Configure environment variables

  • Create .env in the root directory
  • Input and configure environment variables
# Example fields (please update with your real values for each one)
POSTGRES_URI=postgresql://username:password@hostname:port/database
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
JWT_SECRET=your_jwt_secret
SUPABASE_URI=your_supabase_uri
  1. Start the services
docker-compose up -d
  1. Access the application:
Frontend: http://localhost:5173

Docker Cheatsheet

Steps to create container:

  1. Build the Docker Image: docker build -t <image_name>: . Example: docker build -t my-server -f server/Dockerfile .

  2. Verify the Image was build: docker images

  3. Create and Start a New Container docker run -p <host_port>:<container_port> --name <container_name> Example: docker run -p 4002:4001 my-server

To find containers ID or containers name:
docker ps

To stop container:
docker stop <container_name> or docker stop <container_id>

Optional remove container after stopping it:
docker rm <container_name> or docker rm <container_id>

Rebuilds container:
docker-compose build (name)

Use all container from docker-compose.yml:
docker-compose up

Remove all containers that are running that came from the docker-compose.yml file:
docker-compose down

Stop all containers:
docker stop $(docker ps -aq)

Remove all containers:
docker rm $(docker ps -aq)

Remove all images:
docker rmi $(docker images -q)

remove all volumes:
docker volume rm $(docker volume ls -q)

remove all network volumes:
docker network prune

Remove all dangling resources:
docker system prune -a

Technologies

JavaScript TypeScript HTML CSS React React Router Vite MUI Node.js Express.js CORS PostgreSQL Supabase Postman Docker NPM Prometheus OpenTelemetry Grafana JWT GitHub OAuth .env Dockerode TS-Node Nodemon ESLint


User Interface

Login

Dashboard


Query


Metrics


QueryHawk Team

LinkedIn

Acknowledgements

We would like to thank the following resources that helped make QueryHawk possible:

License

This project is licensed under the MIT License - see the LICENSE file for details.


About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 5