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. |
102
102
| ✅ |[Targeting](#targeting)| Contextually-aware flag evaluation using [evaluation context](https://openfeature.dev/docs/reference/concepts/evaluation-context). |
103
-
|⚠️|[Hooks](#hooks)| Add functionality to various stages of the flag evaluation life-cycle. |
103
+
|✅|[Hooks](#hooks)| Add functionality to various stages of the flag evaluation life-cycle. |
104
104
| ❌ |[Logging](#logging)| Integrate with popular logging packages. |
105
105
| ✅ |[Domains](#domains)| Logically bind clients with providers. |
106
106
| ✅ |[Eventing](#eventing)| React to state changes in the provider or flag management system. |
107
-
| ⚠️ |[Shutdown](#shutdown)| Gracefully clean up a provider during application shutdown. |
107
+
| ✅ |[Shutdown](#shutdown)| Gracefully clean up a provider during application shutdown. |
108
+
| ✅ |[Tracking](#tracking)| Associate user actions with feature flag evaluations for experimentation. |
108
109
| ❌ |[Transaction Context Propagation](#transaction-context-propagation)| Set a specific [evaluation context](https://openfeature.dev/docs/reference/concepts/evaluation-context) for a transaction (e.g. an HTTP request or a thread) |
109
-
|⚠️|[Extending](#extending)| Extend OpenFeature with custom providers and hooks. |
110
+
|✅|[Extending](#extending)| Extend OpenFeature with custom providers and hooks. |
110
111
111
112
<sub>Implemented: ✅ | In-progress: ⚠️ | Not implemented yet: ❌</sub>
Coming Soon! [Issue available](https://github.com/open-feature/ruby-sdk/issues/52) to be worked on.
204
-
205
-
<!-- [Hooks](https://openfeature.dev/docs/reference/concepts/hooks) allow for custom logic to be added at well-defined points of the flag evaluation life-cycle.
204
+
[Hooks](https://openfeature.dev/docs/reference/concepts/hooks) allow for custom logic to be added at well-defined points of the flag evaluation life-cycle.
206
205
Look [here](https://openfeature.dev/ecosystem/?instant_search%5BrefinementList%5D%5Btype%5D%5B0%5D=Hook&instant_search%5BrefinementList%5D%5Btechnology%5D%5B0%5D=Ruby) for a complete list of available hooks.
207
206
If the hook you're looking for hasn't been created yet, see the [develop a hook](#develop-a-hook) section to learn how to build it yourself.
208
207
209
-
Once you've added a hook as a dependency, it can be registered at the global, client, or flag invocation level. -->
208
+
Hooks can be registered at the global, client, or flag invocation level.
Coming Soon! [Issue available](https://github.com/open-feature/ruby-sdk/issues/149) to be worked on.
280
-
281
-
<!-- TODO The OpenFeature API provides a close function to perform a cleanup of all registered providers.
314
+
The OpenFeature API provides a `shutdown` method to perform cleanup of all registered providers.
282
315
This should only be called when your application is in the process of shutting down.
283
316
317
+
```ruby
318
+
# Shut down all registered providers and clear state
319
+
OpenFeature::SDK.shutdown
320
+
```
321
+
322
+
Individual providers can implement a `shutdown` method to perform cleanup:
323
+
284
324
```ruby
285
325
classMyProvider
286
326
defshutdown
287
327
# Perform any shutdown/reclamation steps with flag management system here
288
-
# Return value is ignored
289
328
end
290
329
end
291
-
``` -->
330
+
```
331
+
332
+
### Tracking
333
+
334
+
The tracking API allows you to use OpenFeature abstractions and objects to associate user actions with feature flag evaluations.
335
+
This is essential for robust experimentation powered by feature flags.
336
+
For example, a flag enhancing the appearance of a UI component might drive user engagement to a new feature; to test this hypothesis, telemetry collected by a [hook](#hooks) or [provider](#providers) can be associated with telemetry reported in the client's `track` function.
# Record a tracking event with your flag management system
421
+
end
347
422
end
348
423
```
349
424
350
425
> Built a new provider? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=provider&projects=&template=document-provider.yaml&title=%5BProvider%5D%3A+) so we can add it to the docs!
351
426
352
427
### Develop a hook
353
428
354
-
Coming Soon! [Issue available](https://github.com/open-feature/ruby-sdk/issues/52) to be worked on.
355
-
356
-
<!-- To develop a hook, you need to create a new project and include the OpenFeature SDK as a dependency.
429
+
To develop a hook, you need to create a new project and include the OpenFeature SDK as a dependency.
357
430
This can be a new repository or included in [the existing contrib repository](https://github.com/open-feature/ruby-sdk-contrib) available under the OpenFeature organization.
358
-
Implement your own hook by conforming to the `Hook interface`.
359
-
To satisfy the interface, all methods (`Before`/`After`/`Finally`/`Error`) need to be defined.
360
-
To avoid defining empty functions, make use of the `UnimplementedHook` struct (which already implements all the empty functions). -->
431
+
Implement your own hook by including the `OpenFeature::SDK::Hooks::Hook` module.
432
+
You only need to define the stages you care about — unimplemented stages are no-ops by default.
433
+
434
+
```ruby
435
+
classMyLoggingHook
436
+
includeOpenFeature::SDK::Hooks::Hook
361
437
362
-
<!-- TODO: code example of hook implementation -->
# error and finally are optional — only define what you need
448
+
end
449
+
```
363
450
364
-
<!--> Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=hook&projects=&template=document-hook.yaml&title=%5BHook%5D%3A+) so we can add it to the docs!-->
451
+
> Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=hook&projects=&template=document-hook.yaml&title=%5BHook%5D%3A+) so we can add it to the docs!
0 commit comments