Add `diagnostics_channel` support for query and connection lifecycle events
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Tranquilo
- Stack tecnológico
- javascript, node.js, postgresql
- Área
- backend, observability-sre
Línea de trabajo
El issue menciona pg y pg-pool, pero no incluye archivos de implementación ni pruebas. Empieza revisando la instrumentación IITM/RITM existente y el patrón TracingChannel de undici; una propuesta concreta debe definir los nombres de los canales, las formas de los payloads y la compatibilidad con las versiones de Node antes de que la implementación pueda considerarse terminada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I'd like to propose adding first-class TracingChannel support to pg and pg-pool, following the pattern established by undici in Node.js core.
TracingChannel is a higher-level API built on top of diagnostics_channel, specifically designed for tracing async operations. It provides structured lifecycle channels (start, end, error, asyncStart, asyncEnd) and handles async context propagation correctly, which was the missing piece that makes existing monkey-patching approaches fragile in real-world async Node.js applications.
Current instrumentation's today use IITM (import-in-the-middle) for ESM and RITM for CJS which has a few fragility concerns in today's ecosystem state, a few issues we have today:
- Runtime lock-in: both RITM and IITM rely on Node.js-specific module loader internals (
Module._resolveFilename,module.register()). They don't work on Bun or Deno, which implement the Node.js API surface but not the module loader internals. - ESM fragility: IITM is built on Node.js's module customization hooks, which are still evolving and have been a persistent source of breakage in the OTEL JS ecosystem.
- Initialization ordering: both require instrumentation to be set up before
pgis first require()'d. Get the order wrong and instrumentation silently does nothing, which is very hard to debug in production. - Bundling and Externalization: Users have to ensure their instrumented modules are externalized, which is becoming very difficult to guarantee with more and more frameworks bundling the server-side code into single executables, binaries or deployment files.
If pg emits structured events through TracingChannel, instrumentation libraries become subscribers, not patches. Each tool listens independently with no ordering concern, no clobbering, and no internal API dependency.
Before putting together a concrete proposal and PR, wanted to check: is there appetite for this? Happy to spec out channel names, payload shapes, and Node version compatibility considerations if so.
- Lenguaje dominante
- JavaScript
- Estrellas
- 13.2k
- Forks
- 1.4k
- Merge medio
- 6 d 15 h
- PR fusionados (30 d)
- 6
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de brianc/node-postgres
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
brianc/node-postgres#3770 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
brianc/node-postgres#3716 · 1 comentario ·
-
# remove bring your own promise Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
brianc/node-postgres#3631 · 1 comentario ·
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
brianc/node-postgres#2857 ·
-
can't view docs for old versions Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
brianc/node-postgres#2433 ·
Todos los issues de brianc/node-postgres
Issues similares
-
Update HugeIcons library Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
antfu-collective/icones#398 ·
-
ECmail.com Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
wesbos/burner-email-providers#554 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
radiantearth/stac-browser#1023 ·
-
HMR stops working Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
components-web-app/docs#92 ·