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

@generazioneai/telemetry

v0.2.0

Published

Osservabilità comune dei servizi Node (ADR-013): OpenTelemetry con esportazione OTLP, JsonLogger con trace_id, span dei comandi NATS con traceparent negli header, attributi a lista bianca e redazione dei dati personali.

Readme

@generazioneai/telemetry

Osservabilità comune dei servizi Node (ADR-013, spec «Fondamenta enterprise» §5): tracce e metriche OpenTelemetry verso il collector, log JSON con trace_id, span dei comandi NATS, nessun dato personale.

npm i @generazioneai/telemetry

Uso

// main.ts — PRIMA riga
import '@generazioneai/telemetry/register';
import { createLogger } from '@generazioneai/telemetry/logger';

const app = await NestFactory.create(AppModule, { logger: createLogger('hr') });

// app.module.ts
TelemetryModule.forRoot({ service: 'hr' })

| Variabile | Valori | Di serie | |---|---|---| | OTEL_EXPORTER_OTLP_ENDPOINT | base OTLP/HTTP | http://otel-collector.observability:4318 (in sviluppo locale: vuota); vuota = spento (il processo non carica l'SDK, nessuna connessione) | | TELEMETRY_MODE | on | 0.2 (decisione del 2026-11-10): accesa se c'è l'endpoint. off conta solo in sviluppo locale e nei test (SKILLERA_ENV dev/local o NODE_ENV development/test, fuori da un cluster); altrove si ignora con un avviso | | OTEL_SERVICE_NAME | nome | name del package.json (senza scope) | | SKILLERA_ENV | | → deployment.environment | | LOG_FORMAT | text | json | text | | APP_LOGGER_LEVEL | log,error,warn,debug,verbose | none | log,error,warn (fatal segue error) | | TELEMETRY_SAMPLE_RATIO | 0..1 | 1 (il campionamento in coda è del collector) | | OTEL_METRIC_EXPORT_INTERVAL | ms | 60000 |

Impostare OTEL_SERVICE_NAME nei manifest: register parte prima di Nest e non conosce l'opzione service del modulo.

Cosa fa

  • /register: Node SDK con OTLP/HTTP per tracce e metriche; strumentazioni HTTP (senza health/metrics), pg, ioredis, Prisma (le ultime tre opzionali). Nessun gestore di SIGTERM: lo spegnimento ordinato lo fa TelemetryModule (o beforeExit).
  • NATS: l'interceptor globale (solo contesto rpc) apre nats.server <cmd> (kind consumer) come figlio del traceparent negli header, mette cmd e juridicalId nel contesto dei log, conta nats_server_requests_total{cmd,outcome} e nats_server_request_duration_seconds{cmd}. juridicalId viene dall'header Gen-Tenant o da auth.juridicalId/auth.tenantId/dto.juridicalId, solo se è un UUID.
  • Invio: traceparentHeadersHook scrive traceparent negli header. TelemetryModule.forRoot lo registra con setNatsHeadersHook di @generazioneai/authz ≥ 0.7 se c'è (altrimenti nulla); si può passare il modulo con authz: … o spegnere con authz: false. Per gli eventi di JetStream ci pensa @generazioneai/events con injectTraceContext/extractTraceContext.
  • Log (JsonLogger): level, ts, service, msg, trace_id, span_id, cmd, juridicalId (+ context, err, campi del messaggio-oggetto, mai in conflitto con quelli del contratto).
  • Dati personali (decisione 35): gli span escono da SanitizingSpanExporter, che tiene solo gli attributi della lista bianca (ALLOWED_ATTRIBUTES: metodo, rotta come modello, comando, esito, durata, dimensioni, id di azienda UUID, db.statement senza letterali, redis solo il comando), stato senza messaggio, IP solo come hash (client.ip_hash). redact()/maskString() (usate dal logger) azzerano i valori di chiavi come authorization, cookie, body, dto, email, *name, fiscalCode, iban, password, *token e mascherano nel testo email, codici fiscali (anche omocodici), IBAN, JWT, Bearer ….

Compatibilità delle versioni OpenTelemetry

Le strumentazioni sono fissate alla famiglia 0.219 con @opentelemetry/api 1.9 (la 0.300 richiede api ≥ 1.10, che gli SDK 2.x non accettano ancora). Il servizio non deve avere un proprio @opentelemetry/api diverso.

Prove

npm test. La prova dell'SDK acceso gira in un processo Node figlio (le strumentazioni usano import() dinamici, che Jest non esegue) e costruisce il pacchetto in .test-dist/.