agentleFS
eliabdevweb-svgeliabdevweb-svg/opencode-skills-MCP/skills/monitoring-observability/SKILL.md

monitoring-observability

Skill0 starsChanged 28 days agoMITView on GitHub

Monitoring et observabilite: logs, metriques, traces, alerting, dashboards SRE. Use when setting up observability, logging, metrics, tracing, or alerting.

We split this skill into the rules it gives an agent

4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use structured logging (JSON format)

    line 41
  2. Distinctive:

    Never log sensitive data (passwords, tokens, PII)

    line 43
  3. Distinctive:

    Use appropriate log levels

    line 44
  4. Distinctive:

    Actionable: Every alert requires human action

    line 148

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Monitoring & Observability Skill

Overview

Expert in implementing comprehensive monitoring, logging, metrics, tracing, and alerting for production applications following the three pillars of observability.

The Three Pillars

1. Logging

// Structured logging with context
logger.info("User created", {
  userId: user.id,
  email: user.email,
  timestamp: new Date().toISOString(),
  requestId: req.id,
  service: "auth-service"
});

// Error logging with stack trace
logger.error("Payment failed", {
  error: err.message,
  stack: err.stack,
  orderId: order.id,
  amount: order.total,
  userId: order.userId
});

Log Levels:

  • ERROR: Critical failures requiring immediate attention
  • WARN: Unexpected conditions that don't break functionality
  • INFO: Important business events and state changes
  • DEBUG: Detailed diagnostic information (dev only)

Best Practices:

  • Use structured logging (JSON format)
  • Include correlation IDs for request tracing
  • Never log sensitive data (passwords, tokens, PII)
  • Use appropriate log levels
  • Centralize logs (ELK Stack, Loki, CloudWatch)

2. Metrics

// Prometheus-style metrics
const httpRequestDuration = new Histogram({
  name: 'http_request_duration_seconds',
  help: 'Duration of HTTP requests in seconds',
  labelNames: ['method', 'route', 'status_code'],
  buckets: [0.01, 0.05, 0.1, 0.5, 1, 5]
});

const activeUsers = new Gauge({
  name: 'active_users_total',
  help: 'Number of currently active users'
});

const ordersTotal = new Counter({
  name: 'orders_total',
  help: 'Total number of orders',
  labelNames: ['status']
});

Key Metrics (USE Method):

  • Utilization: CPU, memory, disk, network usage
  • Saturation: Queue length, thread pool usage
  • Errors: Error rate, failed requests

Golden Signals (Google SRE):

  • Latency: Time to serve requests
  • Traffic: Requests per second
  • Errors: Error rate
  • Saturation: How "full" is the service

3. Distributed Tracing

// OpenTelemetry tracing
import { trace } from '@opentelemetry/api';

const tracer = trace.getTracer('order-service');

async function createOrder(orderData: OrderData) {
  return tracer.startActiveSpan('createOrder', async (span) => {
    span.setAttribute('order.id', orderData.id);
    span.setAttribute('order.total', orderData.total);

    try {
      // Trace database call
      const order = await tracer.startActiveSpan('db.insert', async (dbSpan) => {
        const result = await db.order.create({ data: orderData });
        dbSpan.end();
        return result;
      });

      // Trace external call
      await tracer.startActiveSpan('payment.charge', async (paySpan) => {
        await paymentService.charge(order.total);
        paySpan.end();
      });

      span.setStatus({ code: SpanStatusCode.OK });
      return order;
    } catch (error) {
      span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
      throw error;
    } finally {
      span.end();
    }
  });
}

4. Alerting

# Alert rules (Prometheus/Alertmanager)
groups:
  - name: application
    rules:
      - alert: HighErrorRate
        expr: rate(http_requests_total{status_code=~"5.."}[5m]) > 0.05
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "High error rate detected"

      - alert: HighLatency
        expr: histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m])) > 2
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "99th percentile latency > 2s"

      - alert: HighMemoryUsage
        expr: process_resident_memory_bytes / process_memory_limit_bytes > 0.8
        for: 5m
        labels:
          severity: warning

Alert Design:

  • Actionable: Every alert requires human action
  • Graded: Warning → Critical → Emergency
  • Context-rich: Include what, when, impact
  • Runbook-linked: Link to resolution steps

5. Dashboards

Key Dashboards:

  • Service Overview: Request rate, error rate, latency (p50/p95/p99)
  • Infrastructure: CPU, memory, disk, network
  • Business Metrics: Orders/min, revenue, conversion rate
  • Database: Query performance, connections, cache hit rate

6. Health Checks

// Health check endpoint
app.get('/health', async (req, res) => {
  const checks = {
    database: await checkDatabase(),
    redis: await checkRedis(),
    externalApi: await checkExternalApi(),
    diskSpace: await checkDiskSpace()
  };

  const healthy = Object.values(checks).every(c => c.status === 'ok');

  res.status(healthy ? 200 : 503).json({
    status: healthy ? 'healthy' : 'degraded',
    checks,
    uptime: process.uptime(),
    timestamp: new Date().toISOString()
  });
});

7. Tools Stack

  • Logging: Winston/Pino (Node), ELK Stack, Loki, Datadog
  • Metrics: Prometheus, Grafana, Datadog, New Relic
  • Tracing: Jaeger, Zipkin, OpenTelemetry, Datadog APM
  • Alerting: PagerDuty, Opsgenie, Slack webhooks
  • Uptime: Pingdom, UptimeRobot, Betterstack

Implementation Checklist

  • Structured logging with correlation IDs
  • Request tracing with OpenTelemetry
  • Key metrics (latency, traffic, errors, saturation)
  • Health check endpoints
  • Alerting rules for critical conditions
  • Dashboards for service and infrastructure
  • Log aggregation and search

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.