Skip to content
Snippets Groups Projects
Commit 07b6b184 authored by Piotr Skorupa's avatar Piotr Skorupa
Browse files

Remove internal_events_for_product_analytics FF

This removes `internal_events_for_product_analytics` feature flag,
and keeps the new code, because the changes have been stable for
several months now.

Changelog: added
parent fa08c704
No related branches found
No related tags found
2 merge requests!158455Backport Release Environments notification pipeline change to 16.11,!149280Remove internal_events_for_product_analytics feature flag
Pipeline #1249313563 passed
Pipeline: GitLab

#1249326291

    Pipeline: GitLab

    #1249323317

      Pipeline: GitLab

      #1249323314

        ---
        name: internal_events_for_product_analytics
        introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136154
        rollout_issue_url:
        milestone: '16.7'
        type: development
        group: group::analytics instrumentation
        default_enabled: false
        ......@@ -34,10 +34,7 @@ def track_event(
        update_unique_counters(event_name, kwargs)
        trigger_snowplow_event(event_name, category, additional_properties, kwargs) if send_snowplow_event
        if Feature.enabled?(:internal_events_for_product_analytics) && send_snowplow_event
        send_application_instrumentation_event(event_name, additional_properties, kwargs)
        end
        send_application_instrumentation_event(event_name, additional_properties, kwargs) if send_snowplow_event
        rescue StandardError => e
        extra = {}
        kwargs.each_key do |k|
        ......
        ......@@ -397,6 +397,10 @@ def validate_service_ping_context(service_ping_context)
        stub_env('GITLAB_ANALYTICS_ID', app_id)
        stub_env('GITLAB_ANALYTICS_URL', url)
        allow(GitlabSDK::Client)
        .to receive(:new)
        .with(app_id: app_id, host: url, buffer_size: described_class::SNOWPLOW_EMITTER_BUFFER_SIZE)
        .and_return(sdk_client)
        end
        subject(:track_event) do
        ......@@ -411,75 +415,53 @@ def validate_service_ping_context(service_ping_context)
        end
        end
        context 'when internal_events_for_product_analytics FF is enabled' do
        before do
        stub_feature_flags(internal_events_for_product_analytics: true)
        it 'calls Product Analytics Ruby SDK', :aggregate_failures do
        expect(sdk_client).to receive(:identify).with(user.id)
        expect(sdk_client).to receive(:track)
        .with(event_name, { project_id: project.id, namespace_id: project.namespace.id })
        allow(GitlabSDK::Client)
        .to receive(:new)
        .with(app_id: app_id, host: url, buffer_size: described_class::SNOWPLOW_EMITTER_BUFFER_SIZE)
        .and_return(sdk_client)
        end
        it 'calls Product Analytics Ruby SDK', :aggregate_failures do
        expect(sdk_client).to receive(:identify).with(user.id)
        expect(sdk_client).to receive(:track)
        .with(event_name, { project_id: project.id, namespace_id: project.namespace.id })
        track_event
        end
        track_event
        context 'when additional properties are passed' do
        let(:additional_properties) do
        {
        label: 'label_name',
        property: 'property_name',
        value: 16.17
        }
        end
        context 'when additional properties are passed' do
        let(:additional_properties) do
        {
        label: 'label_name',
        property: 'property_name',
        value: 16.17
        }
        end
        let(:tracked_attributes) do
        {
        project_id: project.id,
        namespace_id: project.namespace.id,
        additional_properties: additional_properties
        }
        end
        it 'passes additional_properties to Product Analytics Ruby SDK', :aggregate_failures do
        expect(sdk_client).to receive(:identify).with(user.id)
        expect(sdk_client).to receive(:track).with(event_name, tracked_attributes)
        track_event
        end
        let(:tracked_attributes) do
        {
        project_id: project.id,
        namespace_id: project.namespace.id,
        additional_properties: additional_properties
        }
        end
        context 'when GITLAB_ANALYTICS_ID is nil' do
        let(:app_id) { nil }
        it 'passes additional_properties to Product Analytics Ruby SDK', :aggregate_failures do
        expect(sdk_client).to receive(:identify).with(user.id)
        expect(sdk_client).to receive(:track).with(event_name, tracked_attributes)
        it_behaves_like 'does not send a Product Analytics event'
        track_event
        end
        end
        context 'when GITLAB_ANALYTICS_URL is nil' do
        let(:url) { nil }
        context 'when GITLAB_ANALYTICS_ID is nil' do
        let(:app_id) { nil }
        it_behaves_like 'does not send a Product Analytics event'
        end
        it_behaves_like 'does not send a Product Analytics event'
        end
        context 'when send_snowplow_event is false' do
        let(:send_snowplow_event) { false }
        context 'when GITLAB_ANALYTICS_URL is nil' do
        let(:url) { nil }
        it_behaves_like 'does not send a Product Analytics event'
        end
        it_behaves_like 'does not send a Product Analytics event'
        end
        context 'when internal_events_for_product_analytics FF is disabled' do
        let(:app_id) { 'foobar' }
        let(:url) { 'http://localhost:4000' }
        before do
        stub_feature_flags(internal_events_for_product_analytics: false)
        end
        context 'when send_snowplow_event is false' do
        let(:send_snowplow_event) { false }
        it_behaves_like 'does not send a Product Analytics event'
        end
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment