monarch_hyperactor/
metrics.rs

1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9//! Metrics for Python actor endpoints.
10//!
11//! This module contains metrics definitions for tracking Python actor endpoint performance.
12
13use hyperactor_telemetry::declare_static_counter;
14use hyperactor_telemetry::declare_static_histogram;
15
16// ENDPOINT METRICS
17// Tracks the size of endpoint messages in bytes
18declare_static_histogram!(ENDPOINT_MESSAGE_SIZE_HISTOGRAM, "endpoint_message_size");
19// Tracks latency of endpoint calls in microseconds
20declare_static_histogram!(
21    ENDPOINT_ACTOR_LATENCY_US_HISTOGRAM,
22    "endpoint_actor_latency_us_histogram"
23);
24// Tracks the total number of endpoint calls
25declare_static_counter!(ENDPOINT_ACTOR_COUNT, "endpoint_actor_count");
26// Tracks errors that occur during endpoint execution
27declare_static_counter!(ENDPOINT_ACTOR_ERROR, "endpoint_actor_error");
28// Tracks panics that occur during endpoint execution
29declare_static_counter!(ENDPOINT_ACTOR_PANIC, "endpoint_actor_panic");
30// Tracks latency of endpoint calls from the caller's perspective in microseconds
31declare_static_histogram!(
32    ENDPOINT_CALL_LATENCY_US_HISTOGRAM,
33    "endpoint_call_latency_us_histogram"
34);
35// Tracks latency of endpoint call_one operations in microseconds
36declare_static_histogram!(
37    ENDPOINT_CALL_ONE_LATENCY_US_HISTOGRAM,
38    "endpoint_call_one_latency_us_histogram"
39);
40// Tracks latency of endpoint choose operations in microseconds
41declare_static_histogram!(
42    ENDPOINT_CHOOSE_LATENCY_US_HISTOGRAM,
43    "endpoint_choose_latency_us_histogram"
44);
45// Tracks errors that occur during endpoint calls from the caller's perspective
46declare_static_counter!(ENDPOINT_CALL_ERROR, "endpoint_call_error");
47// Tracks errors that occur during endpoint call_one operations
48declare_static_counter!(ENDPOINT_CALL_ONE_ERROR, "endpoint_call_one_error");
49// Tracks errors that occur during endpoint choose operations
50declare_static_counter!(ENDPOINT_CHOOSE_ERROR, "endpoint_choose_error");
51// Tracks throughput of endpoint call operations
52declare_static_counter!(ENDPOINT_CALL_THROUGHPUT, "endpoint_call_throughput");
53// Tracks throughput of endpoint call_one operations
54declare_static_counter!(ENDPOINT_CALL_ONE_THROUGHPUT, "endpoint_call_one_throughput");
55// Tracks throughput of endpoint choose operations
56declare_static_counter!(ENDPOINT_CHOOSE_THROUGHPUT, "endpoint_choose_throughput");
57// Tracks latency of endpoint stream operations in microseconds
58declare_static_histogram!(
59    ENDPOINT_STREAM_LATENCY_US_HISTOGRAM,
60    "endpoint_stream_latency_us_histogram"
61);
62// Tracks errors that occur during endpoint stream operations
63declare_static_counter!(ENDPOINT_STREAM_ERROR, "endpoint_stream_error");
64// Tracks throughput of endpoint stream operations
65declare_static_counter!(ENDPOINT_STREAM_THROUGHPUT, "endpoint_stream_throughput");
66// Tracks throughput of endpoint broadcast operations
67declare_static_counter!(
68    ENDPOINT_BROADCAST_THROUGHPUT,
69    "endpoint_broadcast_throughput"
70);
71// Tracks errors that occur during endpoint broadcast operations
72declare_static_counter!(ENDPOINT_BROADCAST_ERROR, "endpoint_broadcast_error");