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
Copy file name to clipboardExpand all lines: providers/flagd/README.md
+67-21Lines changed: 67 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,6 +47,46 @@ FlagdProvider flagdProvider = new FlagdProvider(
47
47
48
48
In the above example, in-process handlers attempt to connect to a sync service on address `localhost:8013` to obtain [flag definitions](https://github.com/open-feature/schemas/blob/main/json/flags.json).
49
49
50
+
#### Selector filtering (In-process mode only)
51
+
52
+
The `selector` option allows filtering flag configurations from flagd based on source identifiers when using the in-process resolver. This is useful when flagd is configured with multiple flag sources and you want to sync only a specific subset.
53
+
54
+
##### Usage
55
+
56
+
To use selector filtering, simply configure the `selector` option when creating the provider:
57
+
58
+
```java
59
+
FlagdProvider flagdProvider =newFlagdProvider(
60
+
FlagdOptions.builder()
61
+
.resolverType(Config.Resolver.IN_PROCESS)
62
+
.selector("source=my-app")
63
+
.build());
64
+
```
65
+
66
+
Or via environment variable:
67
+
```bash
68
+
export FLAGD_SOURCE_SELECTOR="source=my-app"
69
+
```
70
+
71
+
##### Implementation details
72
+
73
+
> [!IMPORTANT]
74
+
> **Selector normalization (flagd issue #1814)**
75
+
>
76
+
> As part of [flagd issue #1814](https://github.com/open-feature/flagd/issues/1814), the flagd project is normalizing selector handling across all services to use the `flagd-selector` gRPC metadata header.
77
+
>
78
+
> **Current implementation:**
79
+
> - The Java SDK **automatically passes the selector via the `flagd-selector` header** (preferred approach)
80
+
> - For backward compatibility with older flagd versions, the selector is **also sent in the request body**
81
+
> - Both methods work with current flagd versions
82
+
> - In a future major version of flagd, the request body selector field may be removed
83
+
>
84
+
> **No migration needed:**
85
+
>
86
+
> Users do not need to make any code changes. The SDK handles selector normalization automatically.
87
+
88
+
For more details on selector normalization, see the [flagd selector normalization issue](https://github.com/open-feature/flagd/issues/1814).
89
+
50
90
#### Sync-metadata
51
91
52
92
To support the injection of contextual data configured in flagd for in-process evaluation, the provider exposes a `getSyncMetadata` accessor which provides the most recent value returned by the [GetMetadata RPC](https://buf.build/open-feature/flagd/docs/main:flagd.sync.v1#flagd.sync.v1.FlagSyncService.GetMetadata).
@@ -106,30 +146,33 @@ variables.
106
146
107
147
Given below are the supported configurations:
108
148
109
-
| Option name | Environment variable name | Type & Values | Default | Compatible resolver |
> Some configurations are only applicable for RPC resolver.
173
+
174
+
> [!NOTE]
175
+
> The `selector` option automatically uses the `flagd-selector` header (the preferred approach per [flagd issue #1814](https://github.com/open-feature/flagd/issues/1814)) while maintaining backward compatibility with older flagd versions. See [Selector filtering](#selector-filtering-in-process-mode-only) for details.
133
176
>
134
177
135
178
### Unix socket support
@@ -189,6 +232,9 @@ FlagdProvider flagdProvider = new FlagdProvider(
189
232
190
233
The `clientInterceptors` and `defaultAuthority` are meant for connection of the in-process resolver to a Sync API implementation on a host/port, that might require special credentials or headers.
191
234
235
+
> [!NOTE]
236
+
> The SDK automatically handles the `flagd-selector` header when the `selector` option is configured. Custom interceptors are not needed for selector filtering. See [Selector filtering](#selector-filtering-in-process-mode-only) for details.
Copy file name to clipboardExpand all lines: providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/resolver/process/storage/connector/sync/SyncStreamQueueSource.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,6 @@
35
35
justification = "We need to expose the BlockingQueue to allow consumers to read from it")
0 commit comments