Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[featureflag]: use float to check for flag probability #1237

Merged
merged 20 commits into from
Dec 14, 2023
Merged

[featureflag]: use float to check for flag probability #1237

merged 20 commits into from
Dec 14, 2023

Conversation

puckpuck
Copy link
Contributor

@puckpuck puckpuck commented Nov 6, 2023

Changes

This adds the ability to do A/B testing with feature flags. Instead of storing the feature flag enabled as a boolean, it is now stored as a float. 0 = false. 1 = true. Everything between 0 and 1 will be used as a probability. If the flag has a value of 0.3, it will return true 30% of the time.

A new attribute called app.featureflag.raw_value is added to the feature flag spans containing the actual raw value for the flag as a float.

Merge Requirements

For new features contributions please make sure you have completed the following
essential items:

  • CHANGELOG.md updated to document new feature additions
  • Appropriate documentation updates in the docs

Maintainers will not merge until the above have been completed. If you're unsure
which docs need to be changed ping the
@open-telemetry/demo-approvers.

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>
@puckpuck puckpuck requested a review from a team as a code owner November 6, 2023 17:53
Signed-off-by: Pierre Tessier <pierre@pierretessier.com>
@joshleecreates
Copy link
Contributor

Works for me! Small tweaks that could be a follow up PR: Make the input a number field and add some help text for how to use it. It might also be nice to add a failure scenario flag that causes an error with 100% of requests so that this FF ratio is easy to verify — current scenarios are mostly sporadic.

@joshleecreates
Copy link
Contributor

@puckpuck to make migrations easier, maybe we want to just drop the ffs_postgres database at startup?

Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Nov 18, 2023
@puckpuck
Copy link
Contributor Author

Works for me! Small tweaks that could be a follow up PR: Make the input a number field and add some help text for how to use it. It might also be nice to add a failure scenario flag that causes an error with 100% of requests so that this FF ratio is easy to verify — current scenarios are mostly sporadic.

I've tried to do this, and maybe I'm missing something, but if using a number type input with Phoenix, the value needs to be an integer.

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>
@puckpuck puckpuck added documentation Improvements or additions to documentation and removed Stale labels Nov 21, 2023
@joshleecreates
Copy link
Contributor

joshleecreates commented Nov 21, 2023

Works for me! Small tweaks that could be a follow up PR: Make the input a number field and add some help text for how to use it. It might also be nice to add a failure scenario flag that causes an error with 100% of requests so that this FF ratio is easy to verify — current scenarios are mostly sporadic.

I've tried to do this, and maybe I'm missing something, but if using a number type input with Phoenix, the value needs to be an integer.

@puckpuck I added a PR to your repo that does a decimal number input with a number(2,1) column type

@julianocosta89
Copy link
Member

@puckpuck will you add @joshleecreates' PR into this one, or should we get this one merged?

@austinlparker
Copy link
Member

Where are we at with this PR?

@puckpuck
Copy link
Contributor Author

puckpuck commented Dec 3, 2023

This PR is ready now. I merged in the changes from @joshleecreates and made some edits to the help text. I checked what we have for existing docs, and anything about this feature would be net new, so I'm not sure we need to add anything there.

@joshleecreates
Copy link
Contributor

This PR is ready now. I merged in the changes from @joshleecreates and made some edits to the help text. I checked what we have for existing docs, and anything about this feature would be net new, so I'm not sure we need to add anything there.

I think you will want to change the SQL column to number(3,2) based on your changes to the input.

@julianocosta89
Copy link
Member

@puckpuck I'm not able to run the FeatureFlagService, I'm getting this error:

❯ docker logs feature-flag-service 
14:47:01.825 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:47:01.857 [info] create table featureflags
14:47:01.876 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:47:09.134 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:47:09.171 [info] create table featureflags
14:47:09.180 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:47:17.532 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:47:17.576 [info] create table featureflags
14:47:17.624 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:47:22.474 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:47:22.487 [info] create table featureflags
14:47:22.500 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:47:26.847 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:47:26.859 [info] create table featureflags
14:47:26.873 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:47:31.531 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:47:31.536 [info] create table featureflags
14:47:31.551 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:47:39.064 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:47:39.076 [info] create table featureflags
14:47:39.116 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:47:49.172 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:47:49.185 [info] create table featureflags
14:47:49.214 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:48:03.538 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:48:03.540 [info] create table featureflags
14:48:03.551 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:48:30.197 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:48:30.200 [info] create table featureflags
14:48:30.214 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.
14:49:23.502 [info] == Running 20220524172636 Featureflagservice.Repo.Migrations.CreateFeatureflags.change/0 forward
14:49:23.505 [info] create table featureflags
14:49:23.542 [info] create index featureflags_name_index
** (Ecto.ChangeError) value `false` for `Featureflagservice.FeatureFlags.FeatureFlag.enabled` in `insert` does not match type :float
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1019: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 3.14.2.2) maps.erl:233: :maps.fold_1/3
    (ecto 3.10.1) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.1) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    /app/lib/featureflagservice-1.4.0/priv/repo/migrations/20220524172636_create_featureflags.exs:19: Featureflagservice.Repo.Migrations.CreateFeatureflags.execute_up/0
    (ecto_sql 3.10.1) lib/ecto/migration/runner.ex:320: Ecto.Migration.Runner.log_and_execute_ddl/3
Database setup or migrations failed.

@puckpuck
Copy link
Contributor Author

puckpuck commented Dec 5, 2023

@julianocosta89 this may be because I originally did the migration incorrectly and @joshleecreates cleaned it up.

Could you remove the featureflag service and db, build from main then try again from this branch.

@julianocosta89
Copy link
Member

@puckpuck, I have just tried and the error persists 😢

If it's still the same error, then somehow your database is persisting. The error above is occurring on the first database migration, which after my commit should be unchanged. But because you've already run the migration that changes the column to a number, the seed queries in the migration are failing. I can confirm that these migrations work fine on a completely fresh install going from main -> latest commit on this branch (You can't go backwards without deleting the database).

@joshleecreates How?
I've tried it and couldn't make it work.
I've tried the following from a clean state:

  • Build main, change to this PR and build featureflagservice. ❌
  • Build this PR from a clean state. ❌

@joshleecreates
Copy link
Contributor

Given the problems with the migration, and what the database actually contains. What if we just started a few DB each time?

I think that makes a lot of sense and will definitely simplify any future schema changes.

@joshleecreates
Copy link
Contributor

@julianocosta89 I will test again this evening

Copy link
Member

@mviitane mviitane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same problem as @julianocosta89 even after first cleaning up my docker env with
docker system prune -a

I think the problem is that the file src/featureflagservice/priv/repo/migrations/20220524172636_create_featureflags.ex still contains booleans. I got this working with the following changes in that file:

  def change do
    create table(:featureflags) do
      add :name, :string
      add :description, :string
      add :enabled, :float, default: 0.0, null: 0.0

      timestamps()
    end

    create unique_index(:featureflags, [:name])

    execute(&execute_up/0, &execute_down/0)
  end

  defp execute_up do
    repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{
      name: "productCatalogFailure",
      description: "Fail product catalog service on a specific product",
      enabled: 0.0
    })

    repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{
      name: "recommendationCache",
      description: "Cache recommendations",
      enabled: 0.0
    })

    repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{
      name: "adServiceFailure",
      description: "Fail ad service requests sporadically",
      enabled: 0.0
    })

    repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{
      name: "cartServiceFailure",
      description: "Fail cart service requests sporadically",
      enabled: 0.0
    })
  end

@joshleecreates
Copy link
Contributor

@mviitane I submitted a fix here: https://github.com/puckpuck/opentelemetry-demo/pull/2

@puckpuck
Copy link
Contributor Author

Please try this version that no longer tries to migrate a database but instead does a clean setup of the database. This may require you to do a make stop or docker compose down before trying this branch.

@mviitane
Copy link
Member

mviitane commented Dec 13, 2023

We should get #1296 merged and included in this branch. Currently, this PR branch doesn't compile after docker system prune -a.

@austinlparker
Copy link
Member

Seems to still be some errors in the ff service --


2023-12-13 10:06:26 15:06:26.633 [info] crash: class=:error exception=:badarith stacktrace=[
2023-12-13 10:06:26   {:erlang, :*, [Decimal.new("0.0"), 100], []},
2023-12-13 10:06:26   {:ffs_service, :get_flag, 2, [file: 'src/ffs_service.erl', line: 42]},
2023-12-13 10:06:26   {:otel_tracer_default, :with_span, 5,
2023-12-13 10:06:26    [file: '/app/deps/opentelemetry/src/otel_tracer_default.erl', line: 47]},
2023-12-13 10:06:26   {:grpcbox_stream, :handle_unary, 3,
2023-12-13 10:06:26    [file: '/app/deps/grpcbox/src/grpcbox_stream.erl', line: 283]},
2023-12-13 10:06:26   {:lists, :foldl, 3, [file: 'lists.erl', line: 1267]},
2023-12-13 10:06:26   {:grpcbox_stream, :on_receive_data, 2,
2023-12-13 10:06:26    [file: '/app/deps/grpcbox/src/grpcbox_stream.erl', line: 227]},
2023-12-13 10:06:26   {:h2_stream, :open, 3,
2023-12-13 10:06:26    [file: '/app/deps/chatterbox/src/h2_stream.erl', line: 420]},
2023-12-13 10:06:26   {:gen_statem, :loop_state_callback, 11, [file: 'gen_statem.erl', line: 1166]}
2023-12-13 10:06:26 ]

@austinlparker
Copy link
Member

Looks like the problem is coming from the recommendation server

@joshleecreates
Copy link
Contributor

That looks like it's coming from the Erlang API, I can take a look tonight.

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>
@puckpuck
Copy link
Contributor Author

I just moved everything from decimal which is a particular struct type to a float which is a scalar type in erlang. Math works properly, and since we only care about 1/100th precision, anyhow this is fine.

Copy link
Member

@austinlparker austinlparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and working locally

@austinlparker austinlparker merged commit 430b4c9 into open-telemetry:main Dec 14, 2023
27 checks passed
@puckpuck puckpuck deleted the ffs.add-probability-based-flags branch December 14, 2023 13:38
basti1302 added a commit to dash0hq/opentelemetry-demo that referenced this pull request Jan 29, 2024
Also, propagate the change from bool to float introduced in
open-telemetry#1237
more consistently via proto definitions by differentiating between
the GetFlag operation (which evaluates the probabilty and therefore
returns a bool) and all other operations, which need to operate with
a float value/probability directly.
basti1302 added a commit to dash0hq/opentelemetry-demo that referenced this pull request Jan 29, 2024
Also:
* propagate the change from bool to float introduced in
  open-telemetry#1237
  more consistently via proto definitions by differentiating between
  the GetFlag operation (which evaluates the probabilty and therefore
  returns a bool) and all other operations, which need to operate with
  a float value/probability directly. To that end, the Flag grpc
  message has been split into two new types, FlagEvaluationResult
  and FlagDefinition.
* Rename the UpdateFlag operation to UpdateFlagProbability, as it
  actually only updates the enabled/probability value, but not the
  description or the name.
basti1302 added a commit to dash0hq/opentelemetry-demo that referenced this pull request Jan 29, 2024
Also:
* propagate the change from bool to float introduced in
  open-telemetry#1237
  more consistently via proto definitions by differentiating between
  the GetFlag operation (which evaluates the probabilty and therefore
  returns a bool) and all other operations, which need to operate with
  a float value/probability directly. To that end, the Flag grpc
  message has been split into two new types, FlagEvaluationResult
  and FlagDefinition.
* Rename the UpdateFlag operation to UpdateFlagProbability, as it
  actually only updates the enabled/probability value, but not the
  description or the name.
basti1302 added a commit to dash0hq/opentelemetry-demo that referenced this pull request Jan 30, 2024
Also:
* propagate the change from bool to float introduced in
  open-telemetry#1237
  more consistently via proto definitions by differentiating between
  the GetFlag operation (which evaluates the probabilty and therefore
  returns a bool) and all other operations, which need to operate with
  a float value/probability directly. To that end, the Flag grpc
  message has been split into two new types, FlagEvaluationResult
  and FlagDefinition.
* Rename the UpdateFlag operation to UpdateFlagProbability, as it
  actually only updates the enabled/probability value, but not the
  description or the name.
jmichalak9 pushed a commit to jmichalak9/opentelemetry-demo that referenced this pull request Mar 22, 2024
…y#1237)

* use float to check for flag probability

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

* use float to check for flag probability

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

* Update CHANGELOG.md

* Add help text for float feature flags; Make upgrades possible for postgres

* add description for feature flag value

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

* clean up help text

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

* return to single migration with decimal type

* use float instead of decimal

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

---------

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>
Co-authored-by: Austin Parker <austin@ap2.io>
Co-authored-by: Josh Lee <josh@joshuamlee.com>
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants