Commit ff900fe6 authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak Committed by alinamihaila

Add Collected Data Categories Service Ping metric

With metrics categorization being enrolled, we need to pass information
about which categories was included in given period, in order to
properly process it in downsteam systems.

Changelog: added
parent 5e46f8c1
{
"type": "array",
"items": {
"type": ["string", "null"],
"enum": ["Standard", "Subscription", "Operational", "Optional"]
}
}
---
key_path: settings.collected_data_categories
name: collected_data_categories
description: List of collected data categories corresponding to instance settings
product_section: growth
product_stage: growth
product_group: group::product intelligence
product_category: collection
value_type: object
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65336
time_frame: none
data_source: system
data_category: Standard
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
value_json_schema: 'config/metrics/objects_schemas/collected_data_categories_schema.json'
......@@ -18316,6 +18316,22 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `settings.collected_data_categories`
List of collected data categories corresponding to instance settings
[Object JSON schema](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/objects_schemas/collected_data_categories_schema.json)
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/settings/20210702140138_collected_data_categories.yml)
Group: `group::product intelligence`
Data Category: `Standard`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `settings.gitaly_apdex`
Gitaly application performance
......
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class CollectedDataCategoriesMetric < GenericMetric
def value
::ServicePing::PermitDataCategoriesService.new.execute
end
end
end
end
end
end
......@@ -256,7 +256,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 },
gitaly_apdex: alt_usage_data { gitaly_apdex }
gitaly_apdex: alt_usage_data { gitaly_apdex },
collected_data_categories: alt_usage_data(fallback: []) { Gitlab::Usage::Metrics::Instrumentations::CollectedDataCategoriesMetric.new(time_frame: 'none').value }
}
}
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CollectedDataCategoriesMetric do
it_behaves_like 'a correct instrumented metric value', {} do
let(:expected_value) { %w[Standard Subscription Operational Optional] }
before do
allow_next_instance_of(ServicePing::PermitDataCategoriesService) do |instance|
expect(instance).to receive(:execute).and_return(expected_value)
end
end
end
end
......@@ -1078,6 +1078,16 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
it 'gathers gitaly apdex', :aggregate_failures do
expect(subject[:settings][:gitaly_apdex]).to be_within(0.001).of(0.95)
end
it 'reports collected data categories' do
expected_value = %w[Standard Subscription Operational Optional]
allow_next_instance_of(ServicePing::PermitDataCategoriesService) do |instance|
expect(instance).to receive(:execute).and_return(expected_value)
end
expect(subject[:settings][:collected_data_categories]).to eq(expected_value)
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