@stacksleuth/mongodb-agent
TypeScript icon, indicating that this package has built-in type declarations

0.2.3 • Public • Published

@stacksleuth/mongodb-agent

StackSleuth MongoDB Agent

StackSleuth MongoDB Agent

npm version License: MIT TypeScript Node.js

🚀 What is StackSleuth MongoDB Agent?

Advanced MongoDB performance monitoring agent - Query optimization, aggregation pipeline analysis, index usage tracking, connection pool monitoring, and real-time database performance metrics.

✨ Key Features

  • 🍃 Query Performance Monitoring: MongoDB query optimization insights
  • 🔍 Aggregation Pipeline Analysis: Complex aggregation performance
  • 📊 Index Usage Tracking: Index efficiency and optimization
  • 🔗 Connection Pool Monitoring: Database connection optimization
  • 💾 Memory Usage Analysis: MongoDB memory usage tracking
  • 🔄 Real-time Metrics: Live database performance monitoring
  • Multiple Driver Support: Native MongoDB driver and Mongoose
  • 📈 Collection-level Stats: Per-collection performance insights

📦 Installation

npm install @stacksleuth/mongodb-agent
yarn add @stacksleuth/mongodb-agent
pnpm add @stacksleuth/mongodb-agent

🏁 Quick Start

import { MongoClient } from 'mongodb';
import { MongoDBAgent } from '@stacksleuth/mongodb-agent';

// Initialize MongoDB agent
const agent = new MongoDBAgent({
  enabled: true,
  monitorQueries: true,
  trackIndexUsage: true,
  slowQueryThreshold: 100 // ms
});

// Connect to MongoDB
const client = new MongoClient('mongodb://localhost:27017');
await client.connect();

// Instrument MongoDB client
agent.instrumentClient(client);

// Start monitoring
agent.startMonitoring();

// Your MongoDB operations are now monitored
const db = client.db('myapp');
const users = await db.collection('users').find({ active: true }).toArray();

📚 Resources

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

MIT License - see the LICENSE file for details.


WebsiteDocumentationNPM RegistryGitHub

Made with ⚡ by StackSleuth

Package Sidebar

Install

npm i @stacksleuth/mongodb-agent

Weekly Downloads

9

Version

0.2.3

License

MIT

Unpacked Size

29 kB

Total Files

6

Last publish

Collaborators

  • jacklauoptimizer