runtime.metrics
Process-local runtime metrics for the exp microservice.
The exp service remains stateless across deployments, but it still benefits from ephemeral in-process diagnostics that help operators understand current process health. This module tracks request counts and successful configuration responses for the lifetime of the current worker only.
ProcessRuntimeSnapshot Objects
@dataclass(frozen=True, slots=True)
class ProcessRuntimeSnapshot()
Immutable runtime identity for the current process instance.
RequestMetricsSnapshot Objects
@dataclass(frozen=True, slots=True)
class RequestMetricsSnapshot()
Immutable snapshot of observed HTTP requests for the current process.
ServedConfigMetricsSnapshot Objects
@dataclass(frozen=True, slots=True)
class ServedConfigMetricsSnapshot()
Immutable snapshot of successful configuration response counters.
reset_metrics
def reset_metrics() -> None
Reset all process-local metrics.
This helper exists primarily for tests so each test can assert against a clean metrics snapshot without cross-test bleed.
record_request
def record_request(path: str) -> None
Record one observed HTTP request path for the current process.
record_config_delivery
def record_config_delivery(endpoint_name: str, target: str,
config_names: Sequence[str], *,
caller_label: str) -> None
Record one successful configuration-serving response.
Parameters
endpoint_name:
Logical endpoint category such as build-time, run-time, or
config.
target:
Resolved consumer target that received the response.
config_names:
Configuration keys included in the response payload.
caller_label:
Stable label representing who received the response, for example a
caller principal ID in Azure or local:<target> in local mode.
get_process_runtime_snapshot
def get_process_runtime_snapshot() -> ProcessRuntimeSnapshot
Return the current process runtime identity and uptime.
get_request_metrics_snapshot
def get_request_metrics_snapshot() -> RequestMetricsSnapshot
Return a detached snapshot of observed HTTP requests.
get_served_config_metrics_snapshot
def get_served_config_metrics_snapshot() -> ServedConfigMetricsSnapshot
Return a detached snapshot of successful configuration-serving counters.