summaryrefslogtreecommitdiff
path: root/app/models/performance_monitoring
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-19 18:10:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-19 18:10:34 +0000
commit2f5731cf536deff075d1011814f271cbb1ed67e2 (patch)
treef6e6dec098a60039b1413dae64d24c0bf55bf03d /app/models/performance_monitoring
parent74b5b3ffcb9fe4d9424bc2bf35e43f749f76d023 (diff)
downloadgitlab-ce-2f5731cf536deff075d1011814f271cbb1ed67e2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/performance_monitoring')
-rw-r--r--app/models/performance_monitoring/prometheus_dashboard.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/app/models/performance_monitoring/prometheus_dashboard.rb b/app/models/performance_monitoring/prometheus_dashboard.rb
index 0c9358aa5cb..bf87d2c3916 100644
--- a/app/models/performance_monitoring/prometheus_dashboard.rb
+++ b/app/models/performance_monitoring/prometheus_dashboard.rb
@@ -53,18 +53,14 @@ module PerformanceMonitoring
# This method is planned to be refactored as a part of https://gitlab.com/gitlab-org/gitlab/-/issues/219398
# implementation. For new existing logic was reused to faster deliver MVC
def schema_validation_warnings
- run_custom_validation.map(&:message)
+ self.class.from_json(reload_schema)
+ nil
+ rescue ActiveModel::ValidationError => exception
+ exception.model.errors.map { |attr, error| "#{attr}: #{error}" }
end
private
- def run_custom_validation
- Gitlab::Metrics::Dashboard::Validator
- .errors(reload_schema, dashboard_path: path, project: environment&.project)
- rescue Gitlab::Config::Loader::FormatError => error
- [error.message]
- end
-
# dashboard finder methods are somehow limited, #find includes checking if
# user is authorised to view selected dashboard, but modifies schema, which in some cases may
# cause false positives returned from validation, and #find_raw does not authorise users