Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
791f72d8ff
commit
fa9e540be7
9 changed files with 202 additions and 3 deletions
2
Gemfile
2
Gemfile
|
@ -439,7 +439,7 @@ end
|
||||||
gem 'octokit', '~> 4.15'
|
gem 'octokit', '~> 4.15'
|
||||||
|
|
||||||
# https://gitlab.com/gitlab-org/gitlab/issues/207207
|
# https://gitlab.com/gitlab-org/gitlab/issues/207207
|
||||||
gem 'gitlab-mail_room', '~> 0.0.8', require: 'mail_room'
|
gem 'gitlab-mail_room', '~> 0.0.9', require: 'mail_room'
|
||||||
|
|
||||||
gem 'email_reply_trimmer', '~> 0.1'
|
gem 'email_reply_trimmer', '~> 0.1'
|
||||||
gem 'html2text'
|
gem 'html2text'
|
||||||
|
|
|
@ -464,7 +464,7 @@ GEM
|
||||||
pg_query (~> 1.3)
|
pg_query (~> 1.3)
|
||||||
redis (> 3.0.0, < 5.0.0)
|
redis (> 3.0.0, < 5.0.0)
|
||||||
gitlab-license (1.3.1)
|
gitlab-license (1.3.1)
|
||||||
gitlab-mail_room (0.0.8)
|
gitlab-mail_room (0.0.9)
|
||||||
gitlab-markup (1.7.1)
|
gitlab-markup (1.7.1)
|
||||||
gitlab-net-dns (0.9.1)
|
gitlab-net-dns (0.9.1)
|
||||||
gitlab-pry-byebug (3.9.0)
|
gitlab-pry-byebug (3.9.0)
|
||||||
|
@ -1427,7 +1427,7 @@ DEPENDENCIES
|
||||||
gitlab-fog-google (~> 1.13)
|
gitlab-fog-google (~> 1.13)
|
||||||
gitlab-labkit (~> 0.16.1)
|
gitlab-labkit (~> 0.16.1)
|
||||||
gitlab-license (~> 1.3)
|
gitlab-license (~> 1.3)
|
||||||
gitlab-mail_room (~> 0.0.8)
|
gitlab-mail_room (~> 0.0.9)
|
||||||
gitlab-markup (~> 1.7.1)
|
gitlab-markup (~> 1.7.1)
|
||||||
gitlab-net-dns (~> 0.9.1)
|
gitlab-net-dns (~> 0.9.1)
|
||||||
gitlab-pry-byebug
|
gitlab-pry-byebug
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Add Prometheus metrics for ActionCable subscription events
|
||||||
|
merge_request: 56157
|
||||||
|
author:
|
||||||
|
type: added
|
5
changelogs/unreleased/sh-update-mailroom-0-0-9.yml
Normal file
5
changelogs/unreleased/sh-update-mailroom-0-0-9.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Update mailroom to v0.0.9
|
||||||
|
merge_request: 56592
|
||||||
|
author:
|
||||||
|
type: changed
|
|
@ -143,6 +143,7 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d
|
||||||
|
|
||||||
# These are manually require'd so the classes are registered properly with
|
# These are manually require'd so the classes are registered properly with
|
||||||
# ActiveSupport.
|
# ActiveSupport.
|
||||||
|
require_dependency 'gitlab/metrics/subscribers/action_cable'
|
||||||
require_dependency 'gitlab/metrics/subscribers/action_view'
|
require_dependency 'gitlab/metrics/subscribers/action_view'
|
||||||
require_dependency 'gitlab/metrics/subscribers/active_record'
|
require_dependency 'gitlab/metrics/subscribers/active_record'
|
||||||
require_dependency 'gitlab/metrics/subscribers/rails_cache'
|
require_dependency 'gitlab/metrics/subscribers/rails_cache'
|
||||||
|
|
|
@ -136,6 +136,12 @@ To see if GitLab can access the repository file system directly, we use the foll
|
||||||
Direct Git access is enable by default in Omnibus GitLab because it fills in the correct repository
|
Direct Git access is enable by default in Omnibus GitLab because it fills in the correct repository
|
||||||
paths in the GitLab configuration file `config/gitlab.yml`. This satisfies the UUID check.
|
paths in the GitLab configuration file `config/gitlab.yml`. This satisfies the UUID check.
|
||||||
|
|
||||||
|
WARNING:
|
||||||
|
If directly copying repository data from a GitLab server to Gitaly, ensure that the metadata file,
|
||||||
|
default path `/var/opt/gitlab/git-data/repositories/.gitaly-metadata`, is not included in the transfer.
|
||||||
|
Copying this file causes GitLab to use the Rugged patches for repositories hosted on the Gitaly server,
|
||||||
|
leading to `Error creating pipeline` and `Commit not found` errors, or stale data.
|
||||||
|
|
||||||
### Transition to Gitaly Cluster
|
### Transition to Gitaly Cluster
|
||||||
|
|
||||||
For the sake of removing complexity, we must remove direct Git access in GitLab. However, we can't
|
For the sake of removing complexity, we must remove direct Git access in GitLab. However, we can't
|
||||||
|
|
|
@ -110,12 +110,16 @@ The following metrics are available:
|
||||||
| `auto_devops_pipelines_completed_total` | Counter | 12.7 | Counter of completed Auto DevOps pipelines, labeled by status | |
|
| `auto_devops_pipelines_completed_total` | Counter | 12.7 | Counter of completed Auto DevOps pipelines, labeled by status | |
|
||||||
| `gitlab_metrics_dashboard_processing_time_ms` | Summary | 12.10 | Metrics dashboard processing time in milliseconds | service, stages |
|
| `gitlab_metrics_dashboard_processing_time_ms` | Summary | 12.10 | Metrics dashboard processing time in milliseconds | service, stages |
|
||||||
| `action_cable_active_connections` | Gauge | 13.4 | Number of ActionCable WS clients currently connected | `server_mode` |
|
| `action_cable_active_connections` | Gauge | 13.4 | Number of ActionCable WS clients currently connected | `server_mode` |
|
||||||
|
| `action_cable_broadcasts_total` | Counter | 13.10 | The number of ActionCable broadcasts emitted | `server_mode` |
|
||||||
| `action_cable_pool_min_size` | Gauge | 13.4 | Minimum number of worker threads in ActionCable thread pool | `server_mode` |
|
| `action_cable_pool_min_size` | Gauge | 13.4 | Minimum number of worker threads in ActionCable thread pool | `server_mode` |
|
||||||
| `action_cable_pool_max_size` | Gauge | 13.4 | Maximum number of worker threads in ActionCable thread pool | `server_mode` |
|
| `action_cable_pool_max_size` | Gauge | 13.4 | Maximum number of worker threads in ActionCable thread pool | `server_mode` |
|
||||||
| `action_cable_pool_current_size` | Gauge | 13.4 | Current number of worker threads in ActionCable thread pool | `server_mode` |
|
| `action_cable_pool_current_size` | Gauge | 13.4 | Current number of worker threads in ActionCable thread pool | `server_mode` |
|
||||||
| `action_cable_pool_largest_size` | Gauge | 13.4 | Largest number of worker threads observed so far in ActionCable thread pool | `server_mode` |
|
| `action_cable_pool_largest_size` | Gauge | 13.4 | Largest number of worker threads observed so far in ActionCable thread pool | `server_mode` |
|
||||||
| `action_cable_pool_pending_tasks` | Gauge | 13.4 | Number of tasks waiting to be executed in ActionCable thread pool | `server_mode` |
|
| `action_cable_pool_pending_tasks` | Gauge | 13.4 | Number of tasks waiting to be executed in ActionCable thread pool | `server_mode` |
|
||||||
| `action_cable_pool_tasks_total` | Gauge | 13.4 | Total number of tasks executed in ActionCable thread pool | `server_mode` |
|
| `action_cable_pool_tasks_total` | Gauge | 13.4 | Total number of tasks executed in ActionCable thread pool | `server_mode` |
|
||||||
|
| `action_cable_single_client_transmissions_total` | Counter | 13.10 | The number of ActionCable messages transmitted to any client in any channel | `server_mode` |
|
||||||
|
| `action_cable_subscription_confirmations_total` | Counter | 13.10 | The number of ActionCable subscriptions from clients confirmed | `server_mode` |
|
||||||
|
| `action_cable_subscription_rejections_total` | Counter | 13.10 | The number of ActionCable subscriptions from clients rejected | `server_mode` |
|
||||||
| `gitlab_issuable_fast_count_by_state_total` | Counter | 13.5 | Total number of row count operations on issue/merge request list pages | |
|
| `gitlab_issuable_fast_count_by_state_total` | Counter | 13.5 | Total number of row count operations on issue/merge request list pages | |
|
||||||
| `gitlab_issuable_fast_count_by_state_failures_total` | Counter | 13.5 | Number of soft-failed row count operations on issue/merge request list pages | |
|
| `gitlab_issuable_fast_count_by_state_failures_total` | Counter | 13.5 | Number of soft-failed row count operations on issue/merge request list pages | |
|
||||||
| `gitlab_external_http_total` | Counter | 13.8 | Total number of HTTP calls to external systems | `controller`, `action` |
|
| `gitlab_external_http_total` | Counter | 13.8 | Total number of HTTP calls to external systems | `controller`, `action` |
|
||||||
|
|
72
lib/gitlab/metrics/subscribers/action_cable.rb
Normal file
72
lib/gitlab/metrics/subscribers/action_cable.rb
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Gitlab
|
||||||
|
module Metrics
|
||||||
|
module Subscribers
|
||||||
|
class ActionCable < ActiveSupport::Subscriber
|
||||||
|
include Gitlab::Utils::StrongMemoize
|
||||||
|
|
||||||
|
attach_to :action_cable
|
||||||
|
|
||||||
|
SINGLE_CLIENT_TRANSMISSION = :action_cable_single_client_transmissions_total
|
||||||
|
TRANSMIT_SUBSCRIPTION_CONFIRMATION = :action_cable_subscription_confirmations_total
|
||||||
|
TRANSMIT_SUBSCRIPTION_REJECTION = :action_cable_subscription_rejections_total
|
||||||
|
BROADCAST = :action_cable_broadcasts_total
|
||||||
|
|
||||||
|
def transmit_subscription_confirmation(event)
|
||||||
|
confirm_subscription_counter.increment
|
||||||
|
end
|
||||||
|
|
||||||
|
def transmit_subscription_rejection(event)
|
||||||
|
reject_subscription_counter.increment
|
||||||
|
end
|
||||||
|
|
||||||
|
def transmit(event)
|
||||||
|
transmit_counter.increment
|
||||||
|
end
|
||||||
|
|
||||||
|
def broadcast(event)
|
||||||
|
broadcast_counter.increment
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def transmit_counter
|
||||||
|
strong_memoize("transmission_counter") do
|
||||||
|
::Gitlab::Metrics.counter(
|
||||||
|
SINGLE_CLIENT_TRANSMISSION,
|
||||||
|
'The number of ActionCable messages transmitted to any client in any channel'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def broadcast_counter
|
||||||
|
strong_memoize("broadcast_counter") do
|
||||||
|
::Gitlab::Metrics.counter(
|
||||||
|
BROADCAST,
|
||||||
|
'The number of ActionCable broadcasts emitted'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def confirm_subscription_counter
|
||||||
|
strong_memoize("confirm_subscription_counter") do
|
||||||
|
::Gitlab::Metrics.counter(
|
||||||
|
TRANSMIT_SUBSCRIPTION_CONFIRMATION,
|
||||||
|
'The number of ActionCable subscriptions from clients confirmed'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reject_subscription_counter
|
||||||
|
strong_memoize("reject_subscription_counter") do
|
||||||
|
::Gitlab::Metrics.counter(
|
||||||
|
TRANSMIT_SUBSCRIPTION_REJECTION,
|
||||||
|
'The number of ActionCable subscriptions from clients rejected'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
106
spec/lib/gitlab/metrics/subscribers/action_cable_spec.rb
Normal file
106
spec/lib/gitlab/metrics/subscribers/action_cable_spec.rb
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
RSpec.describe Gitlab::Metrics::Subscribers::ActionCable, :request_store do
|
||||||
|
let(:subscriber) { described_class.new }
|
||||||
|
let(:counter) { double(:counter) }
|
||||||
|
let(:data) { { data: { event: 'updated' } } }
|
||||||
|
let(:channel_class) { 'IssuesChannel' }
|
||||||
|
let(:event) do
|
||||||
|
double(
|
||||||
|
:event,
|
||||||
|
name: name,
|
||||||
|
payload: payload
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#transmit' do
|
||||||
|
let(:name) { 'transmit.action_cable' }
|
||||||
|
let(:via) { 'streamed from issues:Z2lkOi8vZs2l0bGFiL0lzc3VlLzQ0Ng' }
|
||||||
|
let(:payload) do
|
||||||
|
{
|
||||||
|
channel_class: channel_class,
|
||||||
|
via: via,
|
||||||
|
data: data
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'tracks the transmit event' do
|
||||||
|
allow(::Gitlab::Metrics).to receive(:counter).with(
|
||||||
|
:action_cable_single_client_transmissions_total, /transmit/
|
||||||
|
).and_return(counter)
|
||||||
|
|
||||||
|
expect(counter).to receive(:increment)
|
||||||
|
|
||||||
|
subscriber.transmit(event)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#broadcast' do
|
||||||
|
let(:name) { 'broadcast.action_cable' }
|
||||||
|
let(:coder) { ActiveSupport::JSON }
|
||||||
|
let(:message) do
|
||||||
|
{ event: :updated }
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:broadcasting) { 'issues:Z2lkOi8vZ2l0bGFiL0lzc3VlLzQ0Ng' }
|
||||||
|
let(:payload) do
|
||||||
|
{
|
||||||
|
broadcasting: broadcasting,
|
||||||
|
message: message,
|
||||||
|
coder: coder
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'tracks the broadcast event' do
|
||||||
|
allow(::Gitlab::Metrics).to receive(:counter).with(
|
||||||
|
:action_cable_broadcasts_total, /broadcast/
|
||||||
|
).and_return(counter)
|
||||||
|
|
||||||
|
expect(counter).to receive(:increment)
|
||||||
|
|
||||||
|
subscriber.broadcast(event)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#transmit_subscription_confirmation' do
|
||||||
|
let(:name) { 'transmit_subscription_confirmation.action_cable' }
|
||||||
|
let(:channel_class) { 'IssuesChannel' }
|
||||||
|
let(:payload) do
|
||||||
|
{
|
||||||
|
channel_class: channel_class
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'tracks the subscription confirmation event' do
|
||||||
|
allow(::Gitlab::Metrics).to receive(:counter).with(
|
||||||
|
:action_cable_subscription_confirmations_total, /confirm/
|
||||||
|
).and_return(counter)
|
||||||
|
|
||||||
|
expect(counter).to receive(:increment)
|
||||||
|
|
||||||
|
subscriber.transmit_subscription_confirmation(event)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#transmit_subscription_rejection' do
|
||||||
|
let(:name) { 'transmit_subscription_rejection.action_cable' }
|
||||||
|
let(:channel_class) { 'IssuesChannel' }
|
||||||
|
let(:payload) do
|
||||||
|
{
|
||||||
|
channel_class: channel_class
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'tracks the subscription rejection event' do
|
||||||
|
allow(::Gitlab::Metrics).to receive(:counter).with(
|
||||||
|
:action_cable_subscription_rejections_total, /reject/
|
||||||
|
).and_return(counter)
|
||||||
|
|
||||||
|
expect(counter).to receive(:increment)
|
||||||
|
|
||||||
|
subscriber.transmit_subscription_rejection(event)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue