Harness observability

From Intense-Visions/harness-engineering · View interactive version

Harness observability is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > Structured logging, metrics, distributed tracing, and alerting strategy. The three pillars of observability, assessed and designed for production readiness.

How to use this skill

Skill file

Harness Observability

Structured logging, metrics, distributed tracing, and alerting strategy. The three pillars of observability, assessed and designed for production readiness.

When to Use

See also: harness-pulse is the read-side companion to this skill. Pulse READS observability data (and external analytics/error signals) to produce daily product-pulse reports; this skill DESIGNS the instrumentation that produces those signals in the first place.

Process

Phase 1: DETECT -- Identify Existing Instrumentation

  1. Scan for observability libraries. Check package manifests for instrumentation dependencies:
  1. Locate instrumentation code. Search for logger, metrics, and tracing initialization:
  1. Detect collector and exporter configuration. Look for:
  1. Identify alerting configuration. Search for:
  1. Present detection summary:

```

Observability Detection:

Logging: pino (structured JSON) -- 12 logger instances found

Metrics: prom-client -- 8 custom metrics defined

Tracing: @opentelemetry/sdk-trace-node -- initialized in src/tracing.ts

Collector: OpenTelemetry Collector -> Grafana Cloud

Alerting: 3 Prometheus alert rules, Slack integration

```


Phase 2: AUDIT -- Evaluate Coverage and Quality

  1. Audit logging quality. Evaluate each logger usage for:
  1. Audit metrics coverage. Check for standard metrics:
  1. Audit tracing implementation. Verify:
  1. Audit alerting effectiveness. Check each alert for:
  1. Score each pillar and identify gaps:

```

Observability Audit:

Logging: 7/10 -- structured, but missing correlation IDs in 4 services

Metrics: 5/10 -- RED metrics partial, no business metrics

Tracing: 8/10 -- good coverage, sampling needs tuning

Alerting: 3/10 -- only 3 rules, no SLO-based alerts, no runbooks

```


Phase 3: DESIGN -- Recommend Instrumentation Strategy

  1. Design logging strategy. Recommend:
  1. Design metrics strategy. Recommend:
  1. Design tracing strategy. Recommend:
  1. Define SLIs and SLOs. For each service endpoint:
  1. Design alerting strategy. Recommend:

Phase 4: VALIDATE -- Verify Instrumentation Correctness

  1. Validate log output. Check that logs from a test run:
  1. Validate metric exposition. Verify:
  1. Validate trace propagation. Verify end-to-end:
  1. Validate alerting rules. Check:
  1. Generate observability report:

```

Observability Validation: [PASS/WARN/FAIL]

Logging: PASS (structured, correlated, no PII detected)

Metrics: WARN (RED metrics present, missing business metrics)

Tracing: PASS (propagation verified, sampling at 10%)

Alerting: FAIL (no SLO-based alerts, 2 of 3 rules missing runbooks)

Priority actions:

1. Define SLOs for /api/orders and /api/payments endpoints

2. Add multi-burn-rate alerts based on SLO error budget

3. Write runbooks for existing alerts

4. Add order_total and payment_success_rate business metrics

```


Harness Integration

Success Criteria

Examples

Example: Express.js API with OpenTelemetry

Phase 1: DETECT
  Logging: pino with pino-http middleware
  Metrics: @opentelemetry/sdk-metrics -> Prometheus
  Tracing: @opentelemetry/sdk-trace-node -> Jaeger
  Collector: OTel Collector (otel-collector-config.yaml)
  Alerting: 5 Prometheus rules in monitoring/alerts.yml

Phase 2: AUDIT
  Logging: 8/10 -- structured JSON, trace IDs present, missing request body size
  Metrics: 6/10 -- http_request_duration_seconds present, missing queue depth
             and business metrics (orders_created_total)
  Tracing: 9/10 -- auto-instrumented HTTP + pg + Redis, manual spans on
             checkout flow
  Alerting: 4/10 -- static thresholds, no SLO burn rate, 2 missing runbooks

Phase 3: DESIGN
  SLOs recommended:
    - POST /api/orders: 99.9% availability, p99 < 800ms
    - GET /api/products: 99.95% availability, p99 < 200ms
  Alerting: Replace static "error rate > 5%" with multi-window burn rate
  Metrics: Add orders_created_total, cart_abandonment_rate gauges
  Logging: Add request/response body size for capacity planning

Phase 4: VALIDATE
  Log output: PASS (valid JSON, no PII)
  Metrics endpoint: PASS (all custom metrics present)
  Trace propagation: PASS (end-to-end verified)
  Alert rules: WARN (valid PromQL, but thresholds not SLO-based)
  Result: WARN -- alerting strategy needs SLO alignment

Example: Go Microservices with Datadog

Phase 1: DETECT
  Logging: zap (structured) across 4 services
  Metrics: Datadog dogstatsd client
  Tracing: dd-trace-go with automatic HTTP/gRPC instrumentation
  Collector: Datadog Agent (datadog.yaml in k8s/)
  Alerting: 12 monitors in Datadog (Terraform-managed)

Phase 2: AUDIT
  Logging: 9/10 -- consistent structured format, correlation IDs, no PII
  Metrics: 7/10 -- RED metrics present, custom counters for business events,
             but missing histogram for gRPC call duration
  Tracing: 8/10 -- HTTP and gRPC instrumented, database spans present,
             Redis spans missing
  Alerting: 6/10 -- good coverage but static thresholds, no error budgets

Phase 3: DESIGN
  1. Add dd-trace-go Redis integration for complete trace picture
  2. Add grpc_server_handling_seconds histogram
  3. Define SLOs in Datadog for top 5 endpoints
  4. Convert 4 highest-priority monitors to SLO burn rate alerts
  5. Add Datadog SLO dashboard for team visibility

Phase 4: VALIDATE
  Log output: PASS
  Metrics: WARN (missing gRPC histogram)
  Traces: WARN (Redis spans missing)
  Alerts: WARN (no SLO-based alerts)
  Result: WARN -- 3 instrumentation gaps, alerting needs SLO alignment

Rationalizations to Reject

| Rationalization | Reality |

| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| "We can see what's happening in CloudWatch logs — we don't need structured logging" | Unstructured log lines cannot be queried, aggregated, or correlated across services. When an incident spans three services, searching for a request ID across unstructured logs is manual forensics. Structured logging is not a nicety — it is the foundation for incident response. |

| "We'll add alerting once we've seen a few incidents and know what to alert on" | The first incident is the worst time to define alerting. SLO-based burn rate alerts can be defined from traffic patterns before any incidents occur. Waiting for incidents to define thresholds means every early failure goes undetected. |

| "User ID is a useful label for the latency metric — it helps us debug per-user issues" | User ID as a metric label creates one time series per user, which at 100,000 users means 100,000 label combinations. High-cardinality labels exhaust metric storage, cause query timeouts, and make the entire metrics system unstable. Use logs for per-user debugging; use metrics for aggregate signals. |

| "The tracing library is initialized, so we have distributed tracing" | Initializing the library creates root spans but does not propagate context across HTTP boundaries, instrument database calls, or connect traces to logs. Trace initialization without verified end-to-end propagation produces disconnected, useless traces. |

| "We have alerts — they're just not linked to runbooks yet" | An alert that fires at 3am without a runbook link requires the on-call engineer to start debugging from scratch. The absence of a runbook is not a documentation gap; it is a mean-time-to-recover multiplier. |

Gates

Escalation

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.