Skip to content
Snippets Groups Projects
Commit fedf978f authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent db24ab2b
No related branches found
No related tags found
No related merge requests found
Showing
with 1206 additions and 253 deletions
Loading
Loading
@@ -98,7 +98,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
}
end
 
if Gitlab::CurrentSettings.instance_administration_project_id.present?
if Gitlab::CurrentSettings.self_monitoring_project_id.present?
return render status: :ok, json: self_monitoring_data
 
elsif SelfMonitoringProjectCreateWorker.in_progress?(job_id)
Loading
Loading
@@ -134,7 +134,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
}
end
 
if Gitlab::CurrentSettings.instance_administration_project_id.nil?
if Gitlab::CurrentSettings.self_monitoring_project_id.nil?
return render status: :ok, json: {
message: _('Self-monitoring project has been successfully deleted')
}
Loading
Loading
@@ -161,8 +161,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
 
def self_monitoring_data
{
project_id: Gitlab::CurrentSettings.instance_administration_project_id,
project_full_path: Gitlab::CurrentSettings.instance_administration_project&.full_path
project_id: Gitlab::CurrentSettings.self_monitoring_project_id,
project_full_path: Gitlab::CurrentSettings.self_monitoring_project&.full_path
}
end
 
Loading
Loading
@@ -171,7 +171,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
status: :not_implemented,
json: {
message: _('Self-monitoring is not enabled on this GitLab server, contact your administrator.'),
documentation_url: help_page_path('administration/monitoring/gitlab_instance_administration_project/index')
documentation_url: help_page_path('administration/monitoring/gitlab_self_monitoring_project/index')
}
)
end
Loading
Loading
Loading
Loading
@@ -314,18 +314,21 @@ class IssuableFinder
params[:assignee_username].present?
end
 
# rubocop: disable CodeReuse/ActiveRecord
def assignee
return @assignee if defined?(@assignee)
assignees.first
end
 
@assignee =
# rubocop: disable CodeReuse/ActiveRecord
def assignees
strong_memoize(:assignees) do
if assignee_id?
User.find_by(id: params[:assignee_id])
User.where(id: params[:assignee_id])
elsif assignee_username?
User.find_by_username(params[:assignee_username])
User.where(username: params[:assignee_username])
else
nil
User.none
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
 
Loading
Loading
@@ -415,7 +418,7 @@ class IssuableFinder
# These are "helper" params that are required inside the NOT to get the right results. They usually come in
# at the top-level params, but if they do come in inside the `:not` params, they should take precedence.
not_helpers = params.slice(*NEGATABLE_PARAMS_HELPER_KEYS).merge(params[:not].slice(*NEGATABLE_PARAMS_HELPER_KEYS))
not_param = { key => value }.with_indifferent_access.merge(not_helpers)
not_param = { key => value }.with_indifferent_access.merge(not_helpers).merge(not_query: true)
 
items_to_negate = self.class.new(current_user, not_param).execute
 
Loading
Loading
@@ -543,6 +546,8 @@ class IssuableFinder
# rubocop: enable CodeReuse/ActiveRecord
 
def by_assignee(items)
return items.assigned_to(assignees) if not_query? && assignees.any?
if filter_by_no_assignee?
items.unassigned
elsif filter_by_any_assignee?
Loading
Loading
@@ -624,7 +629,7 @@ class IssuableFinder
elsif filter_by_any_label?
items.any_label
else
items.with_label(label_names, params[:sort])
items.with_label(label_names, params[:sort], not_query: not_query?)
end
 
items
Loading
Loading
@@ -673,4 +678,8 @@ class IssuableFinder
def min_access_level
ProjectFeature.required_minimum_access_level(klass)
end
def not_query?
!!params[:not_query]
end
end
Loading
Loading
@@ -351,10 +351,10 @@ module ApplicationSettingsHelper
status_delete_self_monitoring_project_admin_application_settings_path,
 
'self_monitoring_project_exists' =>
Gitlab::CurrentSettings.instance_administration_project.present?.to_s,
Gitlab::CurrentSettings.self_monitoring_project.present?.to_s,
 
'self_monitoring_project_full_path' =>
Gitlab::CurrentSettings.instance_administration_project&.full_path
Gitlab::CurrentSettings.self_monitoring_project&.full_path
}
end
end
Loading
Loading
Loading
Loading
@@ -10,7 +10,9 @@ class ApplicationSetting < ApplicationRecord
add_authentication_token_field :health_check_access_token
add_authentication_token_field :static_objects_external_storage_auth_token
 
belongs_to :instance_administration_project, class_name: "Project"
belongs_to :self_monitoring_project, class_name: "Project", foreign_key: 'instance_administration_project_id'
alias_attribute :self_monitoring_project_id, :instance_administration_project_id
belongs_to :instance_administrators_group, class_name: "Group"
 
# Include here so it can override methods from
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ module Clusters
 
self.table_name = 'clusters_applications_knative'
 
has_one :serverless_domain_cluster, class_name: 'Serverless::DomainCluster', foreign_key: 'clusters_applications_knative_id', inverse_of: :knative
has_one :serverless_domain_cluster, class_name: '::Serverless::DomainCluster', foreign_key: 'clusters_applications_knative_id', inverse_of: :knative
 
include ::Clusters::Concerns::ApplicationCore
include ::Clusters::Concerns::ApplicationStatus
Loading
Loading
Loading
Loading
@@ -108,7 +108,9 @@ module Issuable
where("NOT EXISTS (SELECT TRUE FROM #{to_ability_name}_assignees WHERE #{to_ability_name}_id = #{to_ability_name}s.id)")
end
scope :assigned_to, ->(u) do
where("EXISTS (SELECT TRUE FROM #{to_ability_name}_assignees WHERE user_id = ? AND #{to_ability_name}_id = #{to_ability_name}s.id)", u.id)
assignees_table = Arel::Table.new("#{to_ability_name}_assignees")
sql = assignees_table.project('true').where(assignees_table[:user_id].in(u)).where(Arel::Nodes::SqlLiteral.new("#{to_ability_name}_id = #{to_ability_name}s.id"))
where("EXISTS (#{sql.to_sql})")
end
# rubocop:enable GitlabSecurity/SqlInjection
 
Loading
Loading
@@ -263,8 +265,9 @@ module Issuable
.reorder(Gitlab::Database.nulls_last_order('highest_priority', direction))
end
 
def with_label(title, sort = nil)
if title.is_a?(Array) && title.size > 1
def with_label(title, sort = nil, not_query: false)
multiple_labels = title.is_a?(Array) && title.size > 1
if multiple_labels && !not_query
joins(:labels).where(labels: { title: title }).group(*grouping_columns(sort)).having("COUNT(DISTINCT labels.title) = #{title.size}")
else
joins(:labels).where(labels: { title: title })
Loading
Loading
Loading
Loading
@@ -102,7 +102,7 @@ class PrometheusService < MonitoringService
private
 
def self_monitoring_project?
project && project.id == current_settings.instance_administration_project_id
project && project.id == current_settings.self_monitoring_project_id
end
 
def internal_prometheus_url?
Loading
Loading
Loading
Loading
@@ -15,5 +15,7 @@ module Serverless
format: { with: HEX_REGEXP, message: 'only allows hex characters' }
 
default_value_for(:uuid, allows_nil: false) { Gitlab::Serverless::Domain.generate_uuid }
delegate :domain, to: :pages_domain
end
end
This diff is collapsed.
---
title: Rename 'GitLab Instance Administration' project to 'GitLab self monitoring' project
merge_request: 23182
author:
type: changed
# rubocop:disable Rails/Output
if defined?(Rails::Console) || Rails.env.development?
# when using `spring` this will only print out the first time
if defined?(Rails::Console)
# note that this will not print out when using `spring`
justify = 15
 
puts '-' * 80
puts " GitLab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision}) #{Gitlab.ee? ? 'EE' : 'FOSS'}"
puts " GitLab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision})"
puts " GitLab Shell:".ljust(justify) + "#{Gitlab::VersionInfo.parse(Gitlab::Shell.new.version)}"
puts " #{Gitlab::Database.human_adapter_name}:".ljust(justify) + Gitlab::Database.version
 
Loading
Loading
# GitLab instance administration project
---
redirect_to: '../gitlab_self_monitoring_project/index.md'
---
 
NOTE: **Note:**
This feature is available behind a feature flag called `self_monitoring_project`
since [12.7](https://gitlab.com/gitlab-org/gitlab/issues/32351). The feature flag
will be removed once we [add dashboards to display metrics](https://gitlab.com/groups/gitlab-org/-/epics/2367).
GitLab has been adding the ability for administrators to see insights into the health of
their GitLab instance. In order to surface this experience in a native way, similar to how
you would interact with an application deployed via GitLab, a base project called
"GitLab Instance Administration" with
[internal visibility](../../../public_access/public_access.md#internal-projects) will be
added under a group called "GitLab Instance Administrators" specifically created for
visualizing and configuring the monitoring of your GitLab instance.
All administrators at the time of creation of the project and group will be added
as maintainers of the group and project, and as an admin, you'll be able to add new
members to the group in order to give them maintainer access to the project.
This project will be used for self-monitoring your GitLab instance.
## Connection to Prometheus
The project will be automatically configured to connect to the
[internal Prometheus](../prometheus/index.md) instance if the Prometheus
instance is present (should be the case if GitLab was installed via Omnibus
and you haven't disabled it).
If that's not the case or if you have an external Prometheus instance or an HA setup,
you should
[configure it manually](../../../user/project/integrations/prometheus.md#manual-configuration-of-prometheus).
## Taking action on Prometheus alerts **(ULTIMATE)**
You can [add a webhook](../../../user/project/integrations/prometheus.md#external-prometheus-instances)
to the Prometheus config in order for GitLab to receive notifications of any alerts.
Once the webhook is setup, you can
[take action on incoming alerts](../../../user/project/integrations/prometheus.md#taking-action-on-incidents-ultimate).
This document was moved to [another location](../gitlab_self_monitoring_project/index.md).
# GitLab self monitoring project
NOTE: **Note:**
This feature is available behind a feature flag called `self_monitoring_project`
since [12.7](https://gitlab.com/gitlab-org/gitlab/issues/32351). The feature flag
will be removed once we [add dashboards to display metrics](https://gitlab.com/groups/gitlab-org/-/epics/2367).
GitLab has been adding the ability for administrators to see insights into the health of
their GitLab instance. In order to surface this experience in a native way, similar to how
you would interact with an application deployed via GitLab, a base project called
"GitLab self monitoring" with
[internal visibility](../../../public_access/public_access.md#internal-projects) will be
added under a group called "GitLab Instance Administrators" specifically created for
visualizing and configuring the monitoring of your GitLab instance.
All administrators at the time of creation of the project and group will be added
as maintainers of the group and project, and as an admin, you'll be able to add new
members to the group in order to give them maintainer access to the project.
This project will be used for self-monitoring your GitLab instance.
## Connection to Prometheus
The project will be automatically configured to connect to the
[internal Prometheus](../prometheus/index.md) instance if the Prometheus
instance is present (should be the case if GitLab was installed via Omnibus
and you haven't disabled it).
If that's not the case or if you have an external Prometheus instance or an HA setup,
you should
[configure it manually](../../../user/project/integrations/prometheus.md#manual-configuration-of-prometheus).
## Taking action on Prometheus alerts **(ULTIMATE)**
You can [add a webhook](../../../user/project/integrations/prometheus.md#external-prometheus-instances)
to the Prometheus config in order for GitLab to receive notifications of any alerts.
Once the webhook is setup, you can
[take action on incoming alerts](../../../user/project/integrations/prometheus.md#taking-action-on-incidents-ultimate).
Loading
Loading
@@ -2,7 +2,7 @@
 
Explore our features to monitor your GitLab instance:
 
- [GitLab self-monitoring](gitlab_instance_administration_project/index.md): The
- [GitLab self-monitoring](gitlab_self_monitoring_project/index.md): The
GitLab instance administration project helps to monitor the GitLab instance and
take action on alerts.
- [Performance monitoring](performance/index.md): GitLab Performance Monitoring makes it possible to measure a wide variety of statistics of your instance.
Loading
Loading
Loading
Loading
@@ -32,6 +32,7 @@ The following metrics are available:
| `gitlab_cache_operations_total` | Counter | 12.2 | Cache operations by controller/action | controller, action, operation |
| `gitlab_database_transaction_seconds` | Histogram | 12.1 | Time spent in database transactions, in seconds | |
| `gitlab_method_call_duration_seconds` | Histogram | 10.2 | Method calls real duration | controller, action, module, method |
| `gitlab_page_out_of_bounds` | Counter | 12.8 | Counter for the PageLimiter pagination limit being hit | controller, action, bot |
| `gitlab_rails_queue_duration_seconds` | Histogram | 9.4 | Measures latency between GitLab Workhorse forwarding a request to Rails | |
| `gitlab_sql_duration_seconds` | Histogram | 10.2 | SQL execution time, excluding SCHEMA operations and BEGIN / COMMIT | |
| `gitlab_transaction_allocated_memory_bytes` | Histogram | 10.2 | Allocated memory for all transactions (gitlab_transaction_* metrics) | |
Loading
Loading
Loading
Loading
@@ -2681,6 +2681,27 @@ trigger_job:
strategy: depend
```
 
#### Linking pipelines with `trigger:strategy`
By default, the `trigger` job completes with the `success` status
as soon as the downstream pipeline is created.
To force the `trigger` job to wait for the downstream (multi-project or child) pipeline to complete, use
`strategy: depend`. This will make the trigger job wait with a "running" status until the triggered
pipeline completes. At that point, the `trigger` job will complete and display the same status as
the downstream job.
```yaml
trigger_job:
trigger:
include: path/to/child-pipeline.yml
strategy: depend
```
This can help keep your pipeline execution linear. In the example above, jobs from
subsequent stages will wait for the triggered pipeline to successfully complete before
starting, at the cost of reduced parallelization.
### `interruptible`
 
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/23464) in GitLab 12.3.
Loading
Loading
Loading
Loading
@@ -54,17 +54,6 @@ By default, this seeds an average of 10 issues per week for the last 52 weeks
per project. All issues will also be randomly labeled with team, type, severity,
and priority.
 
#### Seeding groups with sub-groups
You can seed groups with sub-groups that contain milestones/projects/issues
with the `gitlab:seed:group_seed` task:
```shell
bin/rake "gitlab:seed:group_seed[subgroup_depth, username]"
```
Group are additionally seeded with epics if GitLab instance has epics feature available.
### Automation
 
If you're very sure that you want to **wipe the current database** and refill
Loading
Loading
Loading
Loading
@@ -13,11 +13,11 @@ module Gitlab
end
 
def self_monitoring_project
application_settings.instance_administration_project
application_settings.self_monitoring_project
end
 
def self_monitoring_project_id
application_settings.instance_administration_project_id
application_settings.self_monitoring_project_id
end
end
end
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ module Gitlab
include SelfMonitoring::Helpers
 
VISIBILITY_LEVEL = Gitlab::VisibilityLevel::INTERNAL
PROJECT_NAME = 'GitLab Instance Administration'
PROJECT_NAME = 'GitLab self monitoring'
 
steps :validate_application_settings,
:create_group,
Loading
Loading
@@ -69,7 +69,7 @@ module Gitlab
return success(result) if project_created?
 
response = application_settings.update(
instance_administration_project_id: result[:project].id
self_monitoring_project_id: result[:project].id
)
 
if response
Loading
Loading
@@ -115,7 +115,7 @@ module Gitlab
 
def docs_path
Rails.application.routes.url_helpers.help_page_path(
'administration/monitoring/gitlab_instance_administration_project/index'
'administration/monitoring/gitlab_self_monitoring_project/index'
)
end
 
Loading
Loading
# frozen_string_literal: true
module Gitlab
module Serverless
class FunctionURI < URI::HTTPS
SERVERLESS_DOMAIN_REGEXP = %r{^(?<scheme>https?://)?(?<function>[^.]+)-(?<cluster_left>\h{2})a1(?<cluster_middle>\h{10})f2(?<cluster_right>\h{2})(?<environment_id>\h+)-(?<environment_slug>[^.]+)\.(?<domain>.+)}.freeze
attr_reader :function, :cluster, :environment
def initialize(function: nil, cluster: nil, environment: nil)
initialize_required_argument(:function, function)
initialize_required_argument(:cluster, cluster)
initialize_required_argument(:environment, environment)
@host = "#{function}-#{cluster.uuid[0..1]}a1#{cluster.uuid[2..-3]}f2#{cluster.uuid[-2..-1]}#{"%x" % environment.id}-#{environment.slug}.#{cluster.domain}"
super('https', nil, host, nil, nil, nil, nil, nil, nil)
end
def self.parse(uri)
match = SERVERLESS_DOMAIN_REGEXP.match(uri)
return unless match
cluster = ::Serverless::DomainCluster.find(match[:cluster_left] + match[:cluster_middle] + match[:cluster_right])
return unless cluster
environment = ::Environment.find(match[:environment_id].to_i(16))
return unless environment&.slug == match[:environment_slug]
new(
function: match[:function],
cluster: cluster,
environment: environment
)
end
private
def initialize_required_argument(name, value)
raise ArgumentError.new("missing argument: #{name}") unless value
instance_variable_set("@#{name}".to_sym, value)
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment