You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/25 12:11:59 UTC

[GitHub] [arrow] lidavidm commented on issue #12974: [Python][flight] How to log the GeneratorStream duration

lidavidm commented on issue #12974:
URL: https://github.com/apache/arrow/issues/12974#issuecomment-1108490825

   Do the timing in the generator itself, or use middleware, something like
   
   ```python
   class TimingServerMiddleware(flight.ServerMiddleware):
       def __init__(self, start):
           self.start = start
           
       def call_completed(self, exception):
           print("Duration:", time.monotonic() - self.start)
   
   class TimingServerMiddlewareFactory(flight.ServerMiddlewareFactory):
       def start_call(self, info, headers):
           return TimingServerMiddleware(time.monotonic())
   
   server = Server(..., middlware={"timing": TimingServerMiddlewareFactory()})
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org