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

monitor-track-apprecio

v2.4.2

Published

Librería para monitoreo con Sentry y tracking con Mixpanel en Node.js v10

Readme

🚀 Monitor Track Apprecio

monitor-track-apprecio es una librería que proporciona middleware para monitoreo y tracking en aplicaciones Node.js. Actualmente soporta Sentry para observabilidad.

📦 Instalación

Para instalar la librería, usa el siguiente comando:

npm install monitor-track-apprecio

🚀 Uso en un Proyecto Express.js

La libreria se debe ubicar debajo de express.json para que pueda tomar el body del request y antes que cualquier middlaware para que intercepte todas las peticiones http

"use strict";

const express = require("express");
const path = require("path");
const logger = require("morgan");
const { observabilityMiddleware, setObservabilityProvider,observabilityErrorMiddleware } = require("monitor-track-apprecio");

const app = express();

app.set("views", path.join(__dirname, "views"));
app.set("view engine", "pug");

app.use(logger("dev"));
app.use(express.json({ limit: "1gb", extended: true }));
app.use(express.urlencoded({ limit: "1gb", extended: false }));

// 🔹 Configurar el proveedor de observabilidad
setObservabilityProvider({ name: "sentry", dns: process.env.SENTRY_DSN }, process.env.APP_ENV);
// 🔹 Usar el middleware de observabilidad
app.use(observabilityMiddleware);

// punto final para lanzar un error controlado;
app.get("/debug-sentry", function mainHandler(req, res) {
  throw new Error("My first Sentry error!");
});



app.use("/", require("./routes/index"));
app.use("/graphql", require("./routes/graphqlRoutes"));

require("./routes/graphql").applyMiddleware({ app, path: "/graphql" });

// 🔹 Agregar el manejador de errores de Sentry antes de cualquier otro middleware de error
app.use(observabilityErrorMiddleware);

// error handler
app.use(function (err, req, res, next) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get("env") === "development" ? err : {};
  sendError(err)
  // render the error page
  res.status(err.status || 500);
  res.render("error");
});

app.listen(3000, () => {
  console.log("🚀 Servidor corriendo en http://localhost:3000");
});

⚙️ Configuración de Variables de Entorno

APP_ENV=dev
SENTRY_DSN=https://your-sentry-dsn

🚀 Uso en un ApolloServer

"use strict";
const { ApolloServer } = require('apollo-server-express');
const constraintDirective = require('graphql-constraint-directive');
const { getObservabilityApolloPlugin} = require("monitor-track-apprecio");
var schemas = require('../graphql/schemas/graph');

var resolvers = require('../graphql/resolvers/graph');

const sentryConfig = getObservabilityApolloPlugin();

const server = new ApolloServer({
	typeDefs: schemas,
	resolvers: resolvers,
	introspection: ((process.env.graphQlInstrospection && process.env.graphQlInstrospection === 'true') ? true : false),
	playground: ((process.env.graphQlPlayGround && process.env.graphQlPlayGround === 'true') ? true : false),
	schemaDirectives: { constraint: constraintDirective },
	plugins: [sentryConfig],
	context: ({ req, res }) => (
		require('../graphql/graphModels')(req, res)
	)
});

module.exports = server;

🚀 Uso en moongose connection

"use strict";

const mongoose = require("mongoose");
mongoose.Promise = global.Promise;
mongoose.set('useCreateIndex', true);
const { 
	captureErrorMiddleware
  } = require("monitor-track-apprecio");

const mongooseCon = new function () {
	let mongoCon = {};
	this.conexion = function (_stringCon) {
		console.log('conexion controller');
		mongoCon.con = mongoose.createConnection(_stringCon,
			{
				useNewUrlParser: true
				//,reconnectTries: Number.MAX_VALUE // Never stop trying to reconnect
				//,reconnectInterval: 1000 // Reconnect every 1000ms
				//,poolSize: 100 // Maintain up to 10 socket connections
				//,bufferMaxEntries: 0 // If not connected, return errors immediately rather than waiting for reconnect
				,connectTimeoutMS: 3000000 // Give up initial connection after 10 seconds
				,socketTimeoutMS: 3000000 // Close sockets after 15 seconds of inactivity
				,useUnifiedTopology: true
				,keepAlive: true
			}, function (error) {
				if (error) {
					console.log(error);
					captureErrorMiddleware(error);
				} else {
					console.log('Conectado exitosamente');
				}
			});
		mongoCon.mongo = mongoose;
		return mongoCon;
	}
};

module.exports = mongooseCon;