{"id":19635442,"url":"https://github.com/neoxelox/gilk","last_synced_at":"2026-04-30T08:40:41.389Z","repository":{"id":53848087,"uuid":"296816888","full_name":"neoxelox/gilk","owner":"neoxelox","description":"Silk-like query inspector/profiler for golang","archived":false,"fork":false,"pushed_at":"2023-03-08T10:52:14.000Z","size":479,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T21:44:59.685Z","etag":null,"topics":["database","gilk","go","golang","inspector","json","profiler","query","silk","sql","ui"],"latest_commit_sha":null,"homepage":"","language":"Go","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/neoxelox.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":"2020-09-19T08:01:37.000Z","updated_at":"2024-06-28T23:52:05.000Z","dependencies_parsed_at":"2024-11-11T12:27:15.875Z","dependency_job_id":"9d55e113-92bb-402e-8986-e8046a18fac9","html_url":"https://github.com/neoxelox/gilk","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/neoxelox/gilk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fgilk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fgilk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fgilk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fgilk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neoxelox","download_url":"https://codeload.github.com/neoxelox/gilk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fgilk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263409131,"owners_count":23462198,"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":["database","gilk","go","golang","inspector","json","profiler","query","silk","sql","ui"],"created_at":"2024-11-11T12:25:17.443Z","updated_at":"2026-04-30T08:40:41.321Z","avatar_url":"https://github.com/neoxelox.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gilk ![Integration](https://github.com/Neoxelox/gilk/workflows/Integration/badge.svg) ![Publication](https://github.com/Neoxelox/gilk/workflows/Publication/badge.svg) [![Go Reference](https://pkg.go.dev/badge/github.com/neoxelox/gilk.svg)](https://pkg.go.dev/github.com/neoxelox/gilk)\n**`silk-like query profiler for golang` 🐻**\n\n![Banner](./static/images/banner.png \"Banner\")\n\n## What\nGilk is a simple, per request, query profiler inspired by [Django's Silk](https://github.com/jazzband/django-silk).\n\n![Gilk Dashboard](./static/images/dashboard.png \"Gilk Dashboard\")\n\n## Install\n**`go get github.com/neoxelox/gilk`**\n\n## Usage\nThe example is done with the standard `net/http` package.\n\nYou should be able to extrapolate the following example to any golang web framework.\n\n```go\nimport (\n    // ...\n    \"github.com/neoxelox/gilk\"\n    // ...\n)\n\nfunc main() {\n    // ...\n    go gilk.Serve(\":8000\")\n    // ...\n}\n\nfunc someHandler(w http.ResponseWriter, r *http.Request) {\n    ctx, endContext := gilk.NewContext(r.Context(), r.URL.Path, r.Method)\n    defer endContext()\n\n    r = r.WithContext(ctx)\n    // ...\n    repo.SomeQuery(ctx, something)\n    // ...\n    repo.AnotherQuery(ctx, another)\n    // ...\n}\n\nfunc (r *repo) SomeQuery(ctx context.Context, something string) {\n    // ...\n    someReturn := r.DB.MyQuery(ctx, `\n        SELECT * FROM \"users\" WHERE \"id\" = $1;`,\n        310720)\n    // ...\n}\n\nfunc (db *Database) MyQuery(ctx context.Context, query string, args ...interface{}) {\n    ctx, endQuery := gilk.NewQuery(ctx, query, args...)\n    defer endQuery()\n\n    db.Query(query, args...)\n    // ...\n}\n```\n\n**_Note!_** defer calls of `NewContext` should be the first thing of you handler and `NewQuery` should be as close as possible to the real database query, in order to improve the statistics.\n\nLook for more examples [`here`](examples).\n\nSee [`GoDev`](https://pkg.go.dev/github.com/neoxelox/gilk) for further documentation.\n\n## Configuration\nThere are a few things you can configurate to improve your experience:\n- **`gilk.Mode`** : set to `gilk.Disabled` to disable caching contexts, queries and serving them. Set to `gilk.Enabled` to enable. Default: `gilk.Enabled`.\n- **`gilk.SkippedStackFrames`** : number of stack frames to be skipped when the caller of the query context is captured. Default: `1`.\n- **`gilk.CacheCapacity`** : capacity of the context cache, `gilk.Reset()` needs to be called afterwards in order to make the change. Default: `50`.\n- **`gilk.QueryGreenColorLatency`** : green color maximum latency threshold for a single query. Default: `100 * time.Millisecond`.\n- **`gilk.QueryYellowColorLatency`** : yellow color maximum latency threshold for a single query. Default: `250 * time.Millisecond`.\n- **`gilk.ContextGreenColorLatency`** : green color maximum latency threshold for a single context. Default: `250 * time.Millisecond`.\n- **`gilk.ContextYellowColorLatency`** : yellow color maximum latency threshold for a single context. Default: `500 * time.Millisecond`.\n- **`gilk.QueriesGreenColorLatency`** : green color maximum latency threshold for all the queries within a context. Default: `100 * time.Millisecond`.\n- **`gilk.QueriesYellowColorLatency`** : yellow color maximum latency threshold for all the queries within a context. Default: `250 * time.Millisecond`.\n- **`gilk.QueriesGreenColorNumber`** : green color maximum number threshold for queries within a context. Default: `10`.\n- **`gilk.QueriesYellowColorNumber`** : yellow color maximum number threshold for queries within a context. Default: `15`.\n\n## Serving UI\nThe most convenient way to work with Gilk is to use `gilk.Serve(port)` that launches a UI in the assigned port. However you can also serve the raw JSON data `gilk.ServeRaw(port)`.\nAt present, the queries shown in the Gilk UI are not \"real/ready\" SQL queries, the args are dummy-embedded into the SQL query.\n\n## Contribute\nFeel free to contribute to this project : ) .\n\n## License\nThis project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - read the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoxelox%2Fgilk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneoxelox%2Fgilk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoxelox%2Fgilk/lists"}