From 5d52aaa4896dd3b461d6912199f4f574f4f3faa2 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 1 Oct 2020 15:29:50 +1000 Subject: [PATCH] chore: add logging for matrix and pacts for verification selectors --- .../api/resources/provider_pacts_for_verification.rb | 6 ++++++ lib/pact_broker/matrix/service.rb | 3 +++ 2 files changed, 9 insertions(+) diff --git a/lib/pact_broker/api/resources/provider_pacts_for_verification.rb b/lib/pact_broker/api/resources/provider_pacts_for_verification.rb index d948a7b12..13afaed71 100644 --- a/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +++ b/lib/pact_broker/api/resources/provider_pacts_for_verification.rb @@ -52,6 +52,7 @@ def resource_title end def to_json + log_request PactBroker::Api::Decorators::VerifiablePactsDecorator.new(pacts).to_json( decorator_options( include_pending_status: parsed_query_params.include_pending_status, @@ -82,6 +83,11 @@ def query end end end + + def log_request + parameters = request.get? ? query : params + logger.info "Fetching pacts for verification by #{provider_name}", provider_name: provider_name, params: parameters + end end end end diff --git a/lib/pact_broker/matrix/service.rb b/lib/pact_broker/matrix/service.rb index 711be5ef1..8ab100388 100644 --- a/lib/pact_broker/matrix/service.rb +++ b/lib/pact_broker/matrix/service.rb @@ -1,3 +1,4 @@ +require 'pact_broker/logging' require 'pact_broker/repositories' require 'pact_broker/matrix/row' require 'pact_broker/matrix/deployment_status_summary' @@ -9,8 +10,10 @@ module Service extend self extend PactBroker::Repositories extend PactBroker::Services + include PactBroker::Logging def find selectors, options = {} + logger.info "Querying matrix", selectors: selectors, options: options query_results = matrix_repository.find selectors, options deployment_status_summary = DeploymentStatusSummary.new(query_results.rows, query_results.resolved_selectors, query_results.integrations) QueryResultsWithDeploymentStatusSummary.new(query_results, deployment_status_summary)