Sha256: 36504445b6fa3966f2d511ee468e7cda86adf6a6d88cc7f886e9fdeb22d891ff

Contents?: true

Size: 848 Bytes

Versions: 1

Compression:

Stored size: 848 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 {EndpointStat} and {StubStat}
  #
  # @author Mikael Henriksson <mikael@zoolutions.se>
  # @since 0.1.2
  #
  module Metrics
    #
    # Records metrics about stubbed endpoints
    #
    # @param [Service] service a Service
    # @param [Endpoint] endpoint an Endpoint
    # @param [WebMock::RequestStub] endpoint_stub the stubbed webmock request
    #
    # @return [EndpointStat] 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.2 lib/stub_requests/metrics.rb