11-observability-logging

11-observability-logging is a cursor rule for coding agents from movebrickschi/harness-engineering-mcp. It costs 0 tokens per session (328 once invoked), scanned A, original, MIT.

Rules for structured logs, monitoring measurements, and request tracing. These practices help you understand what a running application is doing and where failures or delays occur.

In plain words
What is it for?
Use it to define JSON log fields and severity levels, measure latency, traffic, errors, and resource usage, expose metrics with Micrometer and Prometheus, and preserve tracing across asynchronous work.
Why use it?
They make logs easier to search and connect across services while preventing sensitive data such as passwords, tokens, and card numbers from being recorded.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/movebrickschi/harness-engineering-mcp/11-observability-logging
Clone the repo
git clone --depth 1 https://github.com/movebrickschi/harness-engineering-mcp

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 11-observability-logging

README.md
[![agentmods](https://agentmods.dev/badge/rules/movebrickschi/harness-engineering-mcp/11-observability-logging.svg)](https://agentmods.dev/rules/movebrickschi/harness-engineering-mcp/11-observability-logging)
Your own site
<a href="https://agentmods.dev/rules/movebrickschi/harness-engineering-mcp/11-observability-logging"><img src="https://agentmods.dev/badge/rules/movebrickschi/harness-engineering-mcp/11-observability-logging.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 328 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00328
Opus 5 $0.00000 $0.00164
Sonnet 5 $0.00000 $0.00066
Haiku 4.5 $0.00000 $0.00033

Measured 3d ago against content hash e90ebc9b0c36, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

11-observability-logging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

assets/rules/11-observability-logging.mdc · 48 lines

What it actually says

可观测性与日志规范

结构化日志

使用JSON格式输出,必须包含以下字段:

字段 说明
trace_id 链路追踪ID
span_id 跨度ID
timestamp 时间戳
severity 日志级别
message 日志消息

日志级别规范

级别 使用场景
ERROR 需要立即处理的系统错误
WARN 业务异常、可恢复的错误
INFO 关键业务路径(登录、支付、状态变更)
DEBUG 开发调试信息,生产环境关闭

禁止在日志中打印:密码、Token、信用卡号、身份证号。使用MDC存储用户上下文。

监控埋点

黄金指标(RED/USE)

  • Latency:接口响应延迟
  • Traffic:请求流量
  • Errors:错误率
  • Saturation:资源饱和度

业务指标

使用Micrometer + Prometheus暴露端点,关键方法添加@Timed@Counted注解。

链路追踪

异步方法必须传递Tracing Context,确保链路完整。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 48 lines · 328 tokens per session scan A e90ebc9b0c36

Subscribe to this mod's changes

11-observability-logging is a cursor rule published in the GitHub repository movebrickschi/harness-engineering-mcp (2 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 328 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.