Skip to content
Skillv1.0.0

monitoring-setup

Sets up production monitoring for NestJS and Next.js apps — Sentry error tracking, Google Analytics, and operational signals (BullMQ queue depth, Postgres slow queries, connection saturation) with ale

by shipshitdev(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from shipshitdev/skills (skills/monitoring-setup/SKILL.md). Install upstream with npx skills add shipshitdev/skills --skill monitoring-setup. Copyright stays with the author.

Monitoring Setup

Two layers: application health (errors, user behavior) and operational health (are the queues draining, is the database keeping up). An app with clean Sentry but a queue backing up or a table scan on every request is still failing its users — cover both.

When to Use

  • Need to set up error tracking (Sentry)
  • Want to configure Google Analytics
  • Need monitoring for production applications
  • Want to track application errors and user behavior
  • Need operational signals: queue depth, slow queries, connection saturation, and alerts on them

Sentry Setup

NestJS Backend

  1. Install: bun add @sentry/node @sentry/profiling-node
  2. Initialize in main.ts before app creation
  3. Configure DSN via SENTRY_DSN environment variable
  4. Set appropriate sample rates for production

Next.js Frontend

  1. Install: bun add @sentry/nextjs
  2. Run: bunx @sentry/wizard@latest -i nextjs
  3. Configure client/server/edge configs
  4. Set NEXT_PUBLIC_SENTRY_DSN for client-side

Google Analytics Setup

Next.js Setup

  1. Add Google Analytics script to root layout
  2. Use NEXT_PUBLIC_GA_MEASUREMENT_ID (format: G-XXXXXXXXXX)
  3. Create analytics utility functions for event tracking
  4. Set up page view tracking

Common Events

  • User signup/login
  • Purchases/conversions
  • Feature usage
  • Custom business events

Operational Monitoring

Application errors tell you what threw; operational signals tell you what is quietly degrading. Instrument the three that take a product down under load.

BullMQ queue depth

A queue that fills faster than it drains is an outage in slow motion — no error fires until jobs time out.

  • Track per queue: waiting (backlog), active, failed, and completed rate. Queue.getJobCounts() exposes these; scrape them on an interval or via bullmq-prometheus.
  • The signal that matters is trend: waiting climbing while completed is flat means workers cannot keep up (scale workers or the Redis connection).
  • Watch the dead-letter / failed set — jobs exhausting retries are silent data loss.

Postgres slow queries & connections

  • Enable pg_stat_statements; surface the top queries by total time and by mean time. A query that is individually fast but runs 10k×/min is the real cost.
  • Log queries over a threshold (log_min_duration_statement) and alert on new entrants — a slow query usually means a missing index or an N+1.
  • Track connection saturation (active / max_connections). Near the ceiling on serverless means the pooler is undersized — see postgres-ops.

Redis

  • Memory usage vs maxmemory, eviction rate, and command latency. Evictions mean the cache is too small and hit-rate is silently dropping.

Alerting

Instrumentation no one looks at is not monitoring. For each signal above, define a threshold and route it somewhere a human sees at 3am (PagerDuty, Opsgenie, a Slack channel that pages). Alert on the leading indicator (queue waiting climbing, connections near max) not just the lagging one (jobs already timing out, 500s already served). Every alert names the runbook step to take, or it is just noise.

Best Practices

  • Use different DSNs for dev/prod
  • Set appropriate sample rates
  • Respect user privacy (GDPR/CCPA)
  • Don't track sensitive data
  • Alert on leading operational indicators, not only on errors after the fact
  • Every alert links to a runbook action — no orphan alerts

Integration

This skill integrates with /monitoring-setup command for automated setup workflows. Pairs with postgres-ops (pooling, DR) and nestjs-queue-architect (queue design).

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/shipshitdev-skills-monitoring-setup/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

shipshitdev-skills-monitoring-setup.ocm.jsonjson
{
  "ocm": "1",
  "id": "shipshitdev-skills-monitoring-setup",
  "kind": "skill",
  "name": "monitoring-setup",
  "description": "Sets up production monitoring for NestJS and Next.js apps — Sentry error tracking, Google Analytics, and operational signals (BullMQ queue depth, Postgres slow queries, connection saturation) with alerts on each. Activates when users need error tracking, production monitoring, analytics, queue/database observability, or alerting on operational health.",
  "publisher": "shipshitdev",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "monitoring",
      "sentry",
      "analytics",
      "observability",
      "alerting",
      "bullmq",
      "postgres",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Sets up production monitoring for NestJS and Next.js apps — Sentry error tracking, Google Analytics, and operational signals (BullMQ queue depth, Postgres slow queries, connection saturation) with alerts on each. Activates when users need error tracking, production monitoring, analytics, queue/database observability, or alerting on operational health."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/shipshitdev/skills",
      "path": "skills/monitoring-setup/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/shipshitdev/skills/blob/HEAD/skills/monitoring-setup/SKILL.md",
      "key": "shipshitdev/skills/skills/monitoring-setup/SKILL.md"
    }
  },
  "instructions": "# Monitoring Setup\n\nTwo layers: **application** health (errors, user behavior) and **operational** health\n(are the queues draining, is the database keeping up). An app with clean Sentry but a\nqueue backing up or a table scan on every request is still failing its users — cover\nboth.\n\n## When to Use\n\n- Need to set up error tracking (Sentry)\n- Want to configure Google Analytics\n- Need monitoring for production applications\n- Want to track application errors and user behavior\n- Need operational signals: queue depth, slow queries, connection saturation, and\n  alerts on them\n\n## Sentry Setup\n\n### Ne",
  "cost": {
    "context_tokens": 913
  }
}

Fetch it by URL: GET /api/v1/registry/shipshitdev-skills-monitoring-setup/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.