Commit 1c6aa98c authored by Peter Leitzen's avatar Peter Leitzen 👶

Merge branch...

Merge branch '66150-remove-dynamically-constructed-feature-flags-starting-with-prometheus_transaction_' into 'master'

Resolve "Remove dynamically constructed feature flags starting with `prometheus_transaction_`"

Closes #66150

See merge request gitlab-org/gitlab-ce!32395
parents 2ead328a f599862e
Pipeline #80455666 passed with stages
in 48 minutes and 29 seconds
---
title: Remove dynamically constructed feature flags starting with prometheus_transaction_
merge_request: 32395
author: Jacopo Beschi @jacopo-beschi
type: changed
......@@ -91,33 +91,6 @@ The following metrics can be controlled by feature flags:
|:---------------------------------------------------------------|:-------------------------------------------------------------------|
| `gitlab_method_call_duration_seconds` | `prometheus_metrics_method_instrumentation` |
| `gitlab_transaction_allocated_memory_bytes` | `prometheus_metrics_transaction_allocated_memory` |
| `gitlab_transaction_event_build_found_total` | `prometheus_transaction_event_build_found_total` |
| `gitlab_transaction_event_build_invalid_total` | `prometheus_transaction_event_build_invalid_total` |
| `gitlab_transaction_event_build_not_found_cached_total` | `prometheus_transaction_event_build_not_found_cached_total` |
| `gitlab_transaction_event_build_not_found_total` | `prometheus_transaction_event_build_not_found_total` |
| `gitlab_transaction_event_change_default_branch_total` | `prometheus_transaction_event_change_default_branch_total` |
| `gitlab_transaction_event_create_repository_total` | `prometheus_transaction_event_create_repository_total` |
| `gitlab_transaction_event_etag_caching_cache_hit_total` | `prometheus_transaction_event_etag_caching_cache_hit_total` |
| `gitlab_transaction_event_etag_caching_header_missing_total` | `prometheus_transaction_event_etag_caching_header_missing_total` |
| `gitlab_transaction_event_etag_caching_key_not_found_total` | `prometheus_transaction_event_etag_caching_key_not_found_total` |
| `gitlab_transaction_event_etag_caching_middleware_used_total` | `prometheus_transaction_event_etag_caching_middleware_used_total` |
| `gitlab_transaction_event_etag_caching_resource_changed_total` | `prometheus_transaction_event_etag_caching_resource_changed_total` |
| `gitlab_transaction_event_fork_repository_total` | `prometheus_transaction_event_fork_repository_total` |
| `gitlab_transaction_event_import_repository_total` | `prometheus_transaction_event_import_repository_total` |
| `gitlab_transaction_event_push_branch_total` | `prometheus_transaction_event_push_branch_total` |
| `gitlab_transaction_event_push_commit_total` | `prometheus_transaction_event_push_commit_total` |
| `gitlab_transaction_event_push_tag_total` | `prometheus_transaction_event_push_tag_total` |
| `gitlab_transaction_event_rails_exception_total` | `prometheus_transaction_event_rails_exception_total` |
| `gitlab_transaction_event_receive_email_total` | `prometheus_transaction_event_receive_email_total` |
| `gitlab_transaction_event_remote_mirrors_failed_total` | `prometheus_transaction_event_remote_mirrors_failed_total` |
| `gitlab_transaction_event_remote_mirrors_finished_total` | `prometheus_transaction_event_remote_mirrors_finished_total` |
| `gitlab_transaction_event_remote_mirrors_running_total` | `prometheus_transaction_event_remote_mirrors_running_total` |
| `gitlab_transaction_event_remove_branch_total` | `prometheus_transaction_event_remove_branch_total` |
| `gitlab_transaction_event_remove_repository_total` | `prometheus_transaction_event_remove_repository_total` |
| `gitlab_transaction_event_remove_tag_total` | `prometheus_transaction_event_remove_tag_total` |
| `gitlab_transaction_event_sidekiq_exception_total` | `prometheus_transaction_event_sidekiq_exception_total` |
| `gitlab_transaction_event_stuck_import_jobs_total` | `prometheus_transaction_event_stuck_import_jobs_total` |
| `gitlab_transaction_event_update_build_total` | `prometheus_transaction_event_update_build_total` |
| `gitlab_view_rendering_duration_seconds` | `prometheus_metrics_view_instrumentation` |
## Sidekiq Metrics available for Geo **(PREMIUM)**
......
......@@ -78,7 +78,7 @@ module Gitlab
# tags - A set of tags to attach to the event.
def add_event(event_name, tags = {})
filtered_tags = filter_tags(tags)
self.class.transaction_metric(event_name, :counter, prefix: 'event_', use_feature_flag: true, tags: filtered_tags).increment(filtered_tags.merge(labels))
self.class.transaction_metric(event_name, :counter, prefix: 'event_', tags: filtered_tags).increment(filtered_tags.merge(labels))
@metrics << Metric.new(EVENT_SERIES, { count: 1 }, filtered_tags.merge(event: event_name), :event)
end
......@@ -155,12 +155,11 @@ module Gitlab
with_feature :prometheus_metrics_transaction_allocated_memory
end
def self.transaction_metric(name, type, prefix: nil, use_feature_flag: false, tags: {})
def self.transaction_metric(name, type, prefix: nil, tags: {})
metric_name = "gitlab_transaction_#{prefix}#{name}_total".to_sym
fetch_metric(type, metric_name) do
docstring "Transaction #{prefix}#{name} #{type}"
base_labels tags.merge(BASE_LABELS)
with_feature "prometheus_transaction_#{prefix}#{name}_total".to_sym if use_feature_flag
if type == :gauge
multiprocess_mode :livesum
......
......@@ -204,17 +204,17 @@ describe Gitlab::Metrics::Transaction do
end
it 'allows tracking of custom tags' do
transaction.add_event(:meow, animal: 'cat')
transaction.add_event(:bau, animal: 'dog')
expect(metric.tags).to eq(event: :meow, animal: 'cat')
expect(metric.tags).to eq(event: :bau, animal: 'dog')
end
context 'with sensitive tags' do
before do
transaction.add_event(:meow, **sensitive_tags.merge(sane: 'yes'))
transaction.add_event(:baubau, **sensitive_tags.merge(sane: 'yes'))
end
it_behaves_like 'tag filter', event: :meow, sane: 'yes'
it_behaves_like 'tag filter', event: :baubau, sane: 'yes'
end
end
......
......@@ -253,11 +253,11 @@ describe Gitlab::Metrics::WebTransaction do
end
it 'allows tracking of custom tags' do
transaction.add_event(:meow, animal: 'cat')
transaction.add_event(:bau, animal: 'dog')
metric = transaction.metrics[0]
expect(metric.tags).to eq(event: :meow, animal: 'cat')
expect(metric.tags).to eq(event: :bau, animal: 'dog')
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