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

asengardeons-observability

v0.0.15-beta

Published

Enterprise Observability Abstraction (OpenTelemetry)

Readme

asengardeons-observability

Enterprise Observability Abstraction (OpenTelemetry).

Esta biblioteca fornece uma abraçação unificada para observabilidade utilizando OpenTelemetry.

Instalação

npm install asengardeons-observability @opentelemetry/api

Como Usar

import { getTracer, getMetrics, getLogger } from 'asengardeons-observability';

const tracer = getTracer('my-service');
// ...

Propagação de Contexto (Baggage)

Útil para passar informações de negócio entre diferentes serviços (ex: tenant-id).

tracer.startActiveSpan('process', (span) => {
  const ctx = span.getContext();
  ctx.setBaggage('tenant-id', 'company-a');
  
  // O valor estará disponível em spans filhos ou serviços chamados via HTTP
  const tenantId = ctx.getBaggage('tenant-id');
});

Health Checks

Interface para expor o estado da aplicação.

import { registerHealthCheck, HealthStatus } from 'asengardeons-observability';

registerHealthCheck({
  getName: () => 'database',
  check: async () => {
    const isAlive = await db.ping();
    return {
      status: isAlive ? HealthStatus.UP : HealthStatus.DOWN,
      details: { host: 'localhost' }
    };
  }
});

Middlewares

Express

A biblioteca oferece um middleware para facilitar a instrumentação de aplicações Express.

import express from 'express';
import { expressMiddleware } from 'asengardeons-observability';

const app = express();

// Registra o middleware
app.use(expressMiddleware('my-api-service'));

app.get('/hello', (req, res) => {
  res.send('Hello World');
});

app.listen(3000);

Customizando Logs Internos

Você pode substituir o logger interno da biblioteca (usado para diagnóstico) por um logger da sua preferência (ex: Winston, Pino).

import { setInternalLogger } from 'asengardeons-observability';

setInternalLogger({
  info: (msg, ...args) => myCustomLogger.info(msg, ...args),
  warn: (msg, ...args) => myCustomLogger.warn(msg, ...args),
  error: (msg, ...args) => myCustomLogger.error(msg, ...args),
});

Interfaces Principais

ITelemetrySpan

  • setAttribute(key, value): Define um atributo simples no span.
  • setAttributes(attributes): Define múltiplos atributos de uma vez.
  • setStatus({ code, message }): Define o status do span (OK, ERROR, UNSET).
  • recordException(error): Registra uma exceção no span.
  • end(): Encerra o span manualmente (geralmente gerenciado pelo startActiveSpan).

TelemetryStatus

Enumeração para estados de span:

  • TelemetryStatus.OK
  • TelemetryStatus.ERROR
  • TelemetryStatus.UNSET

Compatibilidade e Bundlers

A biblioteca foi projetada principalmente para ambientes Node.js, mas possui verificações de segurança para não quebrar em outros contextos (como navegadores ou durante o processo de build em bundlers como Webpack, Vite ou Esbuild).

Se você estiver usando um bundler:

  1. Node Globals: Certifique-se de que o seu bundler lida corretamente com process.env. Muitos bundlers modernos substituem isso automaticamente.
  2. Dynamic Requires: Como utilizamos require dinâmico para carregar os provedores sob demanda, alguns bundlers podem emitir avisos. Isso é intencional para manter o bundle leve, incluindo apenas o provedor que você realmente instalar.

Desenvolvimento e CI/CD

O projeto utiliza GitHub Actions para automação de testes e distribuição:

  • CI (ci.yml): Executado em cada Push ou Pull Request para as branches main ou master. Realiza o build de todos os pacotes em múltiplas versões de Node.js.
  • Release (release.yml): Executado ao criar uma tag (ex: v1.0.0). Realiza o build e publica todos os pacotes no NPM.
    • Requisito NPM: Segredo NPM_TOKEN configurado no repositório.

Licença

ISC