You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| ✅ |[Providers](#providers)| Integrate with a commercial, open source, or in-house feature management tool. |
105
-
| ✅ |[Targeting](#targeting)| Contextually-aware flag evaluation using [evaluation context](https://openfeature.dev/docs/reference/concepts/evaluation-context). |
106
-
| ✅ |[Hooks](#hooks)| Add functionality to various stages of the flag evaluation life-cycle. |
107
-
| ✅ |[Logging](#logging)| Integrate with popular logging packages. |
108
-
| ✅ |[Domains](#domains)| Logically bind clients with providers. |
109
-
| ✅ |[Eventing](#eventing)| React to state changes in the provider or flag management system. |
110
-
| ✅ |[Shutdown](#shutdown)| Gracefully clean up a provider during application shutdown. |
111
-
| ✅ |[Extending](#extending)| Extend OpenFeature with custom providers and hooks. |
| ✅ |[Providers](#providers)| Integrate with a commercial, open source, or in-house feature management tool. |
105
+
| ✅ |[Targeting](#targeting)| Contextually-aware flag evaluation using [evaluation context](https://openfeature.dev/docs/reference/concepts/evaluation-context). |
106
+
| ✅ |[Hooks](#hooks)| Add functionality to various stages of the flag evaluation life-cycle. |
107
+
| ✅ |[Logging](#logging)| Integrate with popular logging packages. |
108
+
| ✅ |[Domains](#domains)| Logically bind clients with providers. |
109
+
| ✅ |[Eventing](#eventing)| React to state changes in the provider or flag management system. |
110
+
| ✅ |[Shutdown](#shutdown)| Gracefully clean up a provider during application shutdown. |
111
+
| ✅ |[Transaction Context Propagation](#transaction-context-propagation)| Set a specific [evaluation context](/docs/reference/concepts/evaluation-context) for a transaction (e.g. an HTTP request or a thread) |
112
+
| ✅ |[Extending](#extending)| Extend OpenFeature with custom providers and hooks. |
112
113
113
114
<sub>Implemented: ✅ | In-progress: ⚠️ | Not implemented yet: ❌</sub>
Transaction context is a container for transaction-specific evaluation context (e.g. user id, user agent, IP).
242
+
Transaction context can be set where specific data is available (e.g. an auth service or request handler) and by using the transaction context propagator it will automatically be applied to all flag evaluations within a transaction (e.g. a request or thread).
243
+
244
+
You can implement a different transaction context propagator by implementing the `TransactionContextPropagator` class exported by the OpenFeature SDK.
245
+
In most cases you can use `ContextVarsTransactionContextPropagator` as it works for `threads` and `asyncio` using [Context Variables](https://peps.python.org/pep-0567/).
246
+
247
+
The following example shows a **multithreaded** Flask application using transaction context propagation to propagate the request ip and user id into request scoped transaction context.
248
+
249
+
```python
250
+
from flask import Flask, request
251
+
from openfeature import api
252
+
from openfeature.evaluation_context import EvaluationContext
253
+
from openfeature.transaction_context import ContextVarsTransactionContextPropagator
# Example route where we use the transaction context
314
+
@app.get('/greeting')
315
+
asyncdefsome_endpoint():
316
+
return create_response()
317
+
```
318
+
238
319
### Shutdown
239
320
240
321
The OpenFeature API provides a shutdown function to perform a cleanup of all registered providers. This should only be called when your application is in the process of shutting down.
0 commit comments