Commit 61e691e4 authored by Matthias Käppler's avatar Matthias Käppler

Merge branch 'gitaly_usage_data_apdex' into 'master'

Report summarized Gitaly Apdex via usage ping

See merge request gitlab-org/gitlab!47040
parents b5962d43 0157e552
---
title: Report summarized Gitaly Apdex via usage ping
merge_request: 47040
author:
type: added
---
key_path: settings.gitaly_apdex
description: Gitaly application performance
product_section: dev
product_stage: create
product_group: group::gitaly
product_category: gitaly
value_type: number
status: implemented
milestone: "13.11"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47040
time_frame: none
data_source: prometheus
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
......@@ -14360,6 +14360,18 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `settings.gitaly_apdex`
Gitaly application performance
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/settings/20210321224827_gitaly_apdex.yml)
Group: `group::gitaly`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `settings.ldap_encrypted_secrets_enabled`
Is encrypted LDAP secrets configured?
......
......@@ -243,7 +243,8 @@ module Gitlab
{
settings: {
ldap_encrypted_secrets_enabled: alt_usage_data(fallback: nil) { Gitlab::Auth::Ldap::Config.encrypted_secrets.active? },
operating_system: alt_usage_data(fallback: nil) { operating_system }
operating_system: alt_usage_data(fallback: nil) { operating_system },
gitaly_apdex: alt_usage_data { gitaly_apdex }
}
}
end
......@@ -767,6 +768,16 @@ module Gitlab
private
def gitaly_apdex
with_prometheus_client(verify: false, fallback: FALLBACK) do |client|
result = client.query('avg_over_time(gitlab_usage_ping:gitaly_apdex:ratio_avg_over_time_5m[1w])').first
break FALLBACK unless result
result['value'].last.to_f
end
end
def aggregated_metrics
@aggregated_metrics ||= ::Gitlab::Usage::Metrics::Aggregates::Aggregate.new(recorded_at)
end
......
......@@ -1158,8 +1158,17 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
end
describe ".system_usage_data_settings" do
let(:prometheus_client) { double(Gitlab::PrometheusClient) }
before do
allow(described_class).to receive(:operating_system).and_return('ubuntu-20.04')
expect(prometheus_client).to receive(:query).with(/gitlab_usage_ping:gitaly_apdex:ratio_avg_over_time_5m/).and_return([
{
'metric' => {},
'value' => [1616016381.473, '0.95']
}
])
expect(described_class).to receive(:with_prometheus_client).and_yield(prometheus_client)
end
subject { described_class.system_usage_data_settings }
......@@ -1171,6 +1180,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
it 'populates operating system information' do
expect(subject[:settings][:operating_system]).to eq('ubuntu-20.04')
end
it 'gathers gitaly apdex', :aggregate_failures do
expect(subject[:settings][:gitaly_apdex]).to be_within(0.001).of(0.95)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment