proxystore.store.metrics¶
Utilities for recording Store operation metrics.
See the Performance Guide to learn more about
interacting with metrics recorded for
Store
operations.
KeyT
module-attribute
¶
KeyT = Union[ConnectorKeyT, Sequence[ConnectorKeyT]]
Key types supported by StoreMetrics
.
ProxyT
module-attribute
¶
Proxy types supported by StoreMetrics
.
When a ProxyT
is passed, the keys are extracted from the proxies.
TimeStats
dataclass
¶
TimeStats(
count: int = 0,
avg_time_ms: float = 0,
min_time_ms: float = math.inf,
max_time_ms: float = 0,
last_time_ms: float = 0,
last_timestamp: float = 0,
)
Tracks time statistics of a reoccuring event.
Attributes:
-
count
(int
) –Number of times this event as occurred.
-
avg_time_ms
(float
) –Average time in milliseconds of the event.
-
min_time_ms
(float
) –Minimum time in milliseconds of all event occurrences.
-
max_time_ms
(float
) –Maximum time in milliseconds of all event occurrences.
-
last_time_ms
(float
) –Time in milliseconds of the most recent event occurrence.
-
last_timestamp
(float
) –The UNIX timestamp (seconds) of when the last event time was recorded.
Metrics
dataclass
¶
Metrics(
attributes: dict[str, Any] = dict(),
counters: dict[str, int] = dict(),
times: dict[str, TimeStats] = dict(),
)
Records metrics and attributes for events.
Attributes:
StoreMetrics
¶
Record and query metrics on Store
operations.
Source code in proxystore/store/metrics.py
add_attribute
¶
add_counter
¶
Add to a counter.
Parameters:
-
name
(str
) –Name of counter.
-
key
(KeyT
) –Key associated with the counter.
-
value
(int
) –Amount to increment counter by.
Source code in proxystore/store/metrics.py
add_time
¶
Record a new time for an event.
Parameters:
-
name
(str
) –Event or operation the time is for.
-
key
(KeyT
) –Key associated with the event.
-
time_ms
(float
) –The time in milliseconds of the event.
Source code in proxystore/store/metrics.py
aggregate_times
¶
Aggregate time statistics over all keys.
Returns:
-
dict[str, TimeStats]
–Dictionary mapping event names to the time statistics aggregated for that event.
Source code in proxystore/store/metrics.py
get_metrics
¶
Get the metrics associated with a key.
Parameters:
-
key_or_proxy
(KeyT | ProxyT
) –Key to get associated metrics. If a proxy or sequence of proxies, the key(s) will be extracted.
Returns:
-
Metrics | None
–Metrics associated with the key or
None
if the key does not exist.