akvo / akvo-lumen

Make sense of your data
https://akvo.org/akvo-lumen
GNU Affero General Public License v3.0
63 stars 18 forks source link

Add feature flag for Support Flow repeated question groups #2676

Closed tangrammer closed 4 years ago

tangrammer commented 4 years ago

Context

Relates #2127

https://github.com/akvo/akvo-lumen/commit/ecbb395947a2dcebfe60e7a857380ad563c7f981

The new columns created by RQGs should be invisible with no feature flag.

Once included in client-side we need to adapt backend to it.

iperdomo commented 4 years ago

In a pairing session with @valllllll2000 we checked the available options for making code changes behind a feature flag. There are several options:

Desired properties

We understand that the flag should be short-lived. We would like:

Feature flag as a Service

There are services like launchdarkly.com that solves all the problems related to features flags.

Pros:

Cons:

Query-string parameter

We can enable a different code-path by adding a query-string parameter, e.g. /?rqg=true. Some team members have experience with this.

Pros:

Cons:

Use a configuration per user in Auth0 via app_metadata

We have experience with this approach. Previous flags were attached to a user configuration.

Pros:

Cons:

Use a configuration map in config.edn

We configure the system with config.edn. We could add the configuration for one instance there.

Pros:

Cons:

Use a merged configuration in config.edn via k8s ConfigMap

This is a variation of the previous approach. Instead of having a fixed configuration in config.edn we could merge with with some other configuration exposed via a k8s ConfigMap.

Pros:

Cons:

Use a new table environment per tenant and expose those records in the /env endpoint

In this approach we add a new table to the tenant database environment (or env) and expose its content via the /env endpoint.

Pros:

Cons:

From the available list, I vote for the last one (new table env with configuration per instance).

dlebrero commented 4 years ago

The pro/cons of each option misses the granularity of the feature flag. The first option is per segment, the second "a la carte", third per user, last per instance.

For testing "a la carte" is awesome. Per segment can implement all of the above options.

The pro/cons should also include which options are reusable for Flow or other services.

I am not endorsing any particular option.

And now talking without understanding the details, but please be careful to not overdo feature flags. From the description above it seems that we want to feature flag the import process. I would argue that we do not need a feature flag for that. All users seeing a new column with a piece of json seems like little risk.

tangrammer commented 4 years ago

@valllllll2000 @iperdomo @dlebrero my only concern about using last approach Use a new table environment is that so far we don't connect to the db if user isn't authenticated and keycloak authorized. My feeling is that not connecting to DB without having a not-boot-user is good, but maybe I'm overestimating that 🤔

iperdomo commented 4 years ago

Thanks for the feedback

The pro/cons of each option misses the granularity of the feature flag. The first option is per segment, the second "a la carte", third per user, last per instance.

Who needs that now?

For testing "a la carte" is awesome. Per segment can implement all of the above options.

a la carte is awesome but we don't need it

The pro/cons should also include which options are reusable for Flow or other services.

Also not a requirement right now. Flow already uses its own way via System.properties.

I am not endorsing any particular option.

Thanks :+1:

And now talking without understanding the details, but please be careful to not overdo feature flags. From the description above it seems that we want to feature flag the import process. I would argue that we do not need a feature flag for that. All users seeing a new column with a piece of json seems like little risk.

That's why having a key -> value is the simplest way IMO.

iperdomo commented 4 years ago

my only concern about using last approach Use a new table environment is that so far we don't connect to the db if user isn't authenticated and keycloak authorized. My feeling is that not connecting to DB without having a not-boot-user is good, but maybe I'm overestimating tha

For my this is not a concern. If we want to optimize (for a reason I really don't understand) those DB calls, we can add a query parameter to include the dynamic part. By default _pre-authentication /env only respond with static config settings (IdP, piwik, etc). Post-authentication /env?dynamic=true or something similar that actual makes the DB and includes the environment: {} key.

janagombitova commented 4 years ago

@tangrammer and @iperdomo I believe we can close this issue. Is that correct or do you need to do something more related to the feature flag we have in place?

iperdomo commented 4 years ago

Nothing pending