Commit 3309f47e authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents eb66d691 7928d956
---
name: ci_minutes_track_live_consumption
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59263
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329197
milestone: '13.12'
type: development
group: group::pipeline execution
default_enabled: false
---
name: usage_data_i_testing_group_code_coverage_visit_total
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51382
rollout_issue_url:
milestone: '13.8'
type: development
group: group::testing
default_enabled: true
# frozen_string_literal: true
class DropInt4ColumnForPushEventPayloads < Gitlab::Database::Migration[1.0]
enable_lock_retries!
def change
remove_column :push_event_payloads, :event_id_convert_to_bigint, :integer, null: false, default: 0
end
end
4f3a1dbf39f1955122f94616952bfe04836c43e97268035b2daec3bc16e55e66
\ No newline at end of file
......@@ -18446,7 +18446,6 @@ ALTER SEQUENCE protected_tags_id_seq OWNED BY protected_tags.id;
CREATE TABLE push_event_payloads (
commit_count bigint NOT NULL,
event_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
action smallint NOT NULL,
ref_type smallint NOT NULL,
commit_from bytea,
......@@ -133,7 +133,6 @@ The following metrics are available:
| `pipeline_graph_links_total` | Histogram | 13.9 | Number of links per graph | |
| `pipeline_graph_links_per_job_ratio` | Histogram | 13.9 | Ratio of links to job per graph | |
| `gitlab_ci_pipeline_security_orchestration_policy_processing_duration_seconds` | Histogram | 13.12 | Time in seconds it takes to process Security Policies in CI/CD pipeline | |
| `gitlab_ci_difference_live_vs_actual_minutes` | Histogram | 13.12 | Difference between CI minute consumption counted while jobs were running (live) vs when jobs are complete (actual). Used to enforce CI minute consumption limits on long running jobs. | `plan` |
| `gitlab_spamcheck_request_duration_seconds` | Histogram | 13.12 | The duration for requests between Rails and the anti-spam engine | |
| `service_desk_thank_you_email` | Counter | 14.0 | Total number of email responses to new service desk emails | |
| `service_desk_new_note_email` | Counter | 14.0 | Total number of email notifications on new service desk comment | |
......
<script>
import Api from '~/api';
import { s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import DownloadTestCoverage from './download_test_coverage.vue';
import TestCoverageSummary from './test_coverage_summary.vue';
import TestCoverageTable from './test_coverage_table.vue';
export const VISIT_EVENT_FEATURE_FLAG = 'usageDataITestingGroupCodeCoverageVisitTotal';
export const VISIT_EVENT_NAME = 'i_testing_group_code_coverage_visit_total';
export default {
......@@ -16,11 +14,8 @@ export default {
TestCoverageTable,
DownloadTestCoverage,
},
mixins: [glFeatureFlagsMixin()],
mounted() {
if (this.glFeatures[VISIT_EVENT_FEATURE_FLAG]) {
Api.trackRedisHllUserEvent(VISIT_EVENT_NAME);
}
Api.trackRedisHllUserEvent(VISIT_EVENT_NAME);
},
text: {
codeCoverageHeader: s__('RepositoriesAnalytics|Test Code Coverage'),
......
......@@ -5,9 +5,6 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl
before_action :load_group
before_action -> { authorize_view_by_action!(:read_group_repository_analytics) }
before_action only: [:show] do
push_frontend_feature_flag(:usage_data_i_testing_group_code_coverage_visit_total, @group, default_enabled: :yaml)
end
def show
Gitlab::Tracking.event(self.class.name, 'show', **pageview_tracker_params)
......
......@@ -14,7 +14,6 @@ module Iterations
def execute
raise ArgumentError, 'group argument is missing' unless group.present?
return Iterations::Cadence.none unless group.iteration_cadences_feature_flag_enabled?
items = Iterations::Cadence.all
items = by_id(items)
......
......@@ -31,7 +31,8 @@ module Resolvers
args[:id] = parse_id(id) if id.present?
cadences = ::Iterations::CadencesFinder.new(current_user, group, args).execute
cadences = ::Iterations::Cadence.none
cadences = ::Iterations::CadencesFinder.new(current_user, group, args).execute if group.iteration_cadences_feature_flag_enabled?
offset_pagination(cadences)
end
......
......@@ -73,9 +73,7 @@ module Ci
attr_reader :build
def validate_preconditions
if !feature_enabled?
ServiceResponse.error(message: 'Feature not enabled')
elsif !build.running?
if !build.running?
ServiceResponse.error(message: 'Build is not running')
elsif !build.cost_factor_enabled?
ServiceResponse.error(message: 'Cost factor not enabled for build')
......@@ -84,10 +82,6 @@ module Ci
end
end
def feature_enabled?
Feature.enabled?(:ci_minutes_track_live_consumption, build.project, default_enabled: :yaml)
end
def consumption_since_last_update
last_tracking = time_last_tracked_consumption!(Time.current.utc)
duration = Time.current.utc - last_tracking
......
......@@ -15,7 +15,6 @@ module Ci
return unless consumption > 0
update_minutes(consumption, build)
compare_with_live_consumption(build, consumption)
end
private
......@@ -24,23 +23,9 @@ module Ci
::Ci::Minutes::UpdateProjectAndNamespaceUsageWorker.perform_async(consumption, project.id, namespace.id, build.id)
end
def compare_with_live_consumption(build, consumption)
live_consumption = ::Ci::Minutes::TrackLiveConsumptionService.new(build).live_consumption
return if live_consumption == 0
difference = consumption.to_f - live_consumption.to_f
observe_ci_minutes_difference(difference, plan: namespace.actual_plan_name)
end
def namespace
project.shared_runners_limit_namespace
end
def observe_ci_minutes_difference(difference, plan:)
::Gitlab::Ci::Pipeline::Metrics
.gitlab_ci_difference_live_vs_actual_minutes
.observe({ plan: plan }, difference)
end
end
end
end
......@@ -34,16 +34,6 @@ RSpec.describe Iterations::CadencesFinder do
group.add_reporter(user)
end
context 'with feature flag disabled' do
before do
stub_feature_flags(iteration_cadences: false)
end
it 'returns no cadences' do
expect(subject).to be_empty
end
end
context 'iterations cadences for group' do
it 'returns iterations cadences' do
expect(subject).to contain_exactly(
......
......@@ -46,15 +46,5 @@ describe('Group repository analytics app', () => {
expect(Api.trackRedisHllUserEvent).toHaveBeenCalledWith(VISIT_EVENT_NAME);
});
});
describe('with the feature flag disabled', () => {
beforeEach(() => {
createComponent({ [VISIT_EVENT_FEATURE_FLAG]: false });
});
it('does not track a visit event on mount', () => {
expect(Api.trackRedisHllUserEvent).not.toHaveBeenCalled();
});
});
});
});
......@@ -139,14 +139,6 @@ RSpec.describe Ci::Minutes::TrackLiveConsumptionService do
it_behaves_like 'limit exceeded'
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(ci_minutes_track_live_consumption: false)
end
it_behaves_like 'returns early', 'Feature not enabled'
end
end
end
......
......@@ -47,13 +47,6 @@ RSpec.describe Ci::Minutes::UpdateBuildMinutesService do
expect { subject }.not_to change { Ci::Minutes::ProjectMonthlyUsage.count }
end
it 'does not observe the difference between actual vs live consumption' do
expect(::Gitlab::Ci::Pipeline::Metrics)
.not_to receive(:gitlab_ci_difference_live_vs_actual_minutes)
subject
end
it 'does not send an email' do
allow(Gitlab).to receive(:com?).and_return(true)
......@@ -200,27 +193,8 @@ RSpec.describe Ci::Minutes::UpdateBuildMinutesService do
build.update!(status: :success)
end
it 'observes the difference between actual vs live consumption' do
histogram = double(:histogram)
expect(::Gitlab::Ci::Pipeline::Metrics)
.to receive(:gitlab_ci_difference_live_vs_actual_minutes)
.and_return(histogram)
expect(histogram).to receive(:observe).with({ plan: 'free' }, 5 * cost_factor)
subject
end
it_behaves_like 'new tracking matches legacy tracking'
end
context 'when live tracking does not exist for the build' do
it 'does not observe the difference' do
expect(::Gitlab::Ci::Pipeline::Metrics).not_to receive(:gitlab_ci_difference_live_vs_actual_minutes)
subject
end
end
end
context 'for specific runner' do
......
......@@ -171,9 +171,9 @@ module API
mount ::API::DeployTokens
mount ::API::Deployments
mount ::API::Environments
mount ::API::ErrorTracking
mount ::API::ErrorTrackingClientKeys
mount ::API::ErrorTrackingCollector
mount ::API::ErrorTracking::ClientKeys
mount ::API::ErrorTracking::Collector
mount ::API::ErrorTracking::ProjectSettings
mount ::API::Events
mount ::API::FeatureFlags
mount ::API::FeatureFlagsUserLists
......
# frozen_string_literal: true
module API
class ErrorTrackingClientKeys < ::API::Base
class ErrorTracking::ClientKeys < ::API::Base
before { authenticate! }
feature_category :error_tracking
......
......@@ -4,7 +4,7 @@ module API
# This API is responsible for collecting error tracking information
# from sentry client. It allows us to use GitLab as an alternative to
# sentry backend. For more details see https://gitlab.com/gitlab-org/gitlab/-/issues/329596.
class ErrorTrackingCollector < ::API::Base
class ErrorTracking::Collector < ::API::Base
feature_category :error_tracking
content_type :envelope, 'application/x-sentry-envelope'
......
# frozen_string_literal: true
module API
class ErrorTracking < ::API::Base
class ErrorTracking::ProjectSettings < ::API::Base
before { authenticate! }
feature_category :error_tracking
......
......@@ -92,14 +92,6 @@ module Gitlab
Gitlab::Metrics.counter(name, comment)
end
def self.gitlab_ci_difference_live_vs_actual_minutes
name = :gitlab_ci_difference_live_vs_actual_minutes
comment = 'Comparison between CI minutes consumption from live tracking vs actual consumption'
labels = {}
buckets = [-120.0, -60.0, -30.0, -10.0, -5.0, -3.0, -1.0, 0.0, 1.0, 3.0, 5.0, 10.0, 30.0, 60.0, 120.0]
::Gitlab::Metrics.histogram(name, comment, labels, buckets)
end
end
end
end
......
......@@ -158,7 +158,6 @@
category: testing
redis_slot: testing
aggregation: weekly
feature_flag: usage_data_i_testing_group_code_coverage_visit_total
- name: i_testing_full_code_quality_report_total
category: testing
redis_slot: testing
......
# frozen_string_literal: true
require 'spec_helper'
require_migration!('drop_int4_column_for_push_event_payloads')
RSpec.describe DropInt4ColumnForPushEventPayloads do
let(:push_event_payloads) { table(:push_event_payloads) }
it 'correctly migrates up and down' do
reversible_migration do |migration|
migration.before -> {
expect(push_event_payloads.column_names).to include('event_id_convert_to_bigint')
}
migration.after -> {
push_event_payloads.reset_column_information
expect(push_event_payloads.column_names).not_to include('event_id_convert_to_bigint')
}
end
end
end
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe API::ErrorTrackingClientKeys do
RSpec.describe API::ErrorTracking::ClientKeys do
let_it_be(:guest) { create(:user) }
let_it_be(:maintainer) { create(:user) }
let_it_be(:setting) { create(:project_error_tracking_setting) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe API::ErrorTrackingCollector do
RSpec.describe API::ErrorTracking::Collector do
let_it_be(:project) { create(:project, :private) }
let_it_be(:setting) { create(:project_error_tracking_setting, :integrated, project: project) }
let_it_be(:client_key) { create(:error_tracking_client_key, project: project) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe API::ErrorTracking do
RSpec.describe API::ErrorTracking::ProjectSettings do
let_it_be(:user) { create(:user) }
let(:setting) { create(:project_error_tracking_setting) }
......
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