diff --git a/internal/engine/eval_status.go b/internal/engine/eval_status.go index a3f6421d54..2cbaa1b053 100644 --- a/internal/engine/eval_status.go +++ b/internal/engine/eval_status.go @@ -201,7 +201,7 @@ func (e *executor) createOrUpdateEvalStatus( logger.Err(err).Msg("error upserting rule alert details") } - if flags.BoolFromProjectID(ctx, e.featureFlags, flags.EvalHistory, params.ProjectID) { + if flags.Bool(ctx, e.featureFlags, flags.EvalHistory, params.ProjectID.String()) { // Log in the evaluation history tables _, err = db.WithTransaction(e.querier, func(qtx db.ExtendQuerier) (uuid.UUID, error) { evalID, err := e.historyService.StoreEvaluationStatus( diff --git a/internal/flags/flags.go b/internal/flags/flags.go index a8836dea12..e104fe3ee5 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -19,7 +19,6 @@ package flags import ( "context" - "github.com/google/uuid" ofprovider "github.com/open-feature/go-sdk-contrib/providers/go-feature-flag/pkg" "github.com/open-feature/go-sdk/openfeature" "github.com/rs/zerolog" @@ -54,14 +53,11 @@ func BoolFromContext(ctx context.Context, client openfeature.IClient, feature Ex return getBool(ctx, client, feature, fromContext(ctx)) } -// BoolFromProjectID evaluates the feature flag with respect to the specified project ID. -// This is useful when evaluating feature flags outside a request context. -func BoolFromProjectID(ctx context.Context, client openfeature.IClient, feature Experiment, projectID uuid.UUID) bool { +// Bool evaluates the feature flag with respect to the specified target value. +func Bool(ctx context.Context, client openfeature.IClient, feature Experiment, target string) bool { ectx := openfeature.NewEvaluationContext( - projectID.String(), - map[string]interface{}{ - "project": projectID.String(), - }, + target, + map[string]any{}, ) return getBool(ctx, client, feature, ectx) }