Skip to content

feat(api): add isolated API instances#591

Open
marcozabel wants to merge 11 commits intoopen-feature:mainfrom
marcozabel:feat/isolated-api-instances-clean
Open

feat(api): add isolated API instances#591
marcozabel wants to merge 11 commits intoopen-feature:mainfrom
marcozabel:feat/isolated-api-instances-clean

Conversation

@marcozabel
Copy link
Copy Markdown

@marcozabel marcozabel commented Apr 15, 2026

This PR introduces support for creating isolated OpenFeature API instances, each with their own providers, hooks, context, and event handling - enabling multi-tenant or side-by-side usage without shared global state.

Fixes #584

@marcozabel marcozabel requested review from a team as code owners April 15, 2026 14:48
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 97.85523% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.25%. Comparing base (7d9229f) to head (ffcbf36).

Files with missing lines Patch % Lines
openfeature/_event_support.py 85.71% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #591      +/-   ##
==========================================
- Coverage   98.33%   98.25%   -0.09%     
==========================================
  Files          45       48       +3     
  Lines        2157     2458     +301     
==========================================
+ Hits         2121     2415     +294     
- Misses         36       43       +7     
Flag Coverage Δ
unittests 98.25% <97.85%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces isolated OpenFeature API instances, enabling multiple independent configurations within a single application as per specification requirement 1.8. The core logic refactors global state into an OpenFeatureAPI class, with the existing global singleton now delegating to a default instance to maintain backward compatibility. Key changes include the introduction of an EventSupport class, updates to the OpenFeatureClient to reference specific API instances, and the addition of a new openfeature.isolated module. Review feedback recommends improving encapsulation by adding public methods to OpenFeatureAPI for retrieving providers and their status, rather than having the client access protected registry attributes directly.

Comment thread openfeature/_api.py Outdated
Comment thread openfeature/client.py Outdated
@marcozabel marcozabel force-pushed the feat/isolated-api-instances-clean branch from a277973 to 904a42a Compare April 15, 2026 15:08
@marcozabel marcozabel changed the title test(isolated): add tests for isolated API instances feat(api): add isolated API instances Apr 15, 2026
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
…nd context getter

Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
…r-instance storage

Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
@marcozabel marcozabel force-pushed the feat/isolated-api-instances-clean branch from 904a42a to 97798e3 Compare April 15, 2026 15:22
marcozabel and others added 3 commits April 16, 2026 14:23
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Marco Zabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.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.

Support isolated API instances

1 participant