1. 30 Jun, 2020 1 commit
    • Oswaldo Ferreira's avatar
      Add instrumentation to Gitaly streamed responses · dfa80312
      Oswaldo Ferreira authored
      This is a stab into fixing the Gitaly timing in logs (gitaly_duration_s)
      for streamed responses using the same GitalyClient.call method.
      
      The problem of having a GitalyClient.call for non-streamed responses
      and GitalyClient.streaming_call (with a block) for streamed responses
      is that we'll need to rely mostly on documentation in order to
      get the timings right for new RPCs.
      
      In order to solve that, here we look further into the Gitaly response.
      If it's an Enumerator (that's what the Ruby implementation of gRPC
      streams return from the server https://grpc.io/docs/languages/ruby/basics/),
      we wrap that Enumerator into a custom enumerator, which instruments
      that stream consumption.
      
      Another advantage of that over wrapping the whole stream consumption
      into a block is that we won't add too much of Ruby CPU time at it,
      just the response.next call is measured, which is the point of
      contact with Gitaly.
      dfa80312
  2. 29 Jun, 2020 39 commits