Commit 606a6fb9 authored by Qingyu Zhao's avatar Qingyu Zhao

Remove app_server_type from top level usage ping

App server type is moved from top level usage ping into topology
element.
parent bbf984f0
---
title: Remove app_server_type from top level usage ping
merge_request: 37279
author:
type: other
......@@ -822,9 +822,6 @@ The following is example content of the Usage Ping payload.
"adapter": "postgresql",
"version": "9.6.15"
},
"app_server": {
"type": "console"
},
"avg_cycle_analytics": {
"issue": {
"average": 999,
......
......@@ -261,17 +261,8 @@ module Gitlab
database: {
adapter: alt_usage_data { Gitlab::Database.adapter_name },
version: alt_usage_data { Gitlab::Database.version }
},
app_server: { type: app_server_type }
}
end
def app_server_type
Gitlab::Runtime.identify.to_s
rescue Gitlab::Runtime::IdentificationError => e
Gitlab::AppLogger.error(e.message)
Gitlab::ErrorTracking.track_exception(e)
'unknown_app_server_type'
}
end
def object_store_config(component)
......
......@@ -574,10 +574,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
subject { described_class.components_usage_data }
it 'gathers basic components usage data' do
stub_runtime(:puma)
stub_application_setting(container_registry_vendor: 'gitlab', container_registry_version: 'x.y.z')
expect(subject[:app_server][:type]).to eq('puma')
expect(subject[:gitlab_pages][:enabled]).to eq(Gitlab.config.pages.enabled)
expect(subject[:gitlab_pages][:version]).to eq(Gitlab::Pages::VERSION)
expect(subject[:git][:version]).to eq(Gitlab::Git.version)
......@@ -591,32 +589,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(subject[:container_registry][:vendor]).to eq('gitlab')
expect(subject[:container_registry][:version]).to eq('x.y.z')
end
def stub_runtime(runtime)
allow(Gitlab::Runtime).to receive(:identify).and_return(runtime)
end
end
describe '.app_server_type' do
subject { described_class.app_server_type }
it 'successfully identifies runtime and returns the identifier' do
expect(Gitlab::Runtime).to receive(:identify).and_return(:runtime_identifier)
is_expected.to eq('runtime_identifier')
end
context 'when runtime is not identified' do
let(:exception) { Gitlab::Runtime::IdentificationError.new('exception message from runtime identify') }
it 'logs the exception and returns unknown app server type' do
expect(Gitlab::Runtime).to receive(:identify).and_raise(exception)
expect(Gitlab::AppLogger).to receive(:error).with(exception.message)
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(exception)
expect(subject).to eq('unknown_app_server_type')
end
end
end
describe '.object_store_config' do
......
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