Commit Graph

16 Commits

Author SHA1 Message Date
Ash McKenzie 31e419e945
Add new Feature.remove method 2019-08-01 08:29:14 +10:00
Thong Kuah f540ffcef6 Add frozen_string_literal to spec/lib (part 1)
Using the sed script from
https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-07-26 13:25:07 +12:00
Stan Hu 2db7c5762b Cache Flipper feature flags in L1 and L2 caches
In https://gitlab.com/gitlab-com/gl-infra/production/issues/928, we saw
a significant amount of network traffic and CPU usage due to Redis
checking feature flags via Flipper. Since these flags are hit with every
request, the overhead becomes significant. To alleviate Redis overhead,
we now cache the data in the following way:

* L1: A thread-local memory store for 1 minute
* L2: Redis for 1 hour
2019-07-03 16:22:50 -07:00
Stan Hu 385aa46046 Cache Flipper persisted names directly to local memory storage
Now that application settings are no longer dominating network traffic,
we see that the Feature#persisted_names is using a significant amount of
CPU and network bandwidth for Redis. Move this cache into the
thread-local memory storage to reduce Redis overhead.
2019-07-02 07:26:27 -07:00
Stan Hu 1b0c71ef84 Cache feature flag names in Redis for a minute
We saw on GitLab.com, the SQL query, `SELECT "features"."key" FROM
"features"` peaked at 2300 times per second.

We can quiet this down a bit by caching it in Redis for a minute.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63435
2019-06-18 13:59:18 -07:00
James Edwards-Jones 46f66c7f0a Allow setting feature flags per GitLab group
Building on support for setting feature flags by project, this adds
support for setting them by GitLab group path.

This is different from setting them by Flipper feature_groups, which
are for batch updating pre-registered collections.
2019-02-19 14:57:03 +08:00
Zeger-Jan van de Weg 5396594a83
Allow setting of feature gates per project
For features the feature gates are sometimes projects, not groups or
users. For example for git object pools:
https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/5872

This commit allows for setting feature group gates based on projects, by its
path as that seems most convenient.
2019-01-14 14:29:51 +01:00
Michael Kozono 74ae135888 Refactor Feature.flipper method
* Fix typo in context 'when request store is active'
* Rearrange test since the instance variable always gets set now,
even if RequestStore is active
2018-09-24 12:29:22 -07:00
Brett Walker 3aea946e7f add 'default_enabled' to feature flags
This allows you to default a feature flag to 'on' when
checking whether it's enabled/disabled.
2018-09-05 09:19:16 -05:00
Gabriel Mazetto 61c35b6ca1 Fixed `stub_feature_flag behavior` for `disabled?` flags.
Previous code would not work with `disabled?` because that method would
send two parameters (second always `nil`) which we are not mocking.

Instead of mock yet another state, I decide to fix it where it belongs.
2018-08-22 05:41:15 +02:00
Douglas Barbosa Alexandre 06e03f6e4d
Allow feature flag names to be a symbol 2018-07-19 21:05:24 -03:00
Rémy Coutable e1ffd6a271
Use RequestStore to memoize Flipper features so that memoized values are cleared between requests
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-06-01 17:51:40 +02:00
Yorick Peterse 90be53c5d3
Cache feature names in RequestStore
The GitHub importer (and probably other parts of our code) ends up
calling Feature.persisted? many times (via Gitaly). By storing this data
in RequestStore we can save ourselves _a lot_ of database queries.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/39361
2017-11-07 22:28:57 +01:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Alejandro Rodríguez 671284ba37 Add feature toggles through Flipper 2017-05-31 21:06:01 +00:00