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

feat(indexer): probabilistic feature flag #136

Merged
merged 2 commits into from
Dec 17, 2024
Merged

feat(indexer): probabilistic feature flag #136

merged 2 commits into from
Dec 17, 2024

Conversation

fforbeck
Copy link
Member

@fforbeck fforbeck commented Dec 17, 2024

Context

Implemented a new logic to determine whether the "indexing service" should be enabled for a given request.

  1. Query Parameter Check: The code checks if the request URL contains a query parameter ff with the value indexing-service. If this parameter is present, it indicates that the indexing service should be enabled for this request.

  2. Ramp-Up Probability: If the query parameter is absent, the code uses a probabilistic approach to decide whether to enable the indexing service. This is done using a "ramp-up probability," which represents the likelihood of enabling the service. The probability is defined by the environment variable FF_RAMP_UP_PROBABILITY. A default value of 0 (or 0%) is used if this variable is not set.

  3. Random Selection: The code uses Math.random() to generate a random number between 0 and 1. If this number is less than or equal to the ramp-up percentage, the indexing service is enabled.

Related Issues

@fforbeck fforbeck requested review from travis and Peeja December 17, 2024 13:39
@fforbeck fforbeck self-assigned this Dec 17, 2024
Copy link
Member

@Peeja Peeja left a comment

Choose a reason for hiding this comment

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

But What Are the Odds of That Happening?

LGTM, with one tweak.

src/middleware/withLocator.js Outdated Show resolved Hide resolved
@fforbeck fforbeck merged commit dca2b35 into main Dec 17, 2024
1 check passed
@fforbeck fforbeck deleted the feat/rampup-flag branch December 17, 2024 16:26
fforbeck pushed a commit that referenced this pull request Dec 19, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.22.0](v2.21.0...v2.22.0)
(2024-12-19)


### Features

* egress client - ucanto integration
([#123](#123))
([22bed68](22bed68))
* enable egress tracking in production env
([#135](#135))
([ad43b62](ad43b62))
* **indexer:** probabilistic feature flag
([#136](#136))
([dca2b35](dca2b35))
* ucan invocation handler
([#133](#133))
([b199bfa](b199bfa))
* Use Indexing Service when feature flag is present
([#132](#132))
([fa3f480](fa3f480))


### Bug Fixes

* **config:** staging kv bidding
([#134](#134))
([7a523d5](7a523d5))
* **egress-client:** set nonce, expire and fix servedAt
([#130](#130))
([b135643](b135643))
* enable open telemetry for all envs
([#131](#131))
([c822465](c822465))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants