Sha256: ff6e6d1ef739798d42d5344302801715d607734e5aa00114904a56cb8315ec0c

Contents?: true

Size: 1.88 KB

Versions: 5

Compression:

Stored size: 1.88 KB

Contents

require 'pact_broker/pacts/pact_publication'
require 'pact_broker/pacts/pact_version'
require 'pact_broker/domain/pacticipant'
require 'pact_broker/integrations/integration'
require 'pact_broker/domain/verification'
require 'pact_broker/domain/version'
require 'pact_broker/api/decorators/format_date_time'
require 'pact_broker/webhooks/webhook'
require 'pact_broker/webhooks/triggered_webhook'
require 'pact_broker/webhooks/execution'

module PactBroker
  module Metrics
    module Service
      include PactBroker::Api::Decorators::FormatDateTime

      extend self

      def metrics
        {
          pacticipants: {
            count: PactBroker::Domain::Pacticipant.count
          },
          integrations: {
            count: PactBroker::Integrations::Integration.count
          },
          pactPublications: {
            count: PactBroker::Pacts::PactPublication.count,
            first: format_date_time(PactBroker::Pacts::PactPublication.order(:id).first&.created_at),
            last: format_date_time(PactBroker::Pacts::PactPublication.order(:id).last&.created_at)
          },
          pactVersions: {
            count: PactBroker::Pacts::PactVersion.count
          },
          verificationResults: {
            count: PactBroker::Domain::Verification.count,
            first: format_date_time(PactBroker::Domain::Verification.order(:id).first.created_at),
            last: format_date_time(PactBroker::Domain::Verification.order(:id).last.created_at)
          },
          pacticipantVersions: {
            count: PactBroker::Domain::Version.count
          },
          webhooks: {
            count: PactBroker::Webhooks::Webhook.count
          },
          triggeredWebhooks: {
            count: PactBroker::Webhooks::TriggeredWebhook.count
          },
          webhookExecutions: {
            count: PactBroker::Webhooks::Execution.count
          }
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pact_broker-2.38.1 lib/pact_broker/metrics/service.rb
pact_broker-2.38.0 lib/pact_broker/metrics/service.rb
pact_broker-2.37.0 lib/pact_broker/metrics/service.rb
pact_broker-2.36.1 lib/pact_broker/metrics/service.rb
pact_broker-2.36.0 lib/pact_broker/metrics/service.rb