# Send Logging Observability to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "logging-observability",
    "name": "Logging Observability",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/wpank/logging-observability",
    "canonicalUrl": "https://clawhub.ai/wpank/logging-observability",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/logging-observability",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=logging-observability",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "logging-observability",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-02T05:41:16.569Z",
      "expiresAt": "2026-05-09T05:41:16.569Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=logging-observability",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=logging-observability",
        "contentDisposition": "attachment; filename=\"logging-observability-0.1.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "logging-observability"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/logging-observability"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/logging-observability",
    "downloadUrl": "https://openagent3.xyz/downloads/logging-observability",
    "agentUrl": "https://openagent3.xyz/skills/logging-observability/agent",
    "manifestUrl": "https://openagent3.xyz/skills/logging-observability/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/logging-observability/agent.md"
  }
}
```
## Documentation

### Logging & Observability

Patterns for building observable systems across the three pillars: logs, metrics, and traces.

### Three Pillars

PillarPurposeQuestion It AnswersExampleLogsWhat happenedWhy did this request fail?{"level":"error","msg":"payment declined","user_id":"u_82"}MetricsHow much / how fastIs latency increasing?http_request_duration_seconds{route="/api/orders"} 0.342TracesRequest flowWhere is the bottleneck?Span: api-gateway → auth → order-service → db

Each pillar is strongest when correlated. Embed trace_id in every log line to jump from a log entry to the full distributed trace.

### Structured Logging

Always emit logs as structured JSON — never free-text strings.

### Required Fields

FieldPurposeRequiredtimestampISO-8601 with millisecondsYeslevelSeverity (DEBUG … FATAL)YesserviceOriginating service nameYesmessageHuman-readable descriptionYestrace_idDistributed trace correlationYesspan_idCurrent span within traceYescorrelation_idBusiness-level correlation (order ID)When applicableerrorStructured error objectOn errorscontextRequest-specific metadataRecommended

### Context Enrichment

Attach context at the middleware level so downstream logs inherit automatically:

app.use((req, res, next) => {
  const ctx = {
    trace_id: req.headers['x-trace-id'] || crypto.randomUUID(),
    request_id: crypto.randomUUID(),
    user_id: req.user?.id,
    method: req.method,
    path: req.path,
  };
  asyncLocalStorage.run(ctx, () => next());
});

### Library Recommendations

LibraryLanguageStrengthsPerfPinoNode.jsFastest Node logger, low overheadExcellentstructlogPythonComposable processors, context bindingGoodzerologGoZero-allocation JSON loggingExcellentzapGoHigh performance, typed fieldsExcellenttracingRustSpans + events, async-awareExcellent

Choose a logger that outputs structured JSON natively. Avoid loggers requiring post-processing.

### Log Levels

LevelWhen to UseExampleFATALApp cannot continue, process will exitDatabase connection pool exhaustedERROROperation failed, needs attentionPayment charge failed: CARD_DECLINEDWARNUnexpected but recoverableRetry 2/3 for upstream timeoutINFONormal business eventsOrder ORD-1234 placed successfullyDEBUGDeveloper troubleshootingCache miss for key user:82:preferencesTRACEVery fine-grained (rarely in prod)Entering validateAddress with payload

Rules: Production default = INFO and above. If you log an ERROR, someone should act on it. Every FATAL should trigger an alert.

### OpenTelemetry Setup

Always prefer OpenTelemetry over vendor-specific SDKs:

import { NodeSDK } from '@opentelemetry/sdk-node';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';

const sdk = new NodeSDK({
  serviceName: 'order-service',
  traceExporter: new OTLPTraceExporter({
    url: 'http://otel-collector:4318/v1/traces',
  }),
  instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();

### Span Creation

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

async function processOrder(order: Order) {
  return tracer.startActiveSpan('processOrder', async (span) => {
    try {
      span.setAttribute('order.id', order.id);
      span.setAttribute('order.total_cents', order.totalCents);
      await validateInventory(order);
      await chargePayment(order);
      span.setStatus({ code: SpanStatusCode.OK });
    } catch (err) {
      span.setStatus({ code: SpanStatusCode.ERROR, message: err.message });
      span.recordException(err);
      throw err;
    } finally {
      span.end();
    }
  });
}

### Context Propagation

Use W3C Trace Context (traceparent header) — default in OTel
Propagate across HTTP, gRPC, and message queues
For async workers: serialise traceparent into the job payload

### Trace Sampling

StrategyUse WhenAlways OnLow-traffic services, debuggingProbabilistic (N%)General production useRate-limited (N/sec)High-throughput servicesTail-basedWhen you need all error traces

Always sample 100% of error traces regardless of strategy.

### RED Method (Request-Driven)

Monitor these three for every service endpoint:

MetricWhat It MeasuresPrometheus ExampleRateRequests/secrate(http_requests_total[5m])ErrorsFailed request ratiorate(http_requests_total{status=~"5.."}[5m])DurationResponse timehistogram_quantile(0.99, http_request_duration_seconds)

### USE Method (Resource-Driven)

For infrastructure components (CPU, memory, disk, network):

MetricWhat It MeasuresExampleUtilization% resource busyCPU usage at 78%SaturationWork queued/waiting12 requests queued in thread poolErrorsError events on resource3 disk I/O errors in last minute

### Monitoring Stack

ToolCategoryBest ForPrometheusMetricsPull-based metrics, alerting rulesGrafanaVisualisationDashboards for metrics, logs, tracesJaegerTracingDistributed trace visualisationLokiLogsLog aggregation (pairs with Grafana)OpenTelemetryCollectionVendor-neutral telemetry collection

Recommendation: Start with OTel Collector → Prometheus + Grafana + Loki + Jaeger. Migrate to SaaS only when operational overhead justifies cost.

### Severity Levels

SeverityResponse TimeExampleP1ImmediateService fully down, data lossP2< 30 minError rate > 5%, latency p99 > 5sP3Business hoursDisk > 80%, cert expiring in 7 daysP4Best effortNon-critical deprecation warning

### Alert Fatigue Prevention

Alert on symptoms, not causes — "error rate > 5%" not "pod restarted"
Multi-window, multi-burn-rate — catch both sudden spikes and slow burns
Require runbook links — every alert must link to diagnosis and remediation
Review monthly — delete or tune alerts that never fire or always fire
Group related alerts — use inhibition rules to suppress child alerts
Set appropriate thresholds — if alert fires daily and is ignored, raise threshold or delete

### Overview Dashboard ("War Room")

Total requests/sec across all services
Global error rate (%) with trendline
p50 / p95 / p99 latency
Active alerts count by severity
Deployment markers overlaid on graphs

### Service Dashboard (Per-Service)

RED metrics for each endpoint
Dependency health (upstream/downstream success rates)
Resource utilisation (CPU, memory, connections)
Top errors table with count and last seen

### Observability Checklist

Every service must have:

Structured JSON logging with consistent schema
 Correlation / trace IDs propagated on all requests
 RED metrics exposed for every external endpoint
 Health check endpoints (/healthz and /readyz)
 Distributed tracing with OpenTelemetry
 Dashboards for RED metrics and resource utilisation
 Alerts for error rate, latency, and saturation with runbook links
 Log level configurable at runtime without redeployment
 PII scrubbing verified and tested
 Retention policies defined for logs, metrics, and traces

### Anti-Patterns

Anti-PatternProblemFixLogging PIIPrivacy/compliance violationMask or exclude PII; use token referencesExcessive loggingStorage costs balloon, signal drownsLog business events, not data flowUnstructured logsCannot query or alert on fieldsUse structured JSON with consistent schemaString interpolationBreaks structured fields, injection riskPass fields as metadata, not in messageMissing correlation IDsCannot trace across servicesGenerate and propagate trace_id everywhereAlert stormsOn-call fatigue, real issues buriedUse grouping, inhibition, deduplicationMetrics with high cardinalityPrometheus OOM, dashboard timeoutsNever use user ID or request ID as label

### NEVER Do

NEVER log passwords, tokens, API keys, or secrets — even at DEBUG level
NEVER use console.log / print in production — use a structured logger
NEVER use user IDs, emails, or request IDs as metric labels — cardinality will explode
NEVER create alerts without a runbook link — unactionable alerts erode trust
NEVER rely on logs alone — you need metrics and traces for full observability
NEVER log request/response bodies by default — opt-in only, with PII redaction
NEVER ignore log volume — set budgets and alert when a service exceeds daily quota
NEVER skip context propagation in async flows — broken traces are worse than no traces
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: wpank
- Version: 0.1.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-02T05:41:16.569Z
- Expires at: 2026-05-09T05:41:16.569Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/logging-observability)
- [Send to Agent page](https://openagent3.xyz/skills/logging-observability/agent)
- [JSON manifest](https://openagent3.xyz/skills/logging-observability/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/logging-observability/agent.md)
- [Download page](https://openagent3.xyz/downloads/logging-observability)