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

dashboard_resolver.rb « metrics « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f569cb0b2c3f7803f608eda2ecc91c0b4fa41562 (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 Resolvers
  module Metrics
    class DashboardResolver < Resolvers::BaseResolver
      argument :path, GraphQL::STRING_TYPE,
               required: true,
               description: "Path to a file which defines metrics dashboard eg: 'config/prometheus/common_metrics.yml'."

      type Types::Metrics::DashboardType, null: true

      alias_method :environment, :object

      def resolve(**args)
        return unless environment

        ::PerformanceMonitoring::PrometheusDashboard
          .find_for(project: environment.project, user: context[:current_user], path: args[:path], options: { environment: environment })
      end
    end
  end
end