Commit a92ea8ff authored by James Lopez's avatar James Lopez

Merge branch 'move-agg-metric-to-config' into 'master'

Move agg metric to config

See merge request gitlab-org/gitlab!57343
parents dfad880d 01bfcf0d
# Aggregated metrics that include EE only event names within `events:` attribute have to be defined at ee/lib/gitlab/usage_data_counters/aggregated_metrics/common.yml
# Aggregated metrics that include EE only event names within `events:` attribute have to be defined at ee/config/metrics/aggregates/common.yml
# instead of this file.
#- name: unique name of aggregated metric
# operator: aggregation operator. Valid values are:
......
......@@ -949,7 +949,7 @@ appear to be associated to any of the services running, because they all appear
WARNING:
This feature is intended solely for internal GitLab use.
To add data for aggregated metrics into Usage Ping payload you should add corresponding definition at [`lib/gitlab/usage_data_counters/aggregated_metrics/*.yaml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data_counters/aggregated_metrics/) for metrics available at Community Edition and at [`ee/lib/gitlab/usage_data_counters/aggregated_metrics/*.yaml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/gitlab/usage_data_counters/aggregated_metrics/) for Enterprise Edition ones.
To add data for aggregated metrics into Usage Ping payload you should add corresponding definition at [`config/metrics/aggregates/*.yaml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/aggregates/) for metrics available at Community Edition and at [`ee/config/metrics/aggregates/*.yaml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/aggregates/) for Enterprise Edition ones.
Each aggregate definition includes following parts:
......@@ -1111,7 +1111,7 @@ end
#### Add new aggregated metric definition
After all metrics are persisted, you can add an aggregated metric definition at
[`aggregated_metrics/`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data_counters/aggregated_metrics/).
[`aggregated_metrics/`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/aggregates/).
To declare the aggregate of metrics collected with [Estimated Batch Counters](#estimated-batch-counters),
you must fulfill the following requirements:
......
......@@ -11,7 +11,7 @@ module EE
override :paths
def paths
@ee_paths ||= [Rails.root.join('ee', 'config', 'metrics', '**', '*.yml')] + super
@ee_paths ||= [Rails.root.join('ee', 'config', 'metrics', '[^agg]*', '*.yml')] + super
end
end
end
......
......@@ -9,7 +9,7 @@ module EE
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
EE_AGGREGATED_METRICS_PATH = Rails.root.join('ee/lib/gitlab/usage_data_counters/aggregated_metrics/*.yml')
EE_AGGREGATED_METRICS_PATH = Rails.root.join('ee/config/metrics/aggregates/*.yml')
override :initialize
def initialize(recorded_at)
......
......@@ -56,7 +56,7 @@ module Gitlab
class << self
def paths
@paths ||= [Rails.root.join('config', 'metrics', '**', '*.yml')]
@paths ||= [Rails.root.join('config', 'metrics', '[^agg]*', '*.yml')]
end
def definitions(skip_validation: false)
......
......@@ -7,7 +7,7 @@ module Gitlab
UNION_OF_AGGREGATED_METRICS = 'OR'
INTERSECTION_OF_AGGREGATED_METRICS = 'AND'
ALLOWED_METRICS_AGGREGATIONS = [UNION_OF_AGGREGATED_METRICS, INTERSECTION_OF_AGGREGATED_METRICS].freeze
AGGREGATED_METRICS_PATH = Rails.root.join('lib/gitlab/usage_data_counters/aggregated_metrics/*.yml')
AGGREGATED_METRICS_PATH = Rails.root.join('config/metrics/aggregates/*.yml')
AggregatedMetricError = Class.new(StandardError)
UnknownAggregationOperator = Class.new(AggregatedMetricError)
UnknownAggregationSource = Class.new(AggregatedMetricError)
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
# If this spec fails, we need to add the new code review event to the correct aggregated metric
RSpec.describe 'Code review events' do
it 'the aggregated metrics contain all the code review metrics' do
path = Rails.root.join('lib/gitlab/usage_data_counters/aggregated_metrics/code_review.yml')
path = Rails.root.join('config/metrics/aggregates/code_review.yml')
aggregated_events = YAML.safe_load(File.read(path), aliases: true)&.map(&:with_indifferent_access)
code_review_aggregated_events = aggregated_events
......
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