Commit d35d6846 authored by Alina Mihaila's avatar Alina Mihaila Committed by Alper Akgun

Redirect metrics_dictionary.md to new dictionary

parent 8314833c
......@@ -23,7 +23,6 @@ matching_changed_files = product_intelligence.matching_changed_files
return unless matching_changed_files.any?
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files))
fail format(UPDATE_DICTIONARY_MESSAGE) if product_intelligence.need_dictionary_changes?
labels = product_intelligence.missing_labels
return unless labels.any?
......
......@@ -13,7 +13,7 @@ The Service Data API is associated with [Service Ping](../development/service_pi
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57270) in GitLab 13.11.
Export all metric definitions as a single YAML file, similar to the [Metrics Dictionary](../development/service_ping/dictionary.md), for easier importing.
Export all metric definitions as a single YAML file, similar to the [Metrics Dictionary](https://gitlab-org.gitlab.io/growth/product-intelligence/metric-dictionary), for easier importing.
```plaintext
GET /usage_data/metric_definitions
......
This diff is collapsed.
......@@ -340,8 +340,6 @@ To deprecate a metric:
end
```
1. Update the Metrics Dictionary following [guidelines instructions](dictionary.md).
### 4. Remove a metric
Only deprecated metrics can be removed from Service Ping.
......@@ -394,8 +392,6 @@ To remove a deprecated metric:
- The feature flag YAML file at [`config/feature_flags/*/*.yaml`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/config/feature_flags).
- The entry in the known events YAML file at [`lib/gitlab/usage_data_counters/known_events/*.yaml`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/lib/gitlab/usage_data_counters/known_events).
1. Update the Metrics Dictionary following [guidelines instructions](dictionary.md).
## Implementing Service Ping
Service Ping consists of two kinds of data, counters and observations. Counters track how often a certain event
......@@ -1124,8 +1120,6 @@ We also use `#database-lab` and [explain.depesz.com](https://explain.depesz.com/
[Check Metrics Dictionary Guide](metrics_dictionary.md)
When adding, updating, or removing metrics, please update the [Metrics Dictionary](dictionary.md).
### 6. Add new metric to Versions Application
Check if new metrics need to be added to the Versions Application. See `usage_data` [schema](https://gitlab.com/gitlab-services/version-gitlab-com/-/blob/master/db/schema.rb#L147) and Service Data [parameters accepted](https://gitlab.com/gitlab-services/version-gitlab-com/-/blob/master/app/services/usage_ping.rb). Any metrics added under the `counts` key are saved in the `stats` column.
......
......@@ -14,7 +14,7 @@ general best practices for code reviews, refer to our [code review guide](../cod
## Resources for reviewers
- [Service Ping Guide](index.md)
- [Metrics Dictionary](metrics_dictionary.md)
- [Metrics Dictionary](https://gitlab-org.gitlab.io/growth/product-intelligence/metric-dictionary)
## Review process
......@@ -25,7 +25,6 @@ any of the following Service Ping files:
- The Metrics Dictionary, including files in:
- [`config/metrics`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/config/metrics).
- [`ee/config/metrics`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/ee/config/metrics).
- [`dictionary.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/service_ping/dictionary.md).
- [`schema.json`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/schema.json).
- Product Intelligence tooling. For example,
[`Gitlab::UsageMetricDefinitionGenerator`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/generators/gitlab/usage_metric_definition_generator.rb)
......@@ -47,8 +46,6 @@ are regular backend changes.
- Set the correct attributes in the metric's YAML definition:
- `product_section`, `product_stage`, `product_group`, `product_category`
- Provide a clear description of the metric.
- Update the
[Metrics Dictionary](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/service_ping/dictionary.md) if needed.
- Add a changelog [according to guidelines](../changelog.md).
#### The Product Intelligence **reviewer** should
......
......@@ -24,12 +24,6 @@ namespace :gitlab do
puts Gitlab::Json.pretty_generate(result.attributes)
end
desc 'GitLab | UsageData | Generate metrics dictionary'
task generate_metrics_dictionary: :environment do
items = Gitlab::Usage::MetricDefinition.definitions
Gitlab::Usage::Docs::Renderer.new(items).write
end
desc 'GitLab | UsageDataMetrics | Generate usage ping from metrics definition YAML files in JSON'
task generate_from_yaml: :environment do
puts Gitlab::Json.pretty_generate(Gitlab::UsageDataMetrics.uncached_data)
......
......@@ -12,7 +12,7 @@ RSpec.describe Tooling::Danger::ProductIntelligence do
subject(:product_intelligence) { fake_danger.new(helper: fake_helper) }
let(:fake_danger) { DangerSpecHelper.fake_danger.include(described_class) }
let(:changed_files) { ['metrics/counts_7d/test_metric.yml', 'doc/development/usage_ping/dictionary.md'] }
let(:changed_files) { ['metrics/counts_7d/test_metric.yml'] }
let(:changed_lines) { ['+tier: ee'] }
before do
......@@ -20,22 +20,6 @@ RSpec.describe Tooling::Danger::ProductIntelligence do
allow(fake_helper).to receive(:changed_lines).and_return(changed_lines)
end
describe '#need_dictionary_changes?' do
subject { product_intelligence.need_dictionary_changes? }
context 'when changed files do not contain dictionary changes' do
let(:changed_files) { ['config/metrics/counts_7d/test_metric.yml'] }
it { is_expected.to be true }
end
context 'when changed files already contains dictionary changes' do
let(:changed_files) { ['doc/development/usage_ping/dictionary.md'] }
it { is_expected.to be false }
end
end
describe '#missing_labels' do
subject { product_intelligence.missing_labels }
......@@ -109,10 +93,6 @@ RSpec.describe Tooling::Danger::ProductIntelligence do
end
end
context 'with dictionary file not changed' do
it { is_expected.to be_empty }
end
context 'with metrics files changed' do
let(:changed_files) { ['config/metrics/counts_7d/test_metric.yml', 'ee/config/metrics/counts_7d/ee_metric.yml'] }
......
......@@ -43,11 +43,7 @@ module Tooling
tracking_changed_files = all_changed_files & TRACKING_FILES
usage_data_changed_files = all_changed_files.grep(%r{(usage_data)})
usage_data_changed_files + tracking_changed_files + metrics_changed_files + dictionary_changed_file + snowplow_changed_files
end
def need_dictionary_changes?
required_dictionary_update_changed_files.any? && dictionary_changed_file.empty?
usage_data_changed_files + tracking_changed_files + metrics_changed_files + snowplow_changed_files
end
private
......@@ -56,10 +52,6 @@ module Tooling
helper.all_changed_files
end
def dictionary_changed_file
all_changed_files.grep(%r{(doc/development/service_ping/dictionary\.md)})
end
def metrics_changed_files
all_changed_files.grep(%r{((ee/)?config/metrics/.*\.yml)})
end
......@@ -84,22 +76,6 @@ module Tooling
matching_files?(file, extension: '.haml', pattern: %r{data: \{ track})
end
end
def required_dictionary_update_changed_files
dictionary_pattern = Regexp.union(
'key_path:',
'description:',
'product_section:',
'product_stage:',
'product_group:',
'status:',
'tier:'
)
metrics_changed_files.select do |file|
matching_files?(file, extension: '.yml', pattern: dictionary_pattern)
end
end
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