summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2019-09-03 10:55:04 +0200
committerJacopo <beschi.jacopo@gmail.com>2019-09-03 14:41:56 +0200
commit3e317d42f399a890c9d3d93910dac816e6e51223 (patch)
treeefc9b550950baf666c149b1dd68ae687d9fc6d62
parentf7e3693435307b56e4da8d8584c6af01459e4813 (diff)
downloadgitlab-ce-66150-remove-dynamically-constructed-feature-flags-starting-with-prometheus_transaction_.tar.gz
Remove feature flags starting with `prometheus_transaction_`66150-remove-dynamically-constructed-feature-flags-starting-with-prometheus_transaction_
Those feature flags were always enabled so we can remove them safely.
-rw-r--r--changelogs/unreleased/66150-remove-dynamically-constructed-feature-flags-starting-with-promethe.yml5
-rw-r--r--doc/administration/monitoring/prometheus/gitlab_metrics.md27
-rw-r--r--lib/gitlab/metrics/transaction.rb5
-rw-r--r--spec/lib/gitlab/metrics/transaction_spec.rb8
-rw-r--r--spec/lib/gitlab/metrics/web_transaction_spec.rb4
5 files changed, 13 insertions, 36 deletions
diff --git a/changelogs/unreleased/66150-remove-dynamically-constructed-feature-flags-starting-with-promethe.yml b/changelogs/unreleased/66150-remove-dynamically-constructed-feature-flags-starting-with-promethe.yml
new file mode 100644
index 00000000000..e6dc1f1bec6
--- /dev/null
+++ b/changelogs/unreleased/66150-remove-dynamically-constructed-feature-flags-starting-with-promethe.yml
@@ -0,0 +1,5 @@
+---
+title: Remove dynamically constructed feature flags starting with prometheus_transaction_
+merge_request: 32395
+author: Jacopo Beschi @jacopo-beschi
+type: changed
diff --git a/doc/administration/monitoring/prometheus/gitlab_metrics.md b/doc/administration/monitoring/prometheus/gitlab_metrics.md
index ca48326c6d0..6dbfd5404d0 100644
--- a/doc/administration/monitoring/prometheus/gitlab_metrics.md
+++ b/doc/administration/monitoring/prometheus/gitlab_metrics.md
@@ -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)**
diff --git a/lib/gitlab/metrics/transaction.rb b/lib/gitlab/metrics/transaction.rb
index d7986685c65..067133949be 100644
--- a/lib/gitlab/metrics/transaction.rb
+++ b/lib/gitlab/metrics/transaction.rb
@@ -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
diff --git a/spec/lib/gitlab/metrics/transaction_spec.rb b/spec/lib/gitlab/metrics/transaction_spec.rb
index e70fde09edd..45e74597a2e 100644
--- a/spec/lib/gitlab/metrics/transaction_spec.rb
+++ b/spec/lib/gitlab/metrics/transaction_spec.rb
@@ -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
diff --git a/spec/lib/gitlab/metrics/web_transaction_spec.rb b/spec/lib/gitlab/metrics/web_transaction_spec.rb
index 2b35f07cc0d..21a762dbf25 100644
--- a/spec/lib/gitlab/metrics/web_transaction_spec.rb
+++ b/spec/lib/gitlab/metrics/web_transaction_spec.rb
@@ -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