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

@prisma/sqlcommenter-trace-context

v7.8.0

Published

W3C Trace Context (traceparent) plugin for Prisma SQL commenter

Downloads

37,597

Readme

@prisma/sqlcommenter-trace-context

W3C Trace Context (traceparent) plugin for Prisma SQL commenter.

This plugin adds the traceparent header from the current trace context to SQL queries as comments, enabling correlation between distributed traces and database queries.

Installation

npm install @prisma/sqlcommenter-trace-context

Usage

import { traceContext } from '@prisma/sqlcommenter-trace-context'

import { PrismaClient } from './generated/prisma/client'

const prisma = new PrismaClient({
  adapter: myDriverAdapter,
  comments: [traceContext()],
})

When tracing is enabled and the current span is sampled, queries will include a traceparent comment:

SELECT * FROM users /*traceparent='00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01'*/

How it works

The traceContext() plugin:

  1. Checks if tracing is enabled via @prisma/instrumentation
  2. Retrieves the current trace context's traceparent header
  3. Only includes the traceparent in the SQL comment if the sampled flag is set (the trace flags end with 01)

This means:

  • No traceparent is added when tracing is not configured
  • No traceparent is added when the current trace is not sampled (e.g., with ratio-based sampling set to 0%)
  • traceparent is added only when tracing is active and the span is sampled

Requirements

  • Requires @prisma/instrumentation to be configured and enabled for tracing
  • Works with Prisma Client using driver adapters

W3C Trace Context

The traceparent header follows the W3C Trace Context specification:

{version}-{trace-id}-{parent-id}-{trace-flags}

Where:

  • version: Always 00 for the current spec
  • trace-id: 32 hexadecimal characters representing the trace ID
  • parent-id: 16 hexadecimal characters representing the parent span ID
  • trace-flags: 2 hexadecimal characters; 01 indicates sampled

License

Apache-2.0