npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@unhandled/instrumentation-drizzle

v0.1.14

Published

Drizzle ORM query tracing for Unhandled

Readme

@unhandled/instrumentation-drizzle

Traces Drizzle ORM queries and prepared queries as CLIENT spans. Needs drizzle-orm >= 0.28.0 and your own database driver. This package is opt-in: the AdonisJS agent never enables it, and it has no /integration entry.

Install

npm i @unhandled/instrumentation-drizzle

Use

Initialise OpenTelemetry first, then pick exactly one entry point per database.

Wrap the database returned by drizzle() (works with any Drizzle driver):

import { drizzle } from 'drizzle-orm/node-postgres'
import { instrumentDrizzleClient } from '@unhandled/instrumentation-drizzle'

export const db = instrumentDrizzleClient(drizzle(pool), { dbSystem: 'postgresql', dbName: 'app' })

Or wrap the node-postgres Pool or Client before handing it to drizzle():

import { instrumentDrizzle } from '@unhandled/instrumentation-drizzle'

export const db = drizzle(instrumentDrizzle(pool, { dbSystem: 'postgresql', dbName: 'app' }))

Do not use both on the same database. Every query would be traced twice, once at the Drizzle layer and once at the driver, with the driver span nested inside the other.

Config

| Option | Default | Effect | | -------------------- | --------- | --------------------------------------------------------------------------- | | dbSystem | unknown | Value of db.system.name: postgresql, mysql, sqlite. Set it. | | dbName | none | db.namespace | | peerName | none | server.address, the database host | | peerPort | none | server.port | | captureQueryText | true | false leaves db.query.text off every span | | maxQueryTextLength | 1000 | Query text is cut to this many characters. Operation and table still come from the full SQL. |

SQL text can contain sensitive literals. Bound parameters are never recorded, and a failed query's span carries the driver's error message rather than Drizzle's wrapper, which embeds the parameters.

Spans

Every span is CLIENT kind, named <OPERATION> <table> (SELECT users), or just the operation when no table can be parsed. A prepared query produces one span per execution.

| Attribute | Value | | -------------------- | -------------------------------------------------------- | | db.system.name | dbSystem | | db.query.text | SQL with placeholders, truncated, when captured | | db.operation.name | Upper-cased first keyword, for example SELECT | | db.collection.name | Target table when it can be parsed | | db.namespace | dbName | | server.address | peerName | | server.port | peerPort | | db.transaction | true for queries inside a transaction | | error.type | Error class name on failures, plus the recorded exception and ERROR status |

Transactions

  • instrumentDrizzle sees what the connection sees, so BEGIN, COMMIT, ROLLBACK, savepoints and every query between them are spans flagged db.transaction.
  • instrumentDrizzleClient traces queries run through db.transaction and flags them. The control statements Drizzle issues itself (BEGIN, COMMIT, ROLLBACK, savepoints) are not traced.

Drizzle's own spans

When @opentelemetry/api is installed, Drizzle itself emits drizzle.* spans under the drizzle-orm scope. They are independent of this package and cannot be turned off from here.

Drivers

instrumentDrizzleClient patches the session behind db, so it is driver-agnostic. instrumentDrizzle wraps query() on a node-postgres Pool (including the clients it hands out) or Client; any other object throws a TypeError.

For AI agents

A coding agent can install this package, check that its data arrives and fix the errors it reports through the Unhandled MCP server at https://unhandled.net/mcp. In Claude Code, the Unhandled plugin adds that server plus skills for instrumenting a service, fixing a production error with a failing test first and verifying a deploy:

claude plugin marketplace add treboryx/unhandled
claude plugin install unhandled@unhandled

Codex, Cursor, Gemini CLI and other agents connect to the same URL. Coding agents has the setup for each one and an AGENTS.md section to add to your repository.