stack: Telemetrie-Default nach Installationsform, Byte-Deckel und Session-Retention (schliesst #55)
CI / verify (push) Successful in 53s
Release / release (push) Successful in 36s

Files changed:
- .gitea/workflows/ci.yml
- .gitignore
- CHANGES.md
- EVALS.md
- INSTALL-MCP.md
- INSTALL.md
- VERSION
- instructions/setup-instance.md
- reports/CONTRACT.md
- tools/CONTRACT.md
- tools/chemenu/commands/doctor.py
- tools/chemenu/config.py
- tools/chemenu/mcp/server.py
- tools/chemenu/telemetry/policy.py
- tools/chemenu/telemetry/schema.py
- tools/chemenu/telemetry/writer.py
- tools/chemenu/tests/conftest.py
- tools/chemenu/tests/test_doctor.py
- tools/chemenu/tests/test_mcp_server.py
- tools/chemenu/tests/test_telemetry_emit.py
- tools/chemenu/tests/test_telemetry_policy.py
- tools/chemenu/version.py
This commit is contained in:
torben committed 2026-09-10 23:38:22 +02:00
1 parent 71446c0f29
commit 82a22eaa93
22 files changed
+801 -44

No files matched your search

+34 -1
View File
@@ -345,6 +345,37 @@ def check_generated_files() -> Check:
return Check("generated-files", "OK", "kb/index.md, kb/log.md, kb/provenance.md present")
def check_telemetry() -> Check:
"""Whether tracing is on for this checkout, why, and how full its two caps
are.
Never `FAIL`s, the same line `check_publish_remotes` and
`check_environment` draw: both an enabled and a disabled tree are
legitimate states, and a `FAIL` would make one of them mandatory by the
back door. The tree walk below is fine here - `doctor` is not a hot path,
unlike the `stat` `emit()` does on every append.
"""
from chemenu.telemetry import policy as telemetry_policy
from chemenu.telemetry import reader
from chemenu.telemetry.writer import TRACE_FILE, trace_root
pol = telemetry_policy.resolve(config.ROOT)
root = trace_root()
session_count = len(reader.sessions(root))
total_bytes = (
sum(f.stat().st_size for f in root.glob(f"*/{TRACE_FILE}") if f.is_file())
if root.exists()
else 0
)
state = "on" if pol.enabled else "off"
return Check(
"telemetry", "OK",
f"{state} ({pol.reason}); {session_count}/{pol.keep_sessions} session(s), "
f"{total_bytes:,} byte(s) under {rel_path(root)} "
f"(cap {pol.max_session_bytes:,} byte(s)/session)",
)
def check_session_id() -> Check:
import os
@@ -449,6 +480,7 @@ def run_doctor() -> list[Check]:
check_publish_remotes(),
check_generated_files(),
check_session_id(),
check_telemetry(),
]
return checks
@@ -458,7 +490,8 @@ def doctor_command(
):
"""Check that this instance is correctly configured: dependencies, author,
git identity/remote, published skills, structure, personalization, KB
conventions, generated files, and session scoping. Read-only. Exits 1 only
conventions, generated files, session scoping, and telemetry state.
Read-only. Exits 1 only
if a check FAILs."""
checks = run_doctor()