Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_data_transfer_type.rb « data_transfer « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 36afa20194ec1e1e9db9daf1cf3cf81db66cda94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Types
  module DataTransfer
    class ProjectDataTransferType < BaseType
      graphql_name 'ProjectDataTransfer'
      authorize

      field :total_egress, GraphQL::Types::BigInt,
        description: 'Total egress for that project in that period of time.',
        null: true, # disallow null once data_transfer_monitoring feature flag is rolled-out! https://gitlab.com/gitlab-org/gitlab/-/issues/397693
        extras: [:parent]

      def total_egress(parent:)
        return unless Feature.enabled?(:data_transfer_monitoring, parent.group)
        return 40_000_000 if Feature.enabled?(:data_transfer_monitoring_mock_data, parent.group)

        object[:egress_nodes].sum('repository_egress + artifacts_egress + packages_egress + registry_egress')
      end
    end
  end
end