From 20becdd0a1ad9c2ca1dd8892ce3d1715f9f10f4c Mon Sep 17 00:00:00 2001 From: "h.nejati" Date: Sun, 18 Oct 2026 15:45:47 +0330 Subject: [PATCH] feat: follow ArchiPy 5.16 APIs for decorators, OTel, Keycloak and RPC metrics (0.22.0) Co-Authored-By: Claude Sonnet 5.5 --- .claude-plugin/marketplace.json | 2 +- .claude-plugin/plugin.json | 2 +- .cursor-plugin/marketplace.json | 2 +- .cursor-plugin/plugin.json | 2 +- CHANGELOG.md | 23 ++++++++++++++++++ README.md | 8 +++---- agents/archipy-reviewer.md | 15 +++++++++--- .../graders/layering.md | 2 +- .../graders/atomic-decorator.md | 2 +- .../graders/transaction-in-logic.md | 2 +- .../graders/catches-violations.md | 2 +- evals/06-reviewer-violations/scaffold.sh | 4 ++-- .../graders/no-false-positives.md | 2 +- evals/07-reviewer-clean-diff/scaffold.sh | 4 ++-- evals/README.md | 2 +- rules/architecture-for-apps.mdc | 4 ++-- rules/using-archipy-decorators.mdc | 17 +++++++------ rules/using-archipy-interceptors.mdc | 4 ++-- rules/using-archipy-logics.mdc | 8 +++---- rules/using-archipy-repositories.mdc | 2 +- rules/using-archipy-services.mdc | 6 ++--- rules/using-archipy-utils.mdc | 7 +++--- scripts/check_catalog.py | 7 +++--- skills/archipy-docs/reference.md | 9 ++++--- skills/archipy-docs/reference/adapters.md | 24 +++++++++++-------- skills/archipy-docs/reference/helpers.md | 17 +++++++------ .../archipy-docs/reference/observability.md | 6 ++--- skills/archipy-docs/reference/services.md | 2 +- skills/docs-observability/SKILL.md | 6 ++--- skills/scaffold-app/SKILL.md | 2 +- skills/scaffold-decorator/SKILL.md | 14 +++++------ skills/scaffold-domain/SKILL.md | 2 +- skills/scaffold-logic/SKILL.md | 6 ++--- skills/scaffold-observability/SKILL.md | 13 ++++++---- 34 files changed, 133 insertions(+), 97 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index bf9af2b..108acca 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -8,7 +8,7 @@ "name": "archipy", "source": ".", "description": "Cursor and Claude Code plugin: rules, skills, agents, and hooks for building apps with ArchiPy", - "version": "0.21.0" + "version": "0.22.0" } ] } diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index e6ddfad..7861c42 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "archipy", - "version": "0.21.0", + "version": "0.22.0", "description": "Cursor and Claude Code plugin: rules, skills, agents, and hooks for building apps with ArchiPy", "author": { "name": "SyntaxArc" diff --git a/.cursor-plugin/marketplace.json b/.cursor-plugin/marketplace.json index bf9af2b..108acca 100644 --- a/.cursor-plugin/marketplace.json +++ b/.cursor-plugin/marketplace.json @@ -8,7 +8,7 @@ "name": "archipy", "source": ".", "description": "Cursor and Claude Code plugin: rules, skills, agents, and hooks for building apps with ArchiPy", - "version": "0.21.0" + "version": "0.22.0" } ] } diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.json index 277767f..5c99d7d 100644 --- a/.cursor-plugin/plugin.json +++ b/.cursor-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "archipy", - "version": "0.21.0", + "version": "0.22.0", "description": "Cursor and Claude Code plugin: rules, skills, agents, and hooks for building apps with ArchiPy", "author": { "name": "SyntaxArc" diff --git a/CHANGELOG.md b/CHANGELOG.md index e0c2998..e68acca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.22.0] - 2026-10-18 + +### Changed + +- Rules, skills, the cheat sheet and `archipy-reviewer` follow ArchiPy 5.16: unit of work is + `postgres_sqlalchemy_atomic` (and the mysql/sqlite/starrocks/generic variants) imported from + `archipy.adapters.base.sqlalchemy.atomic`, and one name serves sync and async logics +- Decorator guidance uses the suffix-less names (`retry`, `timeout`, `timing`, `singleton`, `ttl_cache`, + `grpc_rate_limit`) and says that decorators detect `async def` +- FastAPI telemetry is installed with `archipy[otel,fastapi]`; the `otel-fastapi` extra no longer exists +- gRPC server metrics are `rpc.server.call.duration` +- Keycloak guards are `fastapi_auth` / `grpc_auth` from `archipy.adapters.keycloak.auth`; the actor is also readable + through `AuthContextManager`, not `request.state` +- `scaffold-observability` lists the OTel tuning options (sampler, B3 propagation, compression, batching, resource + detectors, standard `OTEL_*` variables) +- The cheat sheet is verified against `archipy` 5.16.x + +### Added + +- `archipy-reviewer` flags names deprecated in ArchiPy 5.10 to 5.16 (removed in 6.0.0), and dashboards still using the + old RPC metric names +- `scripts/check_catalog.py` rejects `otel-fastapi` and `KeycloakUtils` in the cheat sheet + ## [0.21.0] - 2026-10-14 ### Added diff --git a/README.md b/README.md index cf7a1aa..699515f 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ each workflow once. | `scaffold-domain` | `/scaffold-domain` | Model + you | Full domain slice (models, repo, logic, service) | | `scaffold-models` | `/scaffold-models` | Model + you | Domain/repository DTOs, errors, optional entities under `models/` | | `scaffold-adapter` | `/scaffold-adapter` | Model + you | Domain adapter under `repositories/{domain}/adapters/` | -| `scaffold-logic` | `/scaffold-logic` | Model + you | Use-case under `logics/{domain}/` with `*_sqlalchemy_atomic_decorator` | +| `scaffold-logic` | `/scaffold-logic` | Model + you | Use-case under `logics/{domain}/` with `*_sqlalchemy_atomic` | | `scaffold-service` | `/scaffold-service` | Model + you | Thin FastAPI/gRPC service under `services/{domain}/v{n}/` | | `scaffold-bdd` | `/scaffold-bdd` | Model + you | Behave tests via REST/gRPC + testcontainers | | `scaffold-utils` | `/scaffold-utils` | Model + you | Wire or create `helpers/utils` | @@ -202,7 +202,7 @@ the layer-producing scaffold skills run it in their `## Verify` step. Claude Cod ### `/scaffold-decorator` -- **Purpose:** Prefer ArchiPy decorators (`ttl_cache_decorator`, `postgres_sqlalchemy_atomic_decorator`, +- **Purpose:** Prefer ArchiPy decorators (`ttl_cache`, `postgres_sqlalchemy_atomic`, `trace_span` / `trace_root`, `measure_duration` / `count_calls`, …). - **Asks:** Purpose; sync/async; built-in vs custom. - **Outcome:** Usage snippet or `helpers/decorators/.py` with example. @@ -276,7 +276,7 @@ Pure utilities; prefer ArchiPy utils. **AppUtils** for FastAPI/gRPC factories. Prefer ArchiPy decorators; UoW decorators belong on **logics**. -- **Do:** Preserve wrapped signatures (`functools.wraps`); use `postgres_sqlalchemy_atomic_decorator` on logics. +- **Do:** Preserve wrapped signatures (`functools.wraps`); use `postgres_sqlalchemy_atomic` on logics. - **Don’t:** Construct adapters inside decorator modules. ### `using-archipy-interceptors` @@ -311,7 +311,7 @@ Domain data access; adapters under `repositories/{domain}/adapters/`. Business rules + unit of work; domain isolation. -- **Do:** Domain DTO in/out; `*_sqlalchemy_atomic_decorator` on public methods; call other logics for cross-domain. +- **Do:** Domain DTO in/out; `*_sqlalchemy_atomic` on public methods; call other logics for cross-domain. - **Don’t:** Import another domain’s repository; import FastAPI/gRPC. ### `using-archipy-services` diff --git a/agents/archipy-reviewer.md b/agents/archipy-reviewer.md index a0a4a06..ed51f9a 100644 --- a/agents/archipy-reviewer.md +++ b/agents/archipy-reviewer.md @@ -81,8 +81,8 @@ makes it worse. **Unit of work** -- Transactions use a real `*_sqlalchemy_atomic_decorator` on logics only: `postgres_sqlalchemy_atomic_decorator` - (or the sqlite/starrocks variant) for sync code, `async_postgres_sqlalchemy_atomic_decorator` for async. There is no +- Transactions use a real `*_sqlalchemy_atomic` on logics only: `postgres_sqlalchemy_atomic` + (or the mysql/sqlite/starrocks variant), which detects `async def` itself. There is no decorator named `atomic`. - A logic method that reads or writes through a SQLAlchemy-backed repository without an atomic decorator is a finding. - Sync and async are not mixed within one class or one server. @@ -126,7 +126,16 @@ makes it worse. - On `archipy` 5.x, flag removed 4.x APIs and extras: `TracingUtils`, `PrometheusUtils`, `capture_span`, `capture_transaction`, `FastAPIRateLimitConfig`, and the `sentry`, `elastic-apm`, `prometheus` extras. The 5.x - replacements are `OtelUtils`, `trace_span`, and the `otel`, `otel-fastapi`, `otel-grpc` extras. + replacements are `OtelUtils`, `trace_span`, and the `otel` and `otel-grpc` extras. FastAPI telemetry needs `archipy[otel,fastapi]`; there is no `otel-fastapi` + extra on 5.16+. +- On `archipy` 5.10+ flag deprecated names that warn today and are removed in 6.0.0 (**Should fix**, name the + replacement): `*_decorator` and `async_*` decorator names (`retry`, `timeout`, `timing`, `singleton`, `ttl_cache`, + `grpc_rate_limit`, `*_sqlalchemy_atomic`); on 5.16+ the atomic decorators imported from `archipy.helpers.decorators` + instead of `archipy.adapters.base.sqlalchemy.atomic`; `KeycloakUtils` and `archipy.helpers.utils.keycloak_utils` + instead of `fastapi_auth` / `grpc_auth` from `archipy.adapters.keycloak.auth`; reads of `request.state.user_info`, + `token_info`, `actor_chain` or `user_roles` instead of `AuthContextManager`. +- On `archipy` 5.16+ dashboards or alerts on `rpc.server.duration` / `rpc.server.request.duration` need + `rpc.server.call.duration` (attributes `rpc.system.name`, `rpc.response.status_code`, `error.type`). - For any other API you are unsure exists in the pinned version, check the live docs (https://syntaxarc.github.io/ArchiPy/) or the installed package (`.venv/lib/python*/site-packages/archipy/`) before flagging it. diff --git a/evals/02-orders-postgres-domain/graders/layering.md b/evals/02-orders-postgres-domain/graders/layering.md index f98d755..68f9746 100644 --- a/evals/02-orders-postgres-domain/graders/layering.md +++ b/evals/02-orders-postgres-domain/graders/layering.md @@ -2,6 +2,6 @@ type: llm focus: trace --- -- The unit of work is a real `*_sqlalchemy_atomic_decorator` (for example `postgres_sqlalchemy_atomic_decorator`) applied in `logics/`, not in services or repositories, and no decorator named plain `atomic` is used. +- The unit of work is a real `*_sqlalchemy_atomic` (for example `postgres_sqlalchemy_atomic`) applied in `logics/`, not in services or repositories, and no decorator named plain `atomic` is used. - The service module only maps request DTOs to the logic and back; it contains no SQL or business rules. - The logic module does not import FastAPI. diff --git a/evals/03-wallet-transfer-logic/graders/atomic-decorator.md b/evals/03-wallet-transfer-logic/graders/atomic-decorator.md index 2a4a354..b63f09b 100644 --- a/evals/03-wallet-transfer-logic/graders/atomic-decorator.md +++ b/evals/03-wallet-transfer-logic/graders/atomic-decorator.md @@ -2,4 +2,4 @@ type: regex target: trace --- -_sqlalchemy_atomic_decorator +_sqlalchemy_atomic diff --git a/evals/03-wallet-transfer-logic/graders/transaction-in-logic.md b/evals/03-wallet-transfer-logic/graders/transaction-in-logic.md index 3150d5f..604d3cb 100644 --- a/evals/03-wallet-transfer-logic/graders/transaction-in-logic.md +++ b/evals/03-wallet-transfer-logic/graders/transaction-in-logic.md @@ -2,6 +2,6 @@ type: llm focus: trace --- -- The transfer is wrapped in a single unit of work via a `*_sqlalchemy_atomic_decorator` on the logic method, so both balance updates commit or roll back together. +- The transfer is wrapped in a single unit of work via a `*_sqlalchemy_atomic` on the logic method, so both balance updates commit or roll back together. - Insufficient balance raises a specific domain error (a subclass of an ArchiPy error), not a bare `Exception`. - The logic calls repositories, not database sessions or adapters directly. diff --git a/evals/06-reviewer-violations/graders/catches-violations.md b/evals/06-reviewer-violations/graders/catches-violations.md index a1bb278..9302e5c 100644 --- a/evals/06-reviewer-violations/graders/catches-violations.md +++ b/evals/06-reviewer-violations/graders/catches-violations.md @@ -5,5 +5,5 @@ focus: trace - The review reports the untracked `adapters/payment_gateway.py` and says domain adapters belong under `repositories/payment/adapters/`, not a top-level `adapters/` package. - The review flags the hardcoded `API_KEY` secret in `adapters/payment_gateway.py`. - The review flags that `httpx` errors (for example from `raise_for_status`) leak raw instead of being mapped to a domain error with `raise ... from e`. -- The review flags `postgres_sqlalchemy_atomic_decorator` and the discount rule in `services/payment/v1/payment_router.py` as belonging in `logics/`. +- The review flags `postgres_sqlalchemy_atomic` and the discount rule in `services/payment/v1/payment_router.py` as belonging in `logics/`. - The adapter, secret, and unit-of-work findings are ranked as must-fix (highest severity), not as optional suggestions. diff --git a/evals/06-reviewer-violations/scaffold.sh b/evals/06-reviewer-violations/scaffold.sh index 43df88f..19dc59f 100755 --- a/evals/06-reviewer-violations/scaffold.sh +++ b/evals/06-reviewer-violations/scaffold.sh @@ -42,7 +42,7 @@ git -c user.name=eval -c user.email=eval@example.com commit -qm "baseline" # Tracked, uncommitted: unit of work and business rule in the service layer. cat > services/payment/v1/payment_router.py <<'PY' -from archipy.helpers.decorators.sqlalchemy_atomic import postgres_sqlalchemy_atomic_decorator +from archipy.adapters.base.sqlalchemy.atomic import postgres_sqlalchemy_atomic from fastapi import APIRouter from logics.payment.payment_logic import PaymentLogic @@ -53,7 +53,7 @@ def create_payment_v1_router(logic: PaymentLogic) -> APIRouter: router = APIRouter(prefix="/v1/payments") @router.post("") - @postgres_sqlalchemy_atomic_decorator + @postgres_sqlalchemy_atomic def charge(amount: int) -> dict[str, str]: if amount > 10_000: amount = int(amount * 0.95) diff --git a/evals/07-reviewer-clean-diff/graders/no-false-positives.md b/evals/07-reviewer-clean-diff/graders/no-false-positives.md index a1096ad..788b5d5 100644 --- a/evals/07-reviewer-clean-diff/graders/no-false-positives.md +++ b/evals/07-reviewer-clean-diff/graders/no-false-positives.md @@ -4,5 +4,5 @@ focus: trace --- - The review does not report any must-fix (highest severity) architecture violation for the wallet logic change. - The review does not flag `WalletLogic` calling `NotificationLogic` as a violation; a logic calling another logic is allowed. -- The review does not flag `postgres_sqlalchemy_atomic_decorator` on `WalletLogic.withdraw` as misplaced. +- The review does not flag `postgres_sqlalchemy_atomic` on `WalletLogic.withdraw` as misplaced. - It may note that the change has no Behave scenario, as long as that is not presented as a layer violation. diff --git a/evals/07-reviewer-clean-diff/scaffold.sh b/evals/07-reviewer-clean-diff/scaffold.sh index 2644bbf..d5f3162 100755 --- a/evals/07-reviewer-clean-diff/scaffold.sh +++ b/evals/07-reviewer-clean-diff/scaffold.sh @@ -92,7 +92,7 @@ class WithdrawOutputDTO(BaseDTO): balance: int PY cat > logics/wallet/wallet_logic.py <<'PY' -from archipy.helpers.decorators.sqlalchemy_atomic import postgres_sqlalchemy_atomic_decorator +from archipy.adapters.base.sqlalchemy.atomic import postgres_sqlalchemy_atomic from logics.notification.notification_logic import NotificationLogic from models.dtos.wallet.domain.v1.wallet_dtos import WithdrawInputDTO, WithdrawOutputDTO @@ -110,7 +110,7 @@ class WalletLogic: self._repository = repository self._notification_logic = notification_logic - @postgres_sqlalchemy_atomic_decorator + @postgres_sqlalchemy_atomic def withdraw(self, input_dto: WithdrawInputDTO) -> WithdrawOutputDTO: """Withdraw credit, notifying when the balance runs low. diff --git a/evals/README.md b/evals/README.md index 28a30a0..c3d1409 100644 --- a/evals/README.md +++ b/evals/README.md @@ -16,7 +16,7 @@ Pilot one case first (`--case 04-otel-question --runs 1`) to check cost. Results |---|---|---| | `01-redis-cache-adapter` | `scaffold-adapter` | adapter under `repositories/user/adapters/`, no top-level `adapters/`, wraps ArchiPy Redis, `raise ... from e` | | `02-orders-postgres-domain` | `scaffold-domain` | logic + versioned service created, UoW only in logics | -| `03-wallet-transfer-logic` | `scaffold-logic` | `*_sqlalchemy_atomic_decorator` on the logic, domain error for insufficient funds | +| `03-wallet-transfer-logic` | `scaffold-logic` | `*_sqlalchemy_atomic` on the logic, domain error for insufficient funds | | `04-otel-question` | `archipy-docs` | answer uses `OtelUtils` and `otel` extras, no removed 4.x APIs | | `05-neg-unrelated-shell` | none | no plugin skill fires on an unrelated shell question | | `06-reviewer-violations` | `archipy-reviewer` | catches untracked top-level adapter, hardcoded secret, leaked `httpx` errors, UoW in service; ranks them must-fix | diff --git a/rules/architecture-for-apps.mdc b/rules/architecture-for-apps.mdc index feb3ce3..501fc0a 100644 --- a/rules/architecture-for-apps.mdc +++ b/rules/architecture-for-apps.mdc @@ -36,7 +36,7 @@ Optional app-local helpers (prefer `archipy.helpers` first): `helpers/{utils,dec services → logics (atomic UoW) → repositories → adapters → ArchiPy ``` -> Plugin shorthand `@atomic` means a real `*_sqlalchemy_atomic_decorator` — there is no decorator named `atomic`. +> Plugin shorthand `@atomic` means a real `*_sqlalchemy_atomic` — there is no decorator named `atomic`. ## Layer Rules @@ -46,7 +46,7 @@ those files are open. This always-on rule keeps only the global map: - **models/** — data only (no I/O, no business rules). - **repositories/** — domain data access; adapters under `repositories/{domain}/adapters/`; no cross-domain repo calls. Domain adapters map driver errors with `raise ... from e`; repository orchestrators consume domain-facing errors. -- **logics/** — business rules + UoW (`*_sqlalchemy_atomic_decorator`); may call other logics; never other domains' +- **logics/** — business rules + UoW (`*_sqlalchemy_atomic`); may call other logics; never other domains' repositories; no FastAPI/gRPC. - **services/** — thin transport; versioned `v{n}/`; no UoW / business rules. - **helpers/** — pure only; prefer ArchiPy; no adapter construction at module level. diff --git a/rules/using-archipy-decorators.mdc b/rules/using-archipy-decorators.mdc index 8dd3c1b..3fa72d2 100644 --- a/rules/using-archipy-decorators.mdc +++ b/rules/using-archipy-decorators.mdc @@ -12,16 +12,15 @@ Helpers stay **pure**: no database calls, no network I/O, no constructing adapte Before writing a custom decorator, prefer ArchiPy under `archipy.helpers.decorators`: -- `ttl_cache_decorator` — caching (`archipy.helpers.decorators.cache`) +- `ttl_cache` — caching (`archipy.helpers.decorators`) - Unit of work (apply on **logics**, not repositories): - - `postgres_sqlalchemy_atomic_decorator` - - `async_postgres_sqlalchemy_atomic_decorator` - - also `sqlite_` / `starrocks_` / generic `sqlalchemy_atomic_decorator` twins + - `postgres_sqlalchemy_atomic` (detects `async def`), imported from `archipy.adapters.base.sqlalchemy.atomic` + - also `mysql_` / `sqlite_` / `starrocks_` / generic `sqlalchemy_atomic` variants - Tracing: `trace_span`, `trace_root`, `async_trace_span`, `async_trace_root`, `trace_class` - Metrics: `measure_duration`, `async_measure_duration`, `count_calls`, `async_count_calls` -- Local timing only: `timing_decorator` -- Resilience: `retry_decorator`, `timeout_decorator` -- Other: `singleton_decorator`, `grpc_rate_limit_decorator` (gRPC only) +- Local timing only: `timing` +- Resilience: `retry`, `timeout` +- Other: `singleton`, `grpc_rate_limit` (gRPC only) ## Custom Decorators @@ -36,5 +35,5 @@ Before writing a custom decorator, prefer ArchiPy under `archipy.helpers.decorat - Hide adapter construction inside decorator modules. - Catch broad `Exception` without re-raising as a domain error with `raise ... from e`. -- Mix sync/async incorrectly — provide separate sync and async wrappers when needed. -- Put `@postgres_sqlalchemy_atomic_decorator` on repositories or services — UoW belongs on logics. +- Write separate sync and async copies of a decorator when one wrapper can detect `inspect.iscoroutinefunction`; ArchiPy's `retry`, `timeout`, `timing`, `ttl_cache` and `*_sqlalchemy_atomic` do. +- Put `@postgres_sqlalchemy_atomic` on repositories or services — UoW belongs on logics. diff --git a/rules/using-archipy-interceptors.mdc b/rules/using-archipy-interceptors.mdc index 848b103..4e6526a 100644 --- a/rules/using-archipy-interceptors.mdc +++ b/rules/using-archipy-interceptors.mdc @@ -19,9 +19,9 @@ Use ArchiPy interceptors under `archipy.helpers.interceptors` (FastAPI / gRPC) b Prefer **AppUtils** auto-registration for stock interceptors/middleware: - FastAPI: `AppUtils.create_fastapi_app` wires middleware/exception handlers and instruments through - `archipy[otel-fastapi]` when `OTEL.IS_ENABLED`. + `archipy[otel,fastapi]` when `OTEL.IS_ENABLED`. - gRPC: `create_grpc_app` / `create_async_grpc_app` append exception, optional OTel traces (contrib), ArchiPy - metrics (`rpc.server.duration` when `OTEL.METRICS_ENABLED`), and gRPC rate-limit interceptors. Do not hand-roll + metrics (`rpc.server.call.duration` when `OTEL.METRICS_ENABLED`), and gRPC rate-limit interceptors. Do not hand-roll those stock hooks; metrics install is independent of traces. - FastAPI rate limiting is not shipped by ArchiPy 5.x; use `fastapi-redis-sdk` when required. diff --git a/rules/using-archipy-logics.mdc b/rules/using-archipy-logics.mdc index e3b0995..328556f 100644 --- a/rules/using-archipy-logics.mdc +++ b/rules/using-archipy-logics.mdc @@ -21,15 +21,15 @@ Live: https://syntaxarc.github.io/ArchiPy/getting-started/concepts/ When using Postgres SQLAlchemy, decorate public methods: ```python -from archipy.helpers.decorators.sqlalchemy_atomic import postgres_sqlalchemy_atomic_decorator +from archipy.adapters.base.sqlalchemy.atomic import postgres_sqlalchemy_atomic class UserRegistrationLogic: - @postgres_sqlalchemy_atomic_decorator + @postgres_sqlalchemy_atomic def register_user(self, input_dto: UserRegistrationInputDTO) -> UserRegistrationOutputDTO: ... ``` -- Async stack: `async_postgres_sqlalchemy_atomic_decorator`. +- Async logics: the same decorator detects `async def`; the `async_*` names are deprecated. - Nested atomic-decorator calls reuse the open session — logics may call other logics. ## Domain Isolation @@ -50,5 +50,5 @@ class UserRegistrationLogic: ## Do Not - Put HTTP status mapping or router code here (that belongs in `services/`). -- Skip `*_sqlalchemy_atomic_decorator` on write/read paths that need a SQLAlchemy session when SQLAlchemy is in use. +- Skip `*_sqlalchemy_atomic` on write/read paths that need a SQLAlchemy session when SQLAlchemy is in use. - Construct Redis/DB clients inside logic classes. diff --git a/rules/using-archipy-repositories.mdc b/rules/using-archipy-repositories.mdc index 2086f05..49f6e67 100644 --- a/rules/using-archipy-repositories.mdc +++ b/rules/using-archipy-repositories.mdc @@ -36,6 +36,6 @@ repositories/{domain}/ ## Do Not -- Put business rules or `@postgres_sqlalchemy_atomic_decorator` here (that belongs in `logics/`). +- Put business rules or `@postgres_sqlalchemy_atomic` here (that belongs in `logics/`). - Create a top-level app `adapters/` package — domain adapters live under repositories. - Leak raw driver exceptions into logics/services. diff --git a/rules/using-archipy-services.mdc b/rules/using-archipy-services.mdc index 5ab91e0..544751a 100644 --- a/rules/using-archipy-services.mdc +++ b/rules/using-archipy-services.mdc @@ -39,8 +39,8 @@ Paths are hierarchical resources: `/api/v{n}//{_uuid}/= 5.16.0; `KeycloakUtils` is deprecated, removed in 6.0.0) - Import from concrete submodules (e.g. `archipy.helpers.utils.jwt_utils`) — package `__init__` does not re-export - `AppUtils` — FastAPI / gRPC app factories (see below) @@ -48,8 +49,8 @@ Prefer ArchiPy factories — do **not** hand-roll bare `FastAPI()` / `grpc.serve | Method | Use | |--------|-----| -| `AppUtils.create_fastapi_app(config?)` | HTTP app; middleware/exception handlers plus OTel instrumentation through `archipy[otel-fastapi]` | -| `AppUtils.create_grpc_app(config)` | Sync gRPC server; exception, optional OTel traces + ArchiPy `rpc.server.duration` metrics, and gRPC rate-limit interceptors | +| `AppUtils.create_fastapi_app(config?)` | HTTP app; middleware/exception handlers plus OTel instrumentation through `archipy[otel,fastapi]` | +| `AppUtils.create_grpc_app(config)` | Sync gRPC server; exception, optional OTel traces + ArchiPy `rpc.server.call.duration` metrics, and gRPC rate-limit interceptors | | `AppUtils.create_async_grpc_app(config)` | Async gRPC (`grpc.aio`); equivalent async interceptor setup | Rules: diff --git a/scripts/check_catalog.py b/scripts/check_catalog.py index a82e558..263e232 100755 --- a/scripts/check_catalog.py +++ b/scripts/check_catalog.py @@ -44,14 +44,15 @@ "`capture_span`", "`capture_transaction`", "`FastAPIRateLimitConfig`", + "`otel-fastapi`", + "`KeycloakUtils`", ) -ARCHIPY_5_REQUIRED_GUIDANCE = ("`OtelUtils`", "`trace_span`", "`otel-fastapi`", "`otel-grpc`") +ARCHIPY_5_REQUIRED_GUIDANCE = ("`OtelUtils`", "`trace_span`", "`otel-grpc`") # Tokens the reviewer agent checks for, paired with the rule that owns them. Both files must mention each token so # the agent checklist cannot silently drift from the rules. REVIEWER_RULE_TOKENS = { "repositories/{domain}/adapters/": "architecture-for-apps.mdc", - "postgres_sqlalchemy_atomic_decorator": "using-archipy-logics.mdc", - "async_postgres_sqlalchemy_atomic_decorator": "using-archipy-logics.mdc", + "postgres_sqlalchemy_atomic": "using-archipy-logics.mdc", "AppUtils.create_fastapi_app": "using-archipy-services.mdc", "create_grpc_app": "using-archipy-services.mdc", "create_async_grpc_app": "using-archipy-services.mdc", diff --git a/skills/archipy-docs/reference.md b/skills/archipy-docs/reference.md index b5ba508..5134718 100644 --- a/skills/archipy-docs/reference.md +++ b/skills/archipy-docs/reference.md @@ -4,7 +4,7 @@ Condensed patterns for **apps that depend on** PyPI `archipy`. Prefer live docs https://syntaxarc.github.io/ArchiPy/ -Verified against `archipy` 5.4.x. Import symbols from their **full submodule paths** — `archipy.helpers.utils` +Verified against `archipy` 5.16.x. Import symbols from their **full submodule paths** — `archipy.helpers.utils` and `archipy.configs` package `__init__` files do not re-export symbols. > **ArchiPy 5.x:** OpenTelemetry replaces the removed Sentry, Elastic APM, and Prometheus integrations. Use @@ -57,7 +57,7 @@ uv add "archipy[grpc]" # gRPC + AppUtils create_*_grpc_app | `kafka` | Kafka producer/consumer adapters | | `scylladb` | ScyllaDB / Cassandra adapter | | `minio` | MinIO / S3-compatible object storage | -| `keycloak` | Keycloak auth adapter + `KeycloakUtils` | +| `keycloak` | Keycloak auth adapter + `fastapi_auth` / `grpc_auth` | | `elasticsearch` | Elasticsearch adapter | | `elasticsearch-async` | Async Elasticsearch adapter | | `fastapi` | FastAPI + `AppUtils.create_fastapi_app` | @@ -67,7 +67,6 @@ uv add "archipy[grpc]" # gRPC + AppUtils create_*_grpc_app | `testcontainers` | Testcontainers for `@needs-*` infra BDD | | `temporalio` | Temporal adapter, worker, runtime | | `otel` | OpenTelemetry SDK + OTLP traces, metrics, and logs | -| `otel-fastapi` | FastAPI OpenTelemetry instrumentation | | `otel-grpc` | gRPC OpenTelemetry instrumentation | | `otel-sqlalchemy` | SQLAlchemy OpenTelemetry instrumentation | | `otel-redis` | Redis OpenTelemetry instrumentation | @@ -114,7 +113,7 @@ Import direction: `configs ← models ← helpers ← repositories / logics / se Call flow: `services → logics (atomic UoW) → repositories → adapters → ArchiPy`. > **Plugin shorthand:** docs sometimes write `@atomic` to mean -> `postgres_sqlalchemy_atomic_decorator` / `async_postgres_sqlalchemy_atomic_decorator` +> `postgres_sqlalchemy_atomic` > (or the sqlite/starrocks/generic twins). There is **no** decorator named `atomic`. Live: https://syntaxarc.github.io/ArchiPy/getting-started/project_structure/ @@ -136,7 +135,7 @@ base for gRPC payloads. Prefer those before inventing page, sort, total or curso 1. `uv init` + `uv add "archipy[redis,fastapi,postgres,sqlalchemy]"` (pick extras you need) 2. `AppConfig` + `set_global` (customize `FASTAPI`) 3. `AppUtils.create_fastapi_app` + domain adapters under `repositories/` -4. Add logics (`*_sqlalchemy_atomic_decorator`) / services / optional `features/` +4. Add logics (`*_sqlalchemy_atomic`) / services / optional `features/` Live: https://syntaxarc.github.io/ArchiPy/getting-started/quickstart/ diff --git a/skills/archipy-docs/reference/adapters.md b/skills/archipy-docs/reference/adapters.md index 996edba..37bbe76 100644 --- a/skills/archipy-docs/reference/adapters.md +++ b/skills/archipy-docs/reference/adapters.md @@ -77,19 +77,23 @@ Atomic decorators resolve the active SQLAlchemy session through `archipy.adapters.base.sqlalchemy.session_manager_registry.SessionManagerRegistry`. Register the app's session manager at bootstrap; BDD hooks call `SessionManagerRegistry.reset()` after each scenario. -| Decorator | Extra / stack | -|---------------------------------------------------------------|---------------------------------| -| `postgres_sqlalchemy_atomic_decorator` | `postgres` + `sqlalchemy` | -| `async_postgres_sqlalchemy_atomic_decorator` | `postgres` + `sqlalchemy-async` | -| `sqlite_sqlalchemy_atomic_decorator` / `async_sqlite_…` | SQLite stacks | -| `starrocks_sqlalchemy_atomic_decorator` / `async_starrocks_…` | StarRocks stacks | -| `sqlalchemy_atomic_decorator` | Generic SQLAlchemy | +| Decorator | Extra / stack | +|---------------------------------------------------------------|----------------------------------| +| `postgres_sqlalchemy_atomic` | `postgres` + `sqlalchemy[-async]` | +| `mysql_sqlalchemy_atomic` | MySQL stacks | +| `sqlite_sqlalchemy_atomic` | SQLite stacks | +| `starrocks_sqlalchemy_atomic` | StarRocks stacks | +| `sqlalchemy_atomic` | Generic SQLAlchemy | -Import from `archipy.helpers.decorators.sqlalchemy_atomic` (lazy-loaded via -`archipy.helpers.decorators` `__getattr__` so SQLAlchemy is not a hard import). +Each detects `async def`, so there are no separate async names (the `async_*` and `*_decorator` names are deprecated, +removed in archipy 6.0.0). Import from `archipy.adapters.base.sqlalchemy.atomic` (archipy >= 5.16.0; the old +`archipy.helpers.decorators` path still works but warns). + +For several databases of the same type, pass `registry=` to the decorator or `sqlalchemy_atomic`; session managers are +keyed by configuration (archipy >= 5.16.0). ## Logics (unit of work) - Domain DTO in → domain DTO out; no FastAPI/gRPC imports. -- Public methods: decorate with the matching `*_sqlalchemy_atomic_decorator` when using SQLAlchemy. +- Public methods: decorate with the matching `*_sqlalchemy_atomic` when using SQLAlchemy. - May call other domain logics (nested atomic reuses the open session); **never** another domain's repository. diff --git a/skills/archipy-docs/reference/helpers.md b/skills/archipy-docs/reference/helpers.md index 4d9df6a..2dc572f 100644 --- a/skills/archipy-docs/reference/helpers.md +++ b/skills/archipy-docs/reference/helpers.md @@ -19,7 +19,6 @@ Prefer ArchiPy utils. Import from the **concrete submodule** (package `__init__` | `FileUtils` | `archipy.helpers.utils.file_utils` | file helpers | | `ErrorUtils` | `archipy.helpers.utils.error_utils` | error helpers | | `TOTPUtils` | `archipy.helpers.utils.totp_utils` | TOTP | -| `KeycloakUtils` | `archipy.helpers.utils.keycloak_utils` | Keycloak helpers | ### Hand-rolled code → ArchiPy util @@ -43,12 +42,12 @@ Prefer ArchiPy under `archipy.helpers.decorators`: | Area | Symbols | |------------------------------|---------------------------------------------------------------------------------------------------------------------------| -| Cache | `ttl_cache_decorator` (`archipy.helpers.decorators.cache`) | -| Transactions (on **logics**) | `postgres_sqlalchemy_atomic_decorator`, `async_postgres_sqlalchemy_atomic_decorator`, plus sqlite/starrocks/generic twins | -| Observability | `trace_span`, `trace_root`, `async_trace_span`, `async_trace_root`, `trace_class`; `timing_decorator` | +| Cache | `ttl_cache` (`archipy.helpers.decorators.cache`) | +| Transactions (on **logics**) | `postgres_sqlalchemy_atomic` (async detected), plus mysql/sqlite/starrocks/generic variants | +| Observability | `trace_span`, `trace_root`, `async_trace_span`, `async_trace_root`, `trace_class`; `timing` | | Metrics | `measure_duration`, `async_measure_duration`, `count_calls`, `async_count_calls` | -| Resilience | `retry_decorator`, `timeout_decorator` | -| Other | `singleton_decorator`, `grpc_rate_limit_decorator` (gRPC only) | +| Resilience | `retry`, `timeout` | +| Other | `singleton`, `grpc_rate_limit` (gRPC only) | No concrete adapter imports at module level in custom decorators. @@ -59,13 +58,13 @@ auto-registration for stock hooks; wire custom via DI / `customized_interceptors ### Instrumentation and rate limiting -- FastAPI: `AppUtils.create_fastapi_app` auto-instruments through `archipy[otel-fastapi]` when `OTEL.IS_ENABLED`. +- FastAPI: `AppUtils.create_fastapi_app` auto-instruments through `archipy[otel,fastapi]` when `OTEL.IS_ENABLED`. - gRPC traces: AppUtils factories insert the contrib OTel server interceptor through `archipy[otel-grpc]` when `OTEL.TRACES_ENABLED`. - gRPC metrics: AppUtils also prepends ArchiPy `GrpcServerOtelMetricsInterceptor` / - `AsyncGrpcServerOtelMetricsInterceptor` (`rpc.server.duration`) when `OTEL.METRICS_ENABLED` — independent of + `AsyncGrpcServerOtelMetricsInterceptor` (`rpc.server.call.duration`) when `OTEL.METRICS_ENABLED` — independent of traces. -- gRPC rate-limit: `GRPC_RATE_LIMIT.IS_ENABLED` + `grpc_rate_limit_decorator` / stock interceptors. +- gRPC rate-limit: `GRPC_RATE_LIMIT.IS_ENABLED` + `grpc_rate_limit` / stock interceptors. - FastAPI rate-limit handlers were removed in 5.0; use `fastapi-redis-sdk`. Live helpers overview: https://syntaxarc.github.io/ArchiPy/tutorials/helpers/ diff --git a/skills/archipy-docs/reference/observability.md b/skills/archipy-docs/reference/observability.md index 477e486..d843f97 100644 --- a/skills/archipy-docs/reference/observability.md +++ b/skills/archipy-docs/reference/observability.md @@ -8,11 +8,11 @@ Combine library pieces rather than inventing a parallel stack: | Concern | ArchiPy pieces | Extra | |-----------------|---------------------------------------------------------------------------------------------------------|--------------------------------| -| Traces | `OtelUtils`, `trace_root` / `trace_span` (+ async twins), AppUtils auto-instrumentation | `otel` + `otel-fastapi`/`otel-grpc` | -| Metrics | `measure_duration` / `count_calls` (+ async twins), AppUtils gRPC `rpc.server.duration`, `METRICS_EXPORTER` (`otlp`\|`pull`\|`pushgateway`) | `otel` (+ `otel-grpc` for RPC) | +| Traces | `OtelUtils`, `trace_root` / `trace_span` (+ async twins), AppUtils auto-instrumentation | `otel` + `fastapi`/`otel-grpc` | +| Metrics | `measure_duration` / `count_calls` (+ async twins), AppUtils gRPC `rpc.server.call.duration`, `METRICS_EXPORTER` (`otlp`\|`pull`\|`pushgateway`) | `otel` (+ `otel-grpc` for RPC) | | Logs | `LOGS_EXPORTER` (`console`\|`otlp`); default console splits INFO/DEBUG → stdout, WARNING+ → stderr | `otel` | | Errors | `BaseUtils.capture_exception` records on the current span | `otel` | -| Timing only | `timing_decorator` | — | +| Timing only | `timing` | — | Configure through nested settings, not SDK autoconfiguration: diff --git a/skills/archipy-docs/reference/services.md b/skills/archipy-docs/reference/services.md index 60917a9..8d7127a 100644 --- a/skills/archipy-docs/reference/services.md +++ b/skills/archipy-docs/reference/services.md @@ -16,7 +16,7 @@ server = AppUtils.create_grpc_app(BaseConfig.global_config()) # sync — c Do not hand-roll bare `FastAPI()` / `grpc.server()` when extras are installed. Prefer config flags for stock middleware/interceptors (`OTEL.IS_ENABLED` / `OTEL.TRACES_ENABLED` / `OTEL.METRICS_ENABLED`, `FASTAPI.GZIP_MIDDLEWARE_IS_ENABLED`, `GRPC_RATE_LIMIT.IS_ENABLED`). gRPC AppUtils installs traces and -`rpc.server.duration` metrics independently. Custom gRPC interceptors: `customized_interceptors=` on the gRPC +`rpc.server.call.duration` metrics independently. Custom gRPC interceptors: `customized_interceptors=` on the gRPC factories. ## REST resource paths diff --git a/skills/docs-observability/SKILL.md b/skills/docs-observability/SKILL.md index e48ed2f..c7fe096 100644 --- a/skills/docs-observability/SKILL.md +++ b/skills/docs-observability/SKILL.md @@ -14,10 +14,10 @@ Cover: - Tracing: `trace_root` / `trace_span` (+ async twins) - Metrics: `measure_duration` / `count_calls` (+ async twins); `METRICS_EXPORTER` (`otlp`\|`pull`\|`pushgateway`) - Logs: `LOGS_EXPORTER` (`console`\|`otlp`); default console stream split -- AppUtils FastAPI instrumentation through `archipy[otel-fastapi]` -- AppUtils gRPC: contrib traces + ArchiPy `rpc.server.duration` metrics through `archipy[otel-grpc]` +- AppUtils FastAPI instrumentation through `archipy[otel,fastapi]` +- AppUtils gRPC: contrib traces + ArchiPy `rpc.server.call.duration` metrics through `archipy[otel-grpc]` (metrics independent of traces) -- Timing: `timing_decorator` +- Timing: `timing` Live docs: diff --git a/skills/scaffold-app/SKILL.md b/skills/scaffold-app/SKILL.md index b737700..f365355 100644 --- a/skills/scaffold-app/SKILL.md +++ b/skills/scaffold-app/SKILL.md @@ -80,7 +80,7 @@ features/ # optional — /scaffold-bdd - Do not copy ArchiPy library maintainer tooling (library BDD internals). - Never hardcode host/port; never hand-roll bare `FastAPI()` when AppUtils is in use. - Do not invent a top-level app `adapters/` package — domain adapters live under `repositories//adapters/`. -- There is no decorator named `atomic` — UoW means a real `*_sqlalchemy_atomic_decorator` on logics. +- There is no decorator named `atomic` — UoW means a real `*_sqlalchemy_atomic` on logics. ## Verify diff --git a/skills/scaffold-decorator/SKILL.md b/skills/scaffold-decorator/SKILL.md index c5273d5..7b16f31 100644 --- a/skills/scaffold-decorator/SKILL.md +++ b/skills/scaffold-decorator/SKILL.md @@ -29,13 +29,12 @@ Read these plugin rules in full before generating files (paths relative to this Examples: -- `from archipy.helpers.decorators.cache import ttl_cache_decorator` -- `from archipy.helpers.decorators.sqlalchemy_atomic import postgres_sqlalchemy_atomic_decorator` -- `from archipy.helpers.decorators.sqlalchemy_atomic import async_postgres_sqlalchemy_atomic_decorator` +- `from archipy.helpers.decorators import ttl_cache` +- `from archipy.adapters.base.sqlalchemy.atomic import postgres_sqlalchemy_atomic` (detects `async def`) - `trace_span` / `trace_root` (+ async twins) from `archipy.helpers.decorators.tracing` - `measure_duration` / `count_calls` (+ async twins) from `archipy.helpers.decorators.metrics` -- `timeout_decorator`, `retry_decorator`, `singleton_decorator`, `timing_decorator`, and - `grpc_rate_limit_decorator` under `archipy.helpers.decorators` +- `timeout`, `retry`, `singleton`, `timing`, and + `grpc_rate_limit` under `archipy.helpers.decorators` Show correct usage on a sample function; do not reimplement. UoW decorators belong on **logics**, not services/repositories. @@ -96,12 +95,11 @@ def timed(func: Callable[P, R]) -> Callable[P, R]: - Preserve types where practical (`ParamSpec` / `TypeVar`) - Google-style docstring with Args/Returns and a usage example - **No** concrete adapter imports at module level -- Separate sync/async wrappers if both needed -- Sync wrappers must reject coroutine functions (`inspect.iscoroutinefunction`) — use async twins instead +- One decorator detects `async def` with `inspect.iscoroutinefunction` and returns a sync or async wrapper ## Do not -- Sync decorators must reject coroutine functions — use async twins instead. +- Wrap an `async def` with a sync wrapper (it would return an un-awaited coroutine). ## Verify diff --git a/skills/scaffold-domain/SKILL.md b/skills/scaffold-domain/SKILL.md index 2c76368..1c8edfa 100644 --- a/skills/scaffold-domain/SKILL.md +++ b/skills/scaffold-domain/SKILL.md @@ -54,7 +54,7 @@ Install extras as needed: `uv add "archipy[]"`. - [ ] Domain + repository DTOs with ArchiPy naming (`*InputDTO`, `*CommandDTO`, …); repository methods with 2+ params take one `*CommandDTO` / `*QueryDTO` - [ ] Domain error subclassing ArchiPy `BaseError` hierarchy - [ ] `repositories//adapters/` + repository orchestrator -- [ ] One logic with `@postgres_sqlalchemy_atomic_decorator` when Postgres SQLAlchemy is in play +- [ ] One logic with `@postgres_sqlalchemy_atomic` when Postgres SQLAlchemy is in play - [ ] One service v1 (FastAPI router or gRPC servicer) - [ ] DI notes in `configs/containers.py`: ports → adapters → repository → logic → service diff --git a/skills/scaffold-logic/SKILL.md b/skills/scaffold-logic/SKILL.md index 6bab749..956d691 100644 --- a/skills/scaffold-logic/SKILL.md +++ b/skills/scaffold-logic/SKILL.md @@ -49,11 +49,11 @@ Stub shape: - Google-style class/method docstrings; double quotes; `X | Y` typing. - Constructor injects the domain repository (or port) — do not construct adapters. - Public method: domain `*InputDTO` in → domain `*OutputDTO` out. -- Decorate with `postgres_sqlalchemy_atomic_decorator` or `async_postgres_sqlalchemy_atomic_decorator` +- Decorate with `postgres_sqlalchemy_atomic` (it detects `async def` itself, so one name serves sync and async logics) **when Postgres SQLAlchemy is in play**. Otherwise omit the UoW decorator. ```python -from archipy.helpers.decorators.sqlalchemy_atomic import postgres_sqlalchemy_atomic_decorator +from archipy.adapters.base.sqlalchemy.atomic import postgres_sqlalchemy_atomic class UserRegistrationLogic: @@ -62,7 +62,7 @@ class UserRegistrationLogic: def __init__(self, user_repository: UserRepository) -> None: self._user_repository = user_repository - @postgres_sqlalchemy_atomic_decorator + @postgres_sqlalchemy_atomic def register_user(self, input_dto: UserRegistrationInputDTO) -> UserRegistrationOutputDTO: """Validate and create a user. diff --git a/skills/scaffold-observability/SKILL.md b/skills/scaffold-observability/SKILL.md index 0a5dac9..d30c2c6 100644 --- a/skills/scaffold-observability/SKILL.md +++ b/skills/scaffold-observability/SKILL.md @@ -28,7 +28,7 @@ Read these plugin rules in full before generating files (paths relative to this | Stack | Extra | |-------|-------| | Core OTLP traces, metrics, logs | `otel` | -| FastAPI | `otel-fastapi` | +| FastAPI | `otel` + `fastapi` (no separate extra) | | gRPC | `otel-grpc` | | SQLAlchemy | `otel-sqlalchemy` | | Redis | `otel-redis` | @@ -40,7 +40,7 @@ Read these plugin rules in full before generating files (paths relative to this Combine required extras, for example: ```bash -uv add "archipy[otel-fastapi,otel-sqlalchemy,otel-redis]" +uv add "archipy[otel,fastapi,otel-sqlalchemy,otel-redis]" ``` Do not use removed ArchiPy 4.x extras: `prometheus`, `sentry`, or `elastic-apm`. @@ -98,18 +98,21 @@ Kafka clients, ScyllaDB sessions, and logs created during bootstrap. ## Instrument application code -- FastAPI: `AppUtils.create_fastapi_app(config)` with `archipy[otel-fastapi]`. +- FastAPI: `AppUtils.create_fastapi_app(config)` with `archipy[otel,fastapi]`. - gRPC server: `create_grpc_app` / `create_async_grpc_app` with `archipy[otel-grpc]`. - Traces: contrib server interceptor when `OTEL.TRACES_ENABLED`. - Metrics: ArchiPy `GrpcServerOtelMetricsInterceptor` / - `AsyncGrpcServerOtelMetricsInterceptor` records `rpc.server.duration` when + `AsyncGrpcServerOtelMetricsInterceptor` records `rpc.server.call.duration` when `OTEL.METRICS_ENABLED` (works without traces). +- Tuning (archipy >= 5.16.0): `OTEL.TRACES_SAMPLER`, `PROPAGATORS` (`b3`, `b3multi`; B3 ships in `archipy[otel]`), + `OTLP_COMPRESSION` (`none` by default), `SPAN_BATCH_*`, `RESOURCE_DETECTORS`; `USE_STANDARD_ENV` makes the standard + `OTEL_*` variables fill unset settings. - gRPC clients: `OtelUtils.grpc_client_interceptors()` / `async_grpc_client_interceptors()`. - Traces: `trace_root`, `trace_span`, `async_trace_root`, `async_trace_span`, `trace_class`. - Metrics: `measure_duration`, `async_measure_duration`, `count_calls`, `async_count_calls`. - Exceptions: `BaseUtils.capture_exception` records on the current span. -Import decorators from `archipy.helpers.decorators`. Sync decorators reject coroutine functions; use their async twins. +Import decorators from `archipy.helpers.decorators`. `measure_duration`, `count_calls`, `trace_span` and `trace_root` detect `async def`; the `async_*` twins remain. Only capture non-sensitive argument names in trace attributes. ## ArchiPy 4.x migration