Remove the billing_event_tracking feature flag

What does this MR do and why?

Removes the billing_event_tracking feature flag (type: development, default_enabled: false, introduced in 19.2 by !240688 (merged)).

Cause. Gitlab::BillingEvents::Client#record_usage returned early unless the flag was enabled or local persistence applied:

return unless Feature.enabled?(:billing_event_tracking, :instance) || local_persistence_enabled?

Local persistence only covers offline and legacy licences (!259911 (merged)). A self-managed instance on an online cloud licence hit neither branch, so every Secrets Manager billing event was dropped before it reached the collector. GitLab.com was unaffected only because the flag is enabled there through ChatOps.

Fix.

  • Drop the guard in lib/gitlab/billing_events/client.rb and delete config/feature_flags/development/billing_event_tracking.yml. The local-persistence path and the offline emission_enabled? check are unchanged.
  • Move the invalid-quantity warning into a small warn_invalid_quantity helper, so the remaining guard is a one-line return ... if. Without this, Cop/LineBreakAroundConditionalBlock flags the if that now directly follows the multi-line method signature. The behaviour is the same.
  • Remove the "flag disabled" contexts from the CE and EE client specs, and add an EE spec that an instance on an online cloud licence emits to the collector and does not persist locally.
  • Update billing_events_tracking.md, which still referred to the flag.

Scope / blast radius. Secrets Manager is the only caller of the billing client on master (SecretsReadEmitter, SecretsStoredEmitter). No extra queries or new code paths. Self-managed online instances now emit the same Snowplow billing event GitLab.com already emits.

Resolves https://gitlab.com/gitlab-org/gitlab/-/issues/632809

References

Needs groupanalytics instrumentation approval (flag owner, CE files). If they want to keep a kill switch for the collector, the fallback is converting it to an ops flag with default_enabled: true. Either way, it is on by default for 19.5.

After merge: /chatops gitlab run feature delete billing_event_tracking --dev --pre --staging --staging-ref --production

Screenshots or screen recordings

N/A, backend only.

How to set up and validate locally

  1. Use a GDK with an online cloud licence (bin/run cloud in the sandbox), with no override for billing_event_tracking.
  2. Trigger a CI secret read, or run the secrets stored-count worker.
  3. log/application_json.log shows BillingEvents: billing event tracked. Before this MR the client returned early and logged nothing.
  4. Air-gapped flow (bin/run offline): local DailyNamespaceAggregate rows are still written, and no collector attempt is made.

Specs

  • New: ee/spec/lib/ee/gitlab/billing_events/client_spec.rb – "with an online cloud licence emits the event and does not persist it locally". Fails without the fix: with the guard restored and the YAML gone, it raises Feature::InvalidFeatureFlagError.
  • Ran every non-feature spec that references the billing client: 163 examples, 0 failures.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

🤖 Generated with Claude Code

Edited by Dmytro Biryukov

Merge request reports

Loading
Loading