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
+20-57Lines changed: 20 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,9 +51,9 @@ In the above example, in-process handlers attempt to connect to a sync service o
51
51
52
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
53
54
-
##### Current implementation (Request body)
54
+
##### Usage
55
55
56
-
The current implementation passes the selector in the gRPC request body via the `SyncFlagsRequest`:
56
+
To use selector filtering, simply configure the `selector` option when creating the provider:
57
57
58
58
```java
59
59
FlagdProvider flagdProvider =newFlagdProvider(
@@ -68,64 +68,27 @@ Or via environment variable:
68
68
export FLAGD_SOURCE_SELECTOR="source=my-app"
69
69
```
70
70
71
-
##### Migration to header-based selector
71
+
##### Implementation details
72
72
73
73
> [!IMPORTANT]
74
-
> **Selector normalization and deprecation notice**
74
+
> **Selector normalization (flagd issue #1814)**
75
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. The preferred approach is to use the `flagd-selector` gRPC metadata header instead of the request body field.
76
+
> As part of [flagd issue #1814](https://github.com/open-feature/flagd/issues/1814), the flagd project is normalizing selector handling across all servicesto use the `flagd-selector` gRPC metadata header.
77
77
>
78
-
> **Current status:**
79
-
> - The Java SDK currently uses the **request body** approach (via `SyncFlagsRequest.setSelector()`)
80
-
> - flagd services support both request body and header for backward compatibility
81
-
> - In a future major version, the request body selector field may be removed from flagd
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
82
83
>
83
-
> **Recommended migration path:**
84
+
> **No migration needed:**
84
85
>
85
-
> To prepare for future changes and align with the preferred approach, you can pass the selector via gRPC headers using a custom `ClientInterceptor`:
@@ -213,8 +176,8 @@ Given below are the supported configurations:
213
176
> [!NOTE]
214
177
> Some configurations are only applicable for RPC resolver.
215
178
216
-
> [!WARNING]
217
-
> The `selector` option currently uses the gRPC request body approach, which may be deprecated in future flagd versions. See [Selector filtering](#selector-filtering-in-process-mode-only) for migration guidance to the header-based approach.
179
+
> [!NOTE]
180
+
> 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.
218
181
>
219
182
220
183
### Unix socket support
@@ -274,8 +237,8 @@ FlagdProvider flagdProvider = new FlagdProvider(
274
237
275
238
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.
276
239
277
-
> [!TIP]
278
-
> `ClientInterceptor` can also be used to pass the `flagd-selector` header for selector-based filtering. See [Selector filtering](#selector-filtering-in-process-mode-only) for details on the preferred header-based approach.
240
+
> [!NOTE]
241
+
> 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/FlagdOptions.java
+4-5Lines changed: 4 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -125,14 +125,13 @@ public class FlagdOptions {
125
125
/**
126
126
* Selector to be used with flag sync gRPC contract.
127
127
* <p>
128
-
* <b>Note:</b> This currently uses the gRPC request body approach. The preferred approach is to use
129
-
* the {@code flagd-selector} header via a {@link ClientInterceptor}.
130
-
* See the <a href="https://github.com/open-feature/java-sdk-contrib/tree/main/providers/flagd#selector-filtering-in-process-mode-only">selector migration guidance</a>
131
-
* for details on the header-based approach.
128
+
* The SDK automatically passes the selector via the {@code flagd-selector} gRPC metadata header
129
+
* (the preferred approach per <a href="https://github.com/open-feature/flagd/issues/1814">flagd issue #1814</a>).
130
+
* For backward compatibility with older flagd versions, the selector is also sent in the request body.
0 commit comments