Skip to content

Commit 33f5594

Browse files
chore: update sdk readmes
Signed-off-by: OpenFeature Bot <[email protected]>
1 parent 811c5b0 commit 33f5594

File tree

14 files changed

+152
-76
lines changed

14 files changed

+152
-76
lines changed

docs/reference/technologies/client/kotlin.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from kotlin-sdk.
1010
Edits should be made here: https://github.com/open-feature/kotlin-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon Nov 04 2024 08:10:21 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">

docs/reference/technologies/client/swift.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from swift-sdk.
1010
Edits should be made here: https://github.com/open-feature/swift-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon Nov 04 2024 08:10:22 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">

docs/reference/technologies/client/web/angular.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon Nov 04 2024 08:10:22 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
1717
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
1818
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
1919
</a>
2020

21-
<a href="https://github.com/open-feature/js-sdk/releases/tag/angular-sdk-v0.0.4-experimental">
22-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.0.4-experimental&color=blue&style=for-the-badge" />
21+
<a href="https://github.com/open-feature/js-sdk/releases/tag/angular-sdk-v0.0.6-experimental">
22+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.0.6-experimental&color=blue&style=for-the-badge" />
2323
</a>
2424

2525
<br/>

docs/reference/technologies/client/web/index.mdx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon Nov 04 2024 08:10:21 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
1717
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
1818
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
1919
</a>
2020

21-
<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.2.4">
22-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.2.4&color=blue&style=for-the-badge" />
21+
<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.3.1">
22+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.3.1&color=blue&style=for-the-badge" />
2323
</a>
2424

2525
<br/>
@@ -61,7 +61,7 @@ npm install --save @openfeature/web-sdk
6161
yarn add @openfeature/web-sdk @openfeature/core
6262
```
6363

64-
> [!NOTE]
64+
> [!NOTE]
6565
> `@openfeature/core` contains common components used by all OpenFeature JavaScript implementations.
6666
> Every SDK version has a requirement on a single, specific version of this dependency.
6767
> For more information, and similar implications on libraries developed with OpenFeature see [considerations when extending](#considerations).
@@ -99,6 +99,7 @@ See [here](https://open-feature.github.io/js-sdk/modules/_openfeature_web_sdk.ht
9999
|| [Logging](#logging) | Integrate with popular logging packages. |
100100
|| [Domains](#domains) | Logically bind clients with providers. |
101101
|| [Eventing](#eventing) | React to state changes in the provider or flag management system. |
102+
|| [Tracking](#tracking) | Associate user actions with feature flag evaluations, particularly for A/B testing. |
102103
|| [Shutdown](#shutdown) | Gracefully clean up a provider during application shutdown. |
103104
|| [Extending](#extending) | Extend OpenFeature with custom providers and hooks. |
104105

@@ -278,6 +279,21 @@ client.addHandler(ProviderEvents.Error, (eventDetails) => {
278279
});
279280
```
280281

282+
### Tracking
283+
284+
The tracking API allows you to use OpenFeature abstractions and objects to associate user actions with feature flag evaluations.
285+
This is essential for robust experimentation powered by feature flags.
286+
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.
287+
288+
```ts
289+
// flag is evaluated
290+
client.getBooleanValue('new-feature', false);
291+
292+
// new feature is used and track function is called recording the usage
293+
useNewFeature();
294+
client.track('new-feature-used');
295+
```
296+
281297
### Shutdown
282298

283299
The OpenFeature API provides a close function to perform a cleanup of all registered providers.
@@ -336,7 +352,7 @@ class MyProvider implements Provider {
336352
}
337353

338354
// implement with "new OpenFeatureEventEmitter()", and use "emit()" to emit events
339-
events?: ProviderEventEmitter<AnyProviderEvent> | undefined;
355+
events?: ProviderEventEmitter<AnyProviderEvent> | undefined;
340356

341357
initialize?(context?: EvaluationContext | undefined): Promise<void> {
342358
// code to initialize your provider

docs/reference/technologies/client/web/react.mdx

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon Nov 04 2024 08:10:21 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
1717
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
1818
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
1919
</a>
2020

21-
<a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v0.4.6">
22-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.4.6&color=blue&style=for-the-badge" />
21+
<a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v0.4.8">
22+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.4.8&color=blue&style=for-the-badge" />
2323
</a>
2424

2525
<br/>
@@ -51,6 +51,7 @@ In addition to the feature provided by the [web sdk](/docs/reference/technologie
5151
- [Re-rendering with Context Changes](#re-rendering-with-context-changes)
5252
- [Re-rendering with Flag Configuration Changes](#re-rendering-with-flag-configuration-changes)
5353
- [Suspense Support](#suspense-support)
54+
- [Tracking](#tracking)
5455
- [Testing](#testing)
5556
- [FAQ and troubleshooting](#faq-and-troubleshooting)
5657
- [Resources](#resources)
@@ -129,7 +130,7 @@ function App() {
129130

130131
#### Evaluation hooks
131132

132-
Within the provider, you can use the various evaluation hooks to evaluate flags.
133+
Within the provider, you can use the various evaluation hooks to evaluate flags.
133134

134135
```tsx
135136
function Page() {
@@ -233,7 +234,7 @@ Note that if your provider doesn't support updates, this configuration has no im
233234

234235
#### Suspense Support
235236

236-
> [!NOTE]
237+
> [!NOTE]
237238
> React suspense is an experimental feature and subject to change in future versions.
238239
239240
Frequently, providers need to perform some initial startup tasks.
@@ -270,11 +271,32 @@ function Fallback() {
270271
// component to render before READY.
271272
return <p>Waiting for provider to be ready...</p>;
272273
}
273-
274274
```
275275

276276
This can be disabled in the hook options (or in the [OpenFeatureProvider](#openfeatureprovider-context-provider)).
277277

278+
#### Tracking
279+
280+
The tracking API allows you to use OpenFeature abstractions and objects to associate user actions with feature flag evaluations.
281+
This is essential for robust experimentation powered by feature flags.
282+
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.
283+
284+
The React SDK includes a hook for firing tracking events in the <OpenFeatureProvider> context in use:
285+
286+
```tsx
287+
function MyComponent() {
288+
289+
// get a tracking function for this <OpenFeatureProvider>.
290+
const { track } = useTrack();
291+
292+
// call the tracking event
293+
// can be done in render, useEffect, or in handlers, depending on your use case
294+
track(eventName, trackingDetails);
295+
296+
return <>...</>;
297+
}
298+
```
299+
278300
### Testing
279301

280302
The React SDK includes a built-in context provider for testing.

docs/reference/technologies/server/dotnet.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from dotnet-sdk.
1010
Edits should be made here: https://github.com/open-feature/dotnet-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Thu Oct 17 2024 08:09:41 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon Nov 04 2024 08:10:20 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
[![Specification](https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge)](https://github.com/open-feature/spec/releases/tag/v0.7.0)

docs/reference/technologies/server/go.mdx

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ This content has been automatically generated from go-sdk.
99
Edits should be made here: https://github.com/open-feature/go-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Thu Oct 17 2024 08:09:41 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Mon Nov 04 2024 08:10:20 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">
1616
<a href="https://github.com/open-feature/spec/releases/tag/v0.7.0">
1717
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge" />
1818
</a>
1919

20-
<a href="https://github.com/open-feature/go-sdk/releases/tag/v1.13.0">
21-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.13.0&color=blue&style=for-the-badge" />
20+
<a href="https://github.com/open-feature/go-sdk/releases/tag/v1.13.1">
21+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.13.1&color=blue&style=for-the-badge" />
2222
</a>
2323

2424
<br/>
@@ -171,24 +171,46 @@ value, err := client.BooleanValue(
171171

172172
### Logging
173173

174-
The standard Go log package is used by default to show error logs.
175-
This can be overridden using the structured logging, [logr](https://github.com/go-logr/logr) API, allowing integration to any package.
176-
There are already [integration implementations](https://github.com/go-logr/logr#implementations-non-exhaustive) for many of the popular logger packages.
174+
Note that in accordance with the OpenFeature specification, the SDK doesn't generally log messages during flag evaluation.
175+
176+
#### Logging Hook
177+
178+
The GO SDK includes a `LoggingHook`, which logs detailed information at key points during flag evaluation, using [slog](https://pkg.go.dev/log/slog) structured logging API.
179+
This hook can be particularly helpful for troubleshooting and debugging; simply attach it at the global, client or invocation level and ensure your log level is set to "debug".
180+
181+
##### Usage example
177182

178183
```go
179-
var l logr.Logger
180-
l = integratedlogr.New() // replace with your chosen integrator
184+
// configure slog
185+
var programLevel = new(slog.LevelVar)
186+
programLevel.Set(slog.LevelDebug)
187+
h := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel})
188+
slog.SetDefault(slog.New(h))
189+
190+
// add a hook globally to run on all evaluations
191+
hook, err := NewLoggingHook(false)
192+
if err != nil {
193+
// handle error
194+
}
195+
196+
openfeature.AddHooks(hook)
181197

182-
openfeature.SetLogger(l) // set the logger at global level
198+
client.BooleanValueDetails(context.Background(), "not-exist", true, openfeature.EvaluationContext{})
183199

184-
c := openfeature.NewClient("log").WithLogger(l) // set the logger at client level
185200
```
186201

187-
[logr](https://github.com/go-logr/logr) uses incremental verbosity levels (akin to named levels but in integer form).
188-
The SDK logs `info` at level `0` and `debug` at level `1`. Errors are always logged.
202+
###### Output
203+
204+
```sh
205+
{"time":"2024-10-23T13:33:09.8870867+03:00","level":"DEBUG","msg":"Before stage","domain":"test-client","provider_name":"InMemoryProvider","flag_key":"not-exist","default_value":true}
206+
{"time":"2024-10-23T13:33:09.8968242+03:00","level":"ERROR","msg":"Error stage","domain":"test-client","provider_name":"InMemoryProvider","flag_key":"not-exist","default_value":true,"error_message":"error code: FLAG_NOT_FOUND: flag for key not-exist not found"}
207+
```
208+
209+
See [hooks](#hooks) for more information on configuring hooks.
189210

190211
### Domains
191-
Clients can be assigned to a domain. A domain is a logical identifier which can be used to associate clients with a particular provider. If a domain has no associated provider, the default provider is used.
212+
213+
Clients can be assigned to a domain. A domain is a logical identifier that can be used to associate clients with a particular provider. If a domain has no associated provider, the default provider is used.
192214

193215
```go
194216
import "github.com/open-feature/go-sdk/openfeature"

docs/reference/technologies/server/java.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from java-sdk.
99
Edits should be made here: https://github.com/open-feature/java-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Thu Oct 17 2024 08:09:41 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Mon Nov 04 2024 08:10:20 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">
@@ -18,8 +18,8 @@ Last updated at Thu Oct 17 2024 08:09:41 GMT+0000 (Coordinated Universal Time)
1818
</a>
1919

2020

21-
<a href="https://github.com/open-feature/java-sdk/releases/tag/v1.12.1">
22-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.12.1&color=blue&style=for-the-badge" />
21+
<a href="https://github.com/open-feature/java-sdk/releases/tag/v1.12.2">
22+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.12.2&color=blue&style=for-the-badge" />
2323
</a>
2424

2525

@@ -54,7 +54,7 @@ Note that this library is intended to be used in server-side contexts and has no
5454
<dependency>
5555
<groupId>dev.openfeature</groupId>
5656
<artifactId>sdk</artifactId>
57-
<version>1.12.1</version>
57+
<version>1.12.2</version>
5858
</dependency>
5959
```
6060

@@ -77,7 +77,7 @@ If you would like snapshot builds, this is the relevant repository information:
7777

7878
```groovy
7979
dependencies {
80-
implementation 'dev.openfeature:sdk:1.12.1'
80+
implementation 'dev.openfeature:sdk:1.12.2'
8181
}
8282
```
8383

0 commit comments

Comments
 (0)