rs-observability
/rs-observability
Use when adding logging, tracing, metrics or diagnostics to Rust code, or when debugging production behaviour. Triggers: observability, logging, log, tracing, span, #[instrument], structured logging, log levels, RUST_LOG, EnvFilter, tracing-subscriber, OpenTelemetry, OTLP, metrics, Prometheus, correlation id, request id, redact, sensitive data in logs, error chain in logs, what should I log, too much logging, debug in production
- Author
- bassem-elsodany ↗
- Repository
- rs-skills ↗
- Licence
- MIT
- Last repository change
- 11.11.2026
Assessment and security
- Files in this package
- 9
- Scripts
- 0
- HTML comments
- 2
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 11.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- SKILL.md zawiera komentarze HTML (2). Nie widać ich w podglądzie Markdown, a model je czyta.
What it does and when to use it
Use when adding logging, tracing, metrics or diagnostics to Rust code, or when debugging production behaviour. Triggers: observability, logging, log, tracing, span, #[instrument], structured logging, log levels, RUST_LOG, EnvFilter, tracing-subscriber, OpenTelemetry, OTLP, metrics, Prometheus, correlation id, request id, redact, sensitive data in logs, error chain in logs, what should I log, too much logging, debug in production
Original author description
Use when adding logging, tracing, metrics or diagnostics to Rust code, or when debugging production behaviour. Triggers: observability, logging, log, tracing, span, #[instrument], structured logging, log levels, RUST_LOG, EnvFilter, tracing-subscriber, OpenTelemetry, OTLP, metrics, Prometheus, correlation id, request id, redact, sensitive data in logs, error chain in logs, what should I log, too much logging, debug in production
How it works
- Core Question
- Thinking Prompt
- The rules
- Where the instrumentation goes (rs-structure)
- Production checklist
- Anti-Patterns
- Trace Up ↑ / Trace Down ↓
- Rules (8)
- Related Skills
SKILL.md preview
---
name: rs-observability
description: "Use when adding logging, tracing, metrics or diagnostics to Rust code, or when debugging production behaviour. Triggers: observability, logging, log, tracing, span, #[instrument], structured logging, log levels, RUST_LOG, EnvFilter, tracing-subscriber, OpenTelemetry, OTLP, metrics, Prometheus, correlation id, request id, redact, sensitive data in logs, error chain in logs, what should I log, too much logging, debug in production"
user-invocable: false
---
# Observability
> **Layer 4: Delivery** · when it misbehaves in production, what will we see?
## Core Question
**When this misbehaves at 3 a.m., what will the on-call engineer see — and is it enough to act without redeploying?**
Observability is designed, not sprinkled. Decide the *spans* (units of work),
the *fields* (what identifies the work) and the *levels* (who should be woken)
before writing the first `info!`.
---
## Thinking Prompt
1. **What is the unit of work?** Request, job, message, batch — that is a span (`#[instrument]`). Everything inside inherits its fields.
2. **What identifies it?** `request_id`, `tenant`, `order_id` — structured fields, not formatted strings.
3. **What would I grep for?** Then don't grep: emit it as a field and let the backend filter.
4. **What must never appear?** Secrets, tokens, PII — redact at the type level (`Debug` impl or newtype) so it cannot leak.
5. **Who is woken by this level?** `error` = someone acts; `warn` = someone looks tomorrow; `info` = business event; `debug`/`trace` = off in prod.
---
## The rules
| Concern | Do | Rule |
|---|---|---|
| Library vs application | libraries emit `tracing` events only; applications install the subscriber | `obs-tracing-over-log`, `obs-library-facade` |
| Units of work | `#[tracing::instrument(skip(big_args), fields(order_id = %id))]` on boundaries | `obs-instrument-spans` |
| Fields, not strings | `info!(order_id = %id, amount = ?amt, "order placed")` | `obs-structured-fields` |
| Levels and filtering | `EnvFilter` from `RUST_LOG`; `info` default; `debug` per module | `obs-levels-filter` |
| Errors | log the chain once at the boundary (`error = ?e` or `%e` with sources), not at every `?` | `obs-error-chain` |
| Sensitive data | newtypes with redacting `Debug`; never log raw headers/bodies | `obs-no-sensitive-data` |
## Where the instrumentation goes (rs-structure)
```
api/handlers span per request: method, route, request_id, tenant ← info events: accepted/rejected
domain/service span per use case: order_id, step ← info: business events, warn: policy violations
infra/adapters span per external call: system, operation, duration ← error: failures with chain
main / app.rs subscriber setup, OTLP exporter, log format (json in prod)
```
The Design Contract's **Role** line usually names the span.
## Production checklist
- [ ] one span per request/job with a correlation id propagated across services
- [ ] JSON output in production, pretty in dev (`tracing-subscriber` `fmt` layer)
- [ ] every `error!` includes the error chain and enough fields to find the record
- [ ] no secrets or PII in any field — enforced by types, checked in review
- [ ] metrics for the four golden signals (latency, traffic, errors, saturation) if the service has an SLO (rs-domain-cloud-native)
- [ ] log volume at `info` is bounded per request (no per-item `info!` in loops)
## Anti-Patterns
| Anti-pattern | Why bad | Better |
|---|---|---|
| `println!`/`eprintln!` in a library | caller can't filter or route | `tracing` events |
| `log::info!("user {} did {}", a, b)` | unqueryable | structured fields |
| logging at every `?` | one failure → ten log lines | log once at the boundary with the chain |
| `debug!` with a full request body | PII leak, volume | redacted summary fields |
| `#[instrument]` on a hot inner loop | overhead, noise | instrument the boundary, `trace!` inside if needed |
## Trace Up ↑ / Trace Down ↓
| Need | See |
|---|---|
| what counts as a business event | rs-domain-model, rs-domain-* |
| error chains worth logging | rs-error-handling, rs-domain-error |
| spans across `await` and tasks | rs-concurrency |
| exporter/config wiring and release settings | rs-release, rs-domain-cloud-native |
<!-- rules-index:start -->
## Rules (8)
Depth rules under `rules/` — open the one the question needs, not all of them.
**obs-**
- [`obs-error-chain`](rules/obs-error-chain.md) — Log errors with their full source chain, and log each error exactly once
- [`obs-instrument-spans`](rules/obs-instrument-spans.md) — Use `#[tracing::instrument]` and spans to attach context to async tasks and requests
- [`obs-levels-filter`](rules/obs-levels-filter.md) — Use log levels meaningfully and filter with `EnvFilter` / `RUST_LOG`
- [`obs-library-facade`](rules/obs-library-facade.md) — Libraries emit through the tracing/log facade and never install a subscriber
- [`obs-no-reflect-untrusted`](rules/obs-no-reflect-untrusted.md) — Never put the content you just blocked or masked into the reply, a header, or an INFO log
- [`obs-no-sensitive-data`](rules/obs-no-sensitive-data.md) — Never log secrets or PII; redact or skip them
- [`obs-structured-fields`](rules/obs-structured-fields.md) — Record structured key-value fields, not values interpolated into the message string
- [`obs-tracing-over-log`](rules/obs-tracing-over-log.md) — Use `tracing` for structured, span-aware diagnostics instead of `println!` or bare `log`
<!-- rules-index:end -->
---
## Related Skills
| When | See |
|---|---|
| Measuring instead of logging | rs-performance |
| Testing that spans/fields exist | rs-testing |
Files in this package (9)
- SKILL.md 6 KB
- rules/obs-error-chain.md 3 KB
- rules/obs-instrument-spans.md 3 KB
- rules/obs-levels-filter.md 3 KB
- rules/obs-library-facade.md 3 KB
- rules/obs-no-reflect-untrusted.md 1 KB
- rules/obs-no-sensitive-data.md 4 KB
- rules/obs-structured-fields.md 3 KB
- rules/obs-tracing-over-log.md 2 KB
Versions
The database has no other skills named rs-observability.
Database snapshot: 13.11.2026 · package version d553d1aa0e30 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100observability
Use this skill when adding or reviewing logging, metrics, or tracing in an application, or when a production problem can't be diagnosed from the signals that exist today. Triggers: user says "logging", "logs", "trace", "tracing", "metrics", "observability", "instrument",… - 100rust-observability
Instrument, operate, and review Rust applications with tracing spans and events, structured logs, metrics, OpenTelemetry context propagation, Prometheus export, sampling, correlation, redaction, cardinality control, tokio-console diagnostics, and graceful telemetry shutdown. Use… - 90rust-observability
Tracing and operational logging for Cybercore Rust applications. Use when adding logs, spans, EnvFilter, redaction, or command-level diagnostics. Do not use println for operational output. - 100rust-observability
Logs are structured events with named fields, not formatted strings — tracing over log over println!, spans for async context, error chains logged once, and never a secret in a field. Use when adding or reviewing logging, tracing, or metrics in Rust, when println! or… - 100observability
This skill should be used when the user asks about "observability", "logging", "metrics", "tracing", "monitoring", "structured logging", "log format", "log levels", "distributed tracing", "OpenTelemetry", "health checks", or needs guidance on implementing observability and monitoring requirements. - 100otel-go
OpenTelemetry instrumentation for Go. Use when adding observability with distributed tracing, metrics, logging, context propagation, and exporters (OTLP, Jaeger, Prometheus). Triggers on OpenTelemetry Go, OTel Go, tracing Go, instrumentation Go, observability Go, or when…