title: grpc connection time metric in the middleware
body: <p>This is my previous question <a href="https://stackoverflow.com/questions/70240557/grpc-middlewareinterceptors-for-metric">grpc middleware(interceptors) for metric</a></p>
  <p>I want to use middleware. That's what I have now.</p>
  <pre><code>func RequestTimeStream(mtr *metrics.Metrics) grpc.StreamServerInterceptor {
      return grpc.StreamServerInterceptor(func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo,
          handler grpc.StreamHandler) error {
          beginTime := time.Now()
          label, err := getLabel(info.FullMethod)
          if err != nil {
              return errors.Errorf(&quot;Unknown method name: %s&quot;, info.FullMethod)
          }
          defer mtr.RequestTime.With(metrics.MakeLabels(label)).Observe(time.Since(beginTime).Seconds())
          if err := handler(srv, stream); err != nil {
              return err
          }
          return nil
      })
  }
  </code></pre>
  <p>Creating grpc server</p>
  <pre><code>    streamInterceptors := grpc_middleware.ChainStreamServer(
          middleware.RecoveryStream(logger, metrics.InternalGRPCPanicErrors),
          identifyMdw.IdentifyStream,
          middleware.AuthenticateStream(logger, metrics, authService),
          middleware.LimitStream(logger, metrics, limiters),
          middleware.RequestTimeStream(metrics),
      )
  
      opts := []grpc.ServerOption{grpc.UnaryInterceptor(unaryInterceptors), grpc.StreamInterceptor(streamInterceptors)}
  
      grpcServer, err := ggrpc.NewServer(cfg.ServerConfig, opts...)
  </code></pre>
  <p>My code is not working properly. The metrics are too small ~30,000 nanoseconds.</p>