{"repo":"smolijar/kysely-sqlcommenter","free":true,"listed":false,"github":"https://github.com/smolijar/kysely-sqlcommenter","clone":"git clone https://github.com/smolijar/kysely-sqlcommenter.git","description":"SqlCommenter plugin for Kysely: Trace slow database queries back to the request, route, or application code that generated them","language":"TypeScript","stars":11,"topics":["kysely","plugin","sqlcommenter","database-observability","nodejs","npm","observability","pnpm","query-annotations","query-telemetry"],"license":"MIT","category":"analytics","readme_excerpt":"Kysely SqlCommenter SqlCommenter plugin for Kysely Getting started Requires Kysely =0.28.17 <0.30.0 . SqlCommenterPlugin does not change the API of Kysely. You only provide it a callback for getting the metadata for the comment. AsyncLocalStorage or any alternative is needed. Initialize the AsyncLocalStorage : Register the SqlCommenterPlugin using the asyncLocalStorage in callback: Create a root middleware, register the root span with storage via asyncLocalStorage.run . Everything in the callstack of this next will have access to a shared copy of the storage (new calls will have exclusive storage). You can initialize it with a value. Any supported DML query will have the appropriate SqlComment . Supported query types: select, update, insert, delete, and merge. Cloud SQL Query Insights Sqlcommenter spec wraps values in single quotes: / action='list' / . Cloud SQL Query Insights currently displays those delimiters as part of the tag value. Keep the default for spec-compliant output, or disable value quoting if you only target Cloud SQL display: This emits / action=list / , which is intentionally not sqlcommenter-spec compliant. The explicit sqlCommenter helper accepts the same option as its third argument. Preview Per-query For explicit per-query comments, use Kysely's $call helper API: See the full working example for express here, including concurrency demo and adjusting the comment in other middleware. Features - SqlCommenter spec serialization tests - Callback API with Asyn","default_branch":null,"files":null,"tree":[],"storefront":"/r/smolijar","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/smolijar/kysely-sqlcommenter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}