{"id":15137027,"url":"https://github.com/roma-glushko/hawk","last_synced_at":"2026-02-18T17:02:37.623Z","repository":{"id":256266217,"uuid":"834193111","full_name":"roma-glushko/hawk","owner":"roma-glushko","description":"🦅 A debugging \u0026 profiling toolkit for production Python microservices","archived":false,"fork":false,"pushed_at":"2026-01-10T23:29:32.000Z","size":2237,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T07:11:02.781Z","etag":null,"topics":["debug","fastapi","flask","microservices","observability","opentelemetry","profiling","python","starlette","tracemalloc"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roma-glushko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-07-26T16:12:26.000Z","updated_at":"2026-01-09T00:00:27.000Z","dependencies_parsed_at":"2025-02-08T14:42:23.593Z","dependency_job_id":null,"html_url":"https://github.com/roma-glushko/hawk","commit_stats":null,"previous_names":["roma-glushko/hawk"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/roma-glushko/hawk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roma-glushko%2Fhawk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roma-glushko%2Fhawk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roma-glushko%2Fhawk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roma-glushko%2Fhawk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roma-glushko","download_url":"https://codeload.github.com/roma-glushko/hawk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roma-glushko%2Fhawk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29587066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T16:55:40.614Z","status":"ssl_error","status_checked_at":"2026-02-18T16:55:37.558Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["debug","fastapi","flask","microservices","observability","opentelemetry","profiling","python","starlette","tracemalloc"],"created_at":"2024-09-26T06:43:01.711Z","updated_at":"2026-02-18T17:02:37.613Z","avatar_url":"https://github.com/roma-glushko.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/roma-glushko/hawk/main/assets/logo/hawk-debug_transparent_bg.png\" width=\"300px\" alt=\"Hawk Debug Toolkit For Python\" /\u003e\n    \u003ch1\u003eHawk\u003c/h1\u003e\n    \u003cp\u003eLightweight debugging \u0026 profiling toolkit \u003cbr/\u003e for production 🐍Python services\u003c/p\u003e\n    \u003ca href=\"https://hawk-debug.readthedocs.io/en/latest/\"\u003e\n        \u003cimg src=\"https://img.shields.io/readthedocs/hawk-debug\" alt=\"Read the Docs\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/hawk-debug/\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/v/hawk-debug\" alt=\"PyPI - Version\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/hawk-debug/\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/dm/hawk-debug\" alt=\"PyPI - Downloads\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/roma-glushko/hawk/blob/main/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/roma-glushko/hawk\" alt=\"Apache-2.0\" /\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n## Features\n\n- **Memory Profiling** - tracemalloc-based allocation tracking\n- **CPU Profiling** - cProfile (built-in), pyinstrument (async-aware), yappi (multi-threaded)\n- **Debug Vars** - expose internal service state\n- **ZPages** - custom debug dashboard\n- **On-demand activation** - profile only when needed, download profiles for further investigation or render them in the browser\n- **No elevated permissions** required (like `CAP_PTRACE`)\n- Enable/disable via environment variables without **code changes**\n\n## Installation\n\n```bash\npip install hawk-debug\n```\n\nOptional dependencies for CPU profiling:\n\n```bash\npip install hawk-debug[pyinstrument]  # async-aware sampling profiler\npip install hawk-debug[yappi]          # multi-threaded CPU/wall time profiler\n```\n\n\u003e [!NOTE]\n\u003e This project is under development at this moment.\n\n## Quick Start\n\n### FastAPI\n\n```python\nfrom fastapi import FastAPI\nfrom hawk.contrib.fastapi import get_router\n\napp = FastAPI()\napp.include_router(get_router())\n```\n\n### Starlette\n\n```python\nfrom starlette.applications import Starlette\nfrom starlette.routing import Mount\nfrom hawk.contrib.starlette import get_router\n\napp = Starlette(routes=[\n    Mount(\"/debug\", app=get_router()),\n])\n```\n\n### Flask\n\n```python\nfrom flask import Flask\nfrom hawk.contrib.flask import create_debug_blueprint\n\napp = Flask(__name__)\napp.register_blueprint(create_debug_blueprint(), url_prefix=\"/debug\")\n```\n\n## Endpoints\n\n| Endpoint | Description |\n|----------|-------------|\n| `/debug/prof/cpu/cprofile/` | CPU profile with cProfile (fixed duration) |\n| `/debug/prof/cpu/cprofile/start/` | Start cProfile CPU profiling |\n| `/debug/prof/cpu/cprofile/stop/` | Stop and get cProfile CPU profile |\n| `/debug/prof/cpu/pyinstrument/` | CPU profile with pyinstrument (fixed duration) |\n| `/debug/prof/cpu/pyinstrument/start/` | Start pyinstrument CPU profiling |\n| `/debug/prof/cpu/pyinstrument/stop/` | Stop and get pyinstrument CPU profile |\n| `/debug/prof/cpu/yappi/` | CPU profile with yappi (fixed duration) |\n| `/debug/prof/cpu/yappi/start/` | Start yappi CPU profiling |\n| `/debug/prof/cpu/yappi/stop/` | Stop and get yappi CPU profile |\n| `/debug/prof/mem/tracemalloc/` | Memory profile (fixed duration) |\n| `/debug/prof/mem/tracemalloc/start/` | Start memory profiling |\n| `/debug/prof/mem/tracemalloc/snapshot/` | Take memory snapshot |\n| `/debug/prof/mem/tracemalloc/stop/` | Stop memory profiling |\n| `/debug/vars/` | Debug variables |\n| `/debug/` | ZPages dashboard |\n\n## Query Parameters\n\n### CPU Profiling (cProfile)\n- `duration` - profile duration in seconds (default: 5)\n- `format` - output: `text`, `json`, `pstat` (binary)\n- `sort` - sort by: `cumulative`, `time`, `calls`, `name`\n- `limit` - number of functions to show (default: 30)\n\n### CPU Profiling (pyinstrument)\n- `duration` - profile duration in seconds (default: 5)\n- `format` - output: `html`, `json`, `speedscope`\n- `interval` - sampling interval (default: 0.001)\n- `async_mode` - `enabled`, `disabled`, `strict`\n\n### CPU Profiling (yappi)\n- `duration` - profile duration in seconds (default: 5)\n- `format` - output: `funcstats` (JSON), `pstat` (binary), `callgrind` (for KCachegrind)\n- `clock_type` - `cpu` (CPU time) or `wall` (wall clock time)\n- `builtins` - profile built-in functions (default: false)\n- `multithreaded` - profile all threads (default: true)\n\n### Memory Profiling\n- `duration` - profile duration in seconds (default: 5)\n- `format` - output: `lineno`, `traceback`, `pickle`\n- `frames` - stack frames to capture (default: 30)\n- `count` - top N allocations (default: 10)\n- `gc` - run GC before profiling (default: true)\n\n## Integrations\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/roma-glushko/hawk/main/assets/contrib/fastapi.png\" width=\"100px\" alt=\"FastAPI\" /\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/roma-glushko/hawk/main/assets/contrib/starlette.svg\" width=\"100px\" alt=\"Starlette\" /\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/roma-glushko/hawk/main/assets/contrib/flask.png\" width=\"100px\" alt=\"Flask\" /\u003e\n\u003c/p\u003e\n\n## Inspiration\n\nInspired by Go's `net/http/pprof`, `expvars`, and OpenTelemetry Collector's ZPages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froma-glushko%2Fhawk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froma-glushko%2Fhawk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froma-glushko%2Fhawk/lists"}