def stats(reset = false)
      stats = {}
      if @agent
        offlines = @offline_stats.all
        offlines.merge!("duration" => @offline_stats.avg_duration) if offlines
        if @pending_requests.size > 0
          pending = {}
          pending["pushes"] = @pending_requests.kind(:send_push).size
          requests = @pending_requests.kind(:send_request)
          if (pending["requests"] = requests.size) > 0
            pending["oldest age"] = PendingRequests.oldest_age(requests)
          end
        end
        stats = {
          "non-deliveries"   => @non_delivery_stats.all,
          "offlines"         => offlines,
          "pings"            => @ping_stats.all,
          "request kinds"    => @request_kind_stats.all,
          "requests"         => @request_stats.all,
          "requests pending" => pending,
          "result errors"    => @result_error_stats.all,
          "results"          => @result_stats.all,
          "retries"          => @retry_stats.all,
          "send failures"    => @send_failure_stats.all
        }
        reset_stats if reset
      end
      stats
    end
def stats(reset = false)
      stats = {}
      if @agent
        offlines = @offline_stats.all
        offlines.merge!("duration" => @offline_stats.avg_duration) if offlines
        if @pending_requests.size > 0
          pending = {}
          pending["pushes"] = @pending_requests.kind(:send_push).size
          requests = @pending_requests.kind(:send_request)
          if (pending["requests"] = requests.size) > 0
            pending["oldest age"] = PendingRequests.oldest_age(requests)
          end
        end
        stats = {
          "non-deliveries"   => @non_delivery_stats.all,
          "offlines"         => offlines,
          "pings"            => @ping_stats.all,
          "request kinds"    => @request_kind_stats.all,
          "requests"         => @request_stats.all,
          "requests pending" => pending,
          "result errors"    => @result_error_stats.all,
          "results"          => @result_stats.all,
          "retries"          => @retry_stats.all,
          "send failures"    => @send_failure_stats.all
        }
        reset_stats if reset
      end
      stats
    end
Get sender statistics

 === Parameters
 reset(Boolean):: Whether to reset the statistics after getting the current ones

 === Return
 stats(Hash):: Current statistics:
   "non-deliveries"(Hash|nil):: Non-delivery activity stats with keys "total", "percent", "last",
     and 'rate' with percentage breakdown per reason, or nil if none
   "offlines"(Hash|nil):: Offline activity stats with keys "total", "last", and "duration",
     or nil if none
   "pings"(Hash|nil):: Request activity stats with keys "total", "percent", "last", and "rate"
     with percentage breakdown for "success" vs. "timeout", or nil if none
   "request kinds"(Hash|nil):: Request kind activity stats with keys "total", "percent", and "last"
     with percentage breakdown per kind, or nil if none
   "requests"(Hash|nil):: Request activity stats with keys "total", "percent", "last", and "rate"
     with percentage breakdown per request type, or nil if none
   "requests pending"(Hash|nil):: Number of requests waiting for response and age of oldest,
     or nil if none
   "result errors"(Hash|nil):: Error result activity stats with keys "total", "percent", "last",
     and 'rate' with percentage breakdown per error, or nil if none
   "results"(Hash|nil):: Results activity stats with keys "total", "percent", "last", and "rate"
     with percentage breakdown per operation result type, or nil if none
   "retries"(Hash|nil):: Retry activity stats with keys "total", "percent", "last", and "rate"
     with percentage breakdown per request type, or nil if none
   "send failure"(Hash|nil):: Send failure activity stats with keys "total", "percent", "last", and "rate"
     with percentage breakdown per failure type, or nil if none