Skip to content
Back to skills

2705 010 Observability Prometheus Fcec712d

ASecurity

- *Status:* Accepted - *Date:* 2025-02-21 - *Deciders:* Core Engineering Team

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
devopsdocker

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2705-010-observability-prometheus_fcec712d --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2705 010 Observability Prometheus Fcec712d?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2705 010 Observability Prometheus Fcec712d
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2705-010-observability-prometheus-fcec712d/badge)](https://www.skillsdirectory.com/skills/tools-only-2705-010-observability-prometheus-fcec712d)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# ADR-0010: Observability via Prometheus, Structured Logs, and Metrics

- *Status:* Accepted
- *Date:* 2025-02-21
- *Deciders:* Core Engineering Team

## Context

ContextForge is a long-running service that executes tools, processes requests, and federates with remote peers.
Operators and developers must be able to observe:

- Overall system health
- Request throughput and latency
- Tool and resource usage
- Error rates and failure patterns
- Federation behavior and peer availability

The gateway needs to surface this without requiring external instrumentation or agents.

## Decision

We will implement native observability features using:

1. **Structured JSON logs** with optional plaintext fallback:

   - Controlled by `LOG_FORMAT=json|text` and `LOG_LEVEL`
   - Includes fields: timestamp, level, logger name, request ID, route, auth user, latency

2. **Prometheus-compatible `/metrics` endpoint**:

   - Exposes key counters and histograms: tool invocations, failures, resource loads, peer syncs, etc.
   - Uses plain `text/plain; version=0.0.4` exposition format

3. **Latency decorators** and in-code timing for critical paths:

   - Completion requests
   - Resource resolution
   - Federation sync/health probes

4. **Per-request IDs and correlation**:

   - Middleware attaches `X-Request-ID` if present or generates a new one
   - Request ID propagates through logs and errors

## Consequences

- πŸ“Š Metrics can be scraped by Prometheus and visualized in Grafana
- πŸ” Developers can trace logs by request or user
- πŸ› οΈ No external sidecars required for basic visibility
- πŸ“¦ Docker image contains `/metrics` by default and logs to `stdout` (JSON)

## Alternatives Considered

| Option                           | Why Not                                                             |
|----------------------------------|----------------------------------------------------------------------|
| **No structured logging**        | Difficult to parse or filter logs; weak correlation per request     |
| **Third-party APM (e.g., Datadog)** | Adds vendor lock-in, overhead, and cost                            |
| **Syslog or Fluentd only**       | Requires extra deployment layers; still needs JSON emitters         |
| **StatsD / Telegraf metrics**    | Less common today than Prometheus; harder to self-host              |

## Status

Implemented in `LoggingService` and `metrics_router`. Observability is active by default for all transports and routes.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.