Sha256: 88b8b0555e12f8f0d6ea2a727150cf7cee4b07ce350ce7de9ddc9e7dd4d5c80d

Contents?: true

Size: 900 Bytes

Versions: 1

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true

#
# Abstraction over WebMock to reduce duplication
#
# @author Mikael Henriksson <mikael@zoolutions.se>
# @since 0.1.0
#
module StubRequests
  #
  # Module Metrics contains logic for collecting metrics about {Metrics::Endpoint} and {Metrics::Request}
  #
  # @author Mikael Henriksson <mikael@zoolutions.se>
  # @since 0.1.2
  #
  module Metrics
    #
    # Records metrics about stubbed endpoints
    #
    #
    # @param [Registration::Service] service a Service
    # @param [Registration::Endpoint] endpoint an Endpoint
    # @param [WebMock::RequestStub] endpoint_stub the stubbed webmock request
    #
    # @return [Metrics::Endpoint] the stat that was recorded
    #
    def self.record(service, endpoint, endpoint_stub)
      return unless StubRequests.config.record_metrics?

      Registry.instance.record(service, endpoint, endpoint_stub)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stub_requests-0.1.3 lib/stub_requests/metrics.rb