Skip to content

Improve logging on feature flag modification

Shinya Maeda requested to merge improve-feature-flag-logging into master

What does this MR do?

This MR improves the feature flag logging, for example, when users/develoeprs/chatops executed the following commands:

Feature.enable(:cd_auto_rollback)
Feature.disable(:cd_auto_rollback)
Feature.enable(:cd_auto_rollback, Project.first)
Feature.disable(:cd_auto_rollback, Project.first)
Feature.enable_percentage_of_time(:cd_auto_rollback, 50)
Feature.disable_percentage_of_time(:cd_auto_rollback)
Feature.enable_percentage_of_actors(:cd_auto_rollback, 50)
Feature.disable_percentage_of_actors(:cd_auto_rollback)
Feature.remove(:cd_auto_rollback)

These actions are logged as:

{"severity":"INFO","time":"2020-11-24T02:31:29.108Z","correlation_id":null,"key":"cd_auto_rollback","action":"enable","extra.thing":"true"}
{"severity":"INFO","time":"2020-11-24T02:31:29.129Z","correlation_id":null,"key":"cd_auto_rollback","action":"disable","extra.thing":"false"}
{"severity":"INFO","time":"2020-11-24T02:31:29.177Z","correlation_id":null,"key":"cd_auto_rollback","action":"enable","extra.thing":"Project:1"}
{"severity":"INFO","time":"2020-11-24T02:31:29.183Z","correlation_id":null,"key":"cd_auto_rollback","action":"disable","extra.thing":"Project:1"}
{"severity":"INFO","time":"2020-11-24T02:31:29.188Z","correlation_id":null,"key":"cd_auto_rollback","action":"enable_percentage_of_time","extra.percentage":"50"}
{"severity":"INFO","time":"2020-11-24T02:31:29.193Z","correlation_id":null,"key":"cd_auto_rollback","action":"disable_percentage_of_time"}
{"severity":"INFO","time":"2020-11-24T02:31:29.198Z","correlation_id":null,"key":"cd_auto_rollback","action":"enable_percentage_of_actors","extra.percentage":"50"}
{"severity":"INFO","time":"2020-11-24T02:31:29.203Z","correlation_id":null,"key":"cd_auto_rollback","action":"disable_percentage_of_actors"}
{"severity":"INFO","time":"2020-11-24T02:31:29.329Z","correlation_id":null,"key":"cd_auto_rollback","action":"remove"}

NOTE: the correlation_id doesn't exist because I performed the process in rails console.

This is a complement for the current feature flag logging system that we can track the feature flag activity on any instances with any automators in addition to chatops.

This MR also drops enable_group and disable_group that were introduced 3 years ago when we integrated Flipper into GitLab-Rails, but never been used until today. We should remove redundant interfaces to reduce the complexity.

Related #276170

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda

Merge request reports