chore: initialize EverOS 1.0.0
md-first memory extraction framework for AI agents. Markdown is the single source of truth; SQLite holds state and LanceDB provides the rebuildable vector + BM25 + scalar index. The codebase follows a single-direction DDD layering (entrypoints -> service -> memory -> infra, with component / core / config cross-cutting) enforced by import-linter. Engineering surface: - Coding conventions in .claude/rules/ (path-scoped) and workflows in .claude/skills/ (/commit, /new-branch, /pr). - GitHub Actions CI runs make lint + test + integration; pre-commit mirrors the gates locally (ruff, hygiene hooks, gitlint commit-msg). - Commit messages follow Conventional Commits, enforced by gitlint. - make lint also enforces datetime two-zone discipline and OpenAPI drift.
This commit is contained in:
50
src/everos/core/observability/metrics/counter.py
Normal file
50
src/everos/core/observability/metrics/counter.py
Normal file
@ -0,0 +1,50 @@
|
||||
"""Counter wrapper around ``prometheus_client.Counter``."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from prometheus_client import Counter as PromCounter
|
||||
|
||||
from .registry import get_metrics_registry
|
||||
|
||||
|
||||
class Counter:
|
||||
"""Monotonically-increasing counter (totals, error counts)."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
description: str,
|
||||
labelnames: Sequence[str] = (),
|
||||
namespace: str = "",
|
||||
subsystem: str = "",
|
||||
unit: str = "",
|
||||
) -> None:
|
||||
self._counter = PromCounter(
|
||||
name=name,
|
||||
documentation=description,
|
||||
labelnames=labelnames,
|
||||
namespace=namespace,
|
||||
subsystem=subsystem,
|
||||
unit=unit,
|
||||
registry=get_metrics_registry(),
|
||||
)
|
||||
self._labelnames = tuple(labelnames)
|
||||
|
||||
def labels(self, **labels: str) -> LabeledCounter:
|
||||
return LabeledCounter(self._counter.labels(**labels))
|
||||
|
||||
def inc(self, amount: float = 1.0) -> None:
|
||||
self._counter.inc(amount)
|
||||
|
||||
|
||||
class LabeledCounter:
|
||||
"""Counter slice with labels applied."""
|
||||
|
||||
def __init__(self, labeled: Any) -> None:
|
||||
self._labeled = labeled
|
||||
|
||||
def inc(self, amount: float = 1.0) -> None:
|
||||
self._labeled.inc(amount)
|
||||
Reference in New Issue
Block a user