Files
freemo ec0b7631d0
CI / lint (push) Successful in 12s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 23s
CI / typecheck (push) Successful in 36s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 46s
CI / unit_tests (push) Successful in 3m3s
CI / integration_tests (push) Successful in 3m31s
CI / docker (push) Successful in 40s
CI / coverage (push) Successful in 5m34s
CI / benchmark-publish (push) Successful in 19m15s
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 13s
CI / build (pull_request) Successful in 14s
CI / quality (pull_request) Successful in 17s
CI / security (pull_request) Successful in 34s
CI / typecheck (pull_request) Has been cancelled
CI / unit_tests (pull_request) Has been cancelled
CI / coverage (pull_request) Has been cancelled
CI / benchmark-regression (pull_request) Has been cancelled
CI / integration_tests (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
refactor(a2a): rename ACP module and symbols to A2A standard
Renamed src/cleveragents/acp/ to src/cleveragents/a2a/ and all 13
Acp* classes to A2a* per ADR-047 (A2A Standard Adoption). Updated
all imports, structlog event names (acp.* → a2a.*), field names
(acp_version → a2a_version), and test references across the entire
codebase. This is a cosmetic rename only — no behavioral changes.

ISSUES CLOSED: #688
2026-03-12 14:38:57 +00:00

88 lines
2.6 KiB
Python

"""ASV benchmarks for server client stubs and connection config.
Measures the performance of:
- ServerConnectionConfig construction and validation
- StubServerClient/StubRemoteExecutionClient/StubAuthClient instantiation
- Config key registry lookups for server.* keys
"""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
# Ensure the local *source* tree is importable even when ASV has an
# older build of the package installed.
_SRC = str(Path(__file__).resolve().parents[1] / "src")
if _SRC not in sys.path:
sys.path.insert(0, _SRC)
# Force-reload so ASV picks up the source tree version.
import cleveragents # noqa: E402
importlib.reload(cleveragents)
from cleveragents.a2a.clients import ( # noqa: E402
StubAuthClient,
StubRemoteExecutionClient,
StubServerClient,
)
from cleveragents.a2a.server_config import ServerConnectionConfig # noqa: E402
from cleveragents.application.services.config_service import _REGISTRY # noqa: E402
# ---------------------------------------------------------------------------
# Config resolution benchmarks
# ---------------------------------------------------------------------------
class ServerConfigResolutionSuite:
"""Benchmark ServerConnectionConfig construction overhead."""
timeout = 60
def time_create_config_minimal(self) -> None:
ServerConnectionConfig(server_url="https://agents.example.com")
def time_create_config_full(self) -> None:
ServerConnectionConfig(
server_url="https://agents.example.com",
namespace="my-team",
auth_token_ref="CLEVERAGENTS_SERVER_TOKEN",
tls_verify=False,
)
def time_registry_lookup_server_url(self) -> None:
_ = _REGISTRY["server.url"]
def time_registry_lookup_server_tls(self) -> None:
_ = _REGISTRY["server.tls-verify"]
def time_registry_lookup_server_namespace(self) -> None:
_ = _REGISTRY["server.namespace"]
# ---------------------------------------------------------------------------
# Stub client benchmarks
# ---------------------------------------------------------------------------
class StubClientInstantiationSuite:
"""Benchmark stub client instantiation overhead."""
timeout = 60
def time_instantiate_stub_server_client(self) -> None:
StubServerClient()
def time_instantiate_stub_execution_client(self) -> None:
StubRemoteExecutionClient()
def time_instantiate_stub_auth_client(self) -> None:
StubAuthClient()
def time_instantiate_all_stubs(self) -> None:
StubServerClient()
StubRemoteExecutionClient()
StubAuthClient()