MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / __init__

Method __init__

uncommon_route/traces.py:336–360  ·  view source on GitHub ↗
(
        self,
        storage: TraceStorage | None = None,
        now_fn: Any = None,
        *,
        hot_days: int | None = None,
    )

Source from the content-addressed store, hash-verified

334
335class TraceStore:
336 def __init__(
337 self,
338 storage: TraceStorage | None = None,
339 now_fn: Any = None,
340 *,
341 hot_days: int | None = None,
342 ) -> None:
343 if storage is None:
344 target_dir = data_dir() / "traces"
345 legacy = data_dir() / "traces.json"
346 try:
347 migrate_legacy_json(legacy, target_dir)
348 except Exception:
349 pass
350 storage = FileTraceStorage(base_dir=target_dir)
351 self._storage = storage
352 self._now = now_fn or time.time
353 if hot_days is None:
354 try:
355 hot_days = int(os.environ.get("UNCOMMON_ROUTE_TRACE_HOT_DAYS", "2"))
356 except Exception:
357 hot_days = 2
358 self._hot_days = max(1, hot_days)
359 self._records: list[RequestTrace] = []
360 self._load()
361
362 @property
363 def count(self) -> int:

Callers

nothing calls this directly

Calls 5

_loadMethod · 0.95
data_dirFunction · 0.90
migrate_legacy_jsonFunction · 0.85
FileTraceStorageClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected