File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
python/monarch/_src/actor Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 5151 description = "Latency of endpoint call_one operations in microseconds" ,
5252)
5353
54+ # Histogram for measuring endpoint stream latency per yield
55+ endpoint_stream_latency_histogram : Histogram = METER .create_histogram (
56+ name = "endpoint_stream_latency.us" ,
57+ description = "Latency of endpoint stream operations per yield in microseconds" ,
58+ )
59+
5460T = TypeVar ("T" )
5561
5662
@@ -247,9 +253,17 @@ def stream(
247253 extent : Extent = self ._send (args , kwargs , port = p )
248254 r : "PortReceiver[R]" = r_port
249255
256+ method_name : str = self ._get_method_name ()
257+
250258 def _stream () -> Generator [Future [R ], None , None ]:
251259 for _ in range (extent .nelements ):
252- yield r .recv ()
260+ measured_coro = _measure_latency (
261+ r ._recv (),
262+ endpoint_stream_latency_histogram ,
263+ method_name ,
264+ extent .nelements ,
265+ )
266+ yield Future (coro = measured_coro )
253267
254268 return _stream ()
255269
You can’t perform that action at this time.
0 commit comments