# Story 12.7: Skipping Health/Metrics Endpoints (Noise Reduction)

**Status:** Complete
**Priority:** P2 (Medium)
**Depends on:** None
**Epic:** 12.0 Cookbook (SEO-Driven Documentation)

---

## Context / Background

Health checks and metrics endpoints are called frequently (every few seconds by load balancers and monitoring). Logging every call creates noise that obscures real traffic and increases log storage costs.

fapilog provides path-based filtering to skip noisy endpoints while logging everything else.

**Target search queries:**

- "skip healthcheck logs fastapi"
- "exclude endpoints from logging"
- "fastapi don't log health check"
- "reduce log volume kubernetes"

**Why fapilog is the answer:** Built-in path filtering with simple pattern matching.

---

## Scope (In / Out)

### In Scope

- Cookbook page showing endpoint filtering
- Common patterns (health, metrics, readiness)
- Pattern syntax explanation
- Log volume impact discussion

### Out of Scope

- Custom filter plugins
- Log sampling (separate cookbook page)
- Metrics collection

---

## Acceptance Criteria

### AC1: Page Exists with Correct Title

**Description:** Cookbook page created with SEO-optimized title.

**Validation:**
```
docs/cookbook/skip-noisy-endpoints.md exists
H1: "Skipping health/metrics endpoints (noise reduction)"
```

### AC2: Common Patterns Shown

**Description:** Ready-to-use patterns for typical endpoints.

**Validation:**
```python
from fapilog.fastapi import setup_logging

lifespan = setup_logging(
    skip_paths=[
        "/health",
        "/healthz",
        "/ready",
        "/readiness",
        "/metrics",
        "/ping",
    ],
)
```

### AC3: Pattern Syntax Documented

**Description:** How to write custom patterns.

**Validation:**
- Exact match vs prefix vs regex
- Wildcard support (if any)
- Case sensitivity

### AC4: Volume Impact Mentioned

**Description:** Why this matters in production.

**Validation:**
- Typical reduction (e.g., "health checks can be 90% of log volume")
- Cost implications
- Signal-to-noise improvement

---

## Implementation Notes

### File Path

`docs/cookbook/skip-noisy-endpoints.md`

### Page Structure

```markdown
# Skipping health/metrics endpoints (noise reduction)

Health checks every 5 seconds means 17,000 log lines per day per instance...

## The Problem

{Volume numbers}
{Signal buried in noise}

## The Solution

```python
lifespan = setup_logging(
    skip_paths=["/health", "/metrics"],
)
```

## Common Patterns to Skip

| Pattern | Used By |
|---------|---------|
| /health, /healthz | Kubernetes |
| /ready, /readiness | Kubernetes |
| /metrics | Prometheus |
| /ping | Load balancers |

## Pattern Matching Syntax

{How patterns work}

## Going Deeper

- [Filter Plugins](/plugins/filters)
- [Log Sampling](/cookbook/log-sampling-rate-limiting)
```

---

## Tasks

- [ ] Create `docs/cookbook/skip-noisy-endpoints.md`
- [ ] Write volume impact section
- [ ] List common skip patterns
- [ ] Document pattern syntax
- [ ] Test code examples
- [ ] Add cross-links

---

## Tests

- Skip patterns actually skip
- Other paths still logged
- Links valid

---

## Definition of Done

### Content Complete

- [ ] All sections written
- [ ] Patterns tested
- [ ] Volume claims reasonable

### SEO Optimized

- [ ] Keywords in H1 and first paragraph
- [ ] Under 1000 words

### Integrated

- [ ] Added to cookbook index
- [ ] Linked from FastAPI guide

---

## Risks / Rollback

### Risks

1. **Risk:** Pattern syntax changes
   - **Mitigation:** Test against implementation

### Rollback Plan

Revert commit.

---

## Change Log

| Date | Change | Author |
|------|--------|--------|
| 2026-01-21 | Initial draft | Claude |
