agentleFS
aiFabricoComaiFabricoCom/fabrico-collections/.claude/skills/fabrico-implementing-observability/SKILL.md

fabrico-implementing-observability

Skill2 starsChanged 4 months agoMITView on GitHub

Observability patterns for logging, monitoring, alerting, and distributed tracing. Use when implementing metrics collection, log aggregation, alerting rules, or distributed tracing across services.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check which observability stack the project uses:

    line 26
  2. Very specific:

    Use the context7 MCP server (tools mcp__context7__*) to look up stack-specific configuration syntax.

    line 33
  3. Distinctive:

    Actionable: Every alert must have a clear response action

    line 135
  4. Distinctive:

    Unique: Avoid duplicate alerts for same incident

    line 137

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

Observability Patterns

When to Use

  • Setting up monitoring and alerting for applications
  • Implementing centralized logging
  • Adding distributed tracing to microservices
  • Designing SLOs/SLIs and error budgets
  • Creating dashboards and runbooks

Three Pillars of Observability

PillarPurposeTools
MetricsQuantitative measurements over timePrometheus, CloudWatch, Datadog, Grafana
LogsDiscrete events with contextELK, Loki, CloudWatch Logs, Splunk
TracesRequest flow across servicesJaeger, Zipkin, X-Ray, Tempo

Stack Detection

Check which observability stack the project uses:

  • prometheus.yml or ServiceMonitor → Prometheus
  • fluent-bit.conf or fluentd.conf → Fluent Bit/Fluentd
  • otel-collector-config.yaml → OpenTelemetry
  • AWS with aws_cloudwatch_* resources → CloudWatch
  • datadog-agent or DD_* env vars → Datadog

Use the context7 MCP server (tools mcp__context7__*) to look up stack-specific configuration syntax.

Solution Decision Matrix

Metrics Stack

ScenarioRecommended Solution
Kubernetes-native, cost-sensitivePrometheus + Grafana
AWS-native, simple setupCloudWatch Metrics
Multi-cloud, enterpriseDatadog or New Relic
OpenTelemetry-firstPrometheus with OTLP receiver

Logging Stack

ScenarioRecommended Solution
Kubernetes, cost-sensitiveLoki + Grafana
AWS-nativeCloudWatch Logs
High volume, complex queriesElasticsearch (ELK)
Multi-cloud, managedDatadog Logs or Splunk

Tracing Stack

ScenarioRecommended Solution
Kubernetes, open-sourceJaeger or Tempo
AWS-nativeX-Ray
Multi-cloud, correlatedDatadog APM
Vendor-agnosticOpenTelemetry → any backend

Kubernetes Observability Pattern

┌─────────────────────────────────────────────────────┐
│                   Applications                      │
│  (instrumented with OpenTelemetry SDK or auto-inst) │
└──────────────────────┬──────────────────────────────┘
                       │ OTLP
                       ▼
┌─────────────────────────────────────────────────────┐
│            OpenTelemetry Collector                  │
│  (receives, processes, exports telemetry)           │
└───────┬─────────────────┬─────────────────┬─────────┘
        │                 │                 │
        ▼                 ▼                 ▼
   Prometheus          Loki             Tempo/Jaeger
   (metrics)          (logs)            (traces)
        │                 │                 │
        └────────────────┬┴─────────────────┘
                         ▼
                      Grafana
                   (visualization)

SLO/SLI Framework

Key Metrics (RED Method for Services)

MetricDescriptionExample SLI
RateRequests per secondrate(http_requests_total[5m])
ErrorsFailed requestsrate(http_requests_total{status=~"5.."}[5m])
DurationLatency distributionhistogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))

Key Metrics (USE Method for Resources)

MetricDescriptionExample
Utilization% time resource is busyCPU usage, memory usage
SaturationQueue depth, waitingPod pending, connection pool
ErrorsError countOOM kills, disk errors

SLO Definition Template

# Example: API availability SLO
slo:
  name: api-availability
  description: "API returns successful responses"
  sli:
    metric: |
      sum(rate(http_requests_total{status!~"5.."}[5m]))
      /
      sum(rate(http_requests_total[5m]))
  target: 99.9%
  window: 30d
  error_budget: 0.1%  # ~43 minutes/month downtime allowed

Alerting Strategy

Alert Severity Levels

SeverityResponseExample
CriticalPage on-call immediatelyService down, data loss risk
WarningInvestigate within hoursError rate elevated, disk 80%
InfoReview during business hoursDeployment completed, scaling event

Alert Quality Rules

  • Actionable: Every alert must have a clear response action
  • Relevant: Alert on symptoms (user impact), not causes
  • Unique: Avoid duplicate alerts for same incident
  • Timely: Alert early enough to prevent impact

Alert Template (Prometheus)

groups:
  - name: api-alerts
    rules:
      - alert: HighErrorRate
        expr: |
          sum(rate(http_requests_total{status=~"5.."}[5m]))
          /
          sum(rate(http_requests_total[5m])) > 0.01
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "High error rate detected"
          description: "Error rate is {{ $value | humanizePercentage }} (threshold: 1%)"
          runbook_url: "https://runbooks.example.com/high-error-rate"

Structured Logging

Log Format (JSON)

{
  "timestamp": "2024-01-15T10:30:00Z",
  "level": "error",
  "message": "Payment processing failed",
  "service": "payment-api",
  "trace_id": "abc123",
  "span_id": "def456",
  "user_id": "user-789",
  "error": {
    "type": "PaymentGatewayError",
    "message": "Connection timeout"
  },
  "context": {
    "payment_id": "pay-123",
    "amount": 99.99
  }
}

Required Log Fields

FieldPurposeCorrelation
timestampWhen event occurredTime-based queries
levelSeverity (debug/info/warn/error)Filtering
serviceSource service nameService filtering
trace_idDistributed trace identifierCross-service correlation
messageHuman-readable descriptionSearch

Process

  1. Discover context → Check existing observability setup (Prometheus, CloudWatch, etc.)
  2. Choose stack → Use decision matrix based on environment and requirements
  3. Instrument apps → Add OpenTelemetry SDK or auto-instrumentation
  4. Configure collection → Set up collectors, exporters, and storage
  5. Define SLOs → Establish SLIs, targets, and error budgets
  6. Create alerts → Implement actionable alerts with runbooks
  7. Build dashboards → Create service and infrastructure dashboards
  8. Document runbooks → Write response procedures for each alert

Checklist

  • All services emit metrics, logs, and traces
  • Trace IDs propagated across service boundaries
  • Structured logging with consistent format (JSON)
  • SLOs defined with error budgets
  • Alerts are actionable with runbook links
  • Dashboards show service health at a glance
  • Log retention policy configured
  • PII/sensitive data excluded from logs
  • On-call rotation defined for critical alerts

Anti-Patterns

Don'tDo
Alert on every metric thresholdAlert on user-impacting symptoms
Log everything at DEBUG in productionUse appropriate log levels
Unstructured log messagesStructured JSON logging
Missing trace contextPropagate trace IDs across services
Dashboards with 50+ panelsFocused dashboards per service/domain
Alerts without runbooksEvery alert links to response procedure
Store logs indefinitelyDefine retention based on compliance needs

Related Skills

  • fabrico-implementing-kubernetes - For K8s-native observability setup
  • fabrico-implementing-ci-cd - For pipeline observability integration
  • fabrico-managing-secrets - For secure credential storage for observability tools

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.