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
Implement selector passing via gRPC metadata header for in-process mode
- Update GrpcWatcher to pass selector via flagd-selector metadata header
- Add GrpcMultiCallableArgs.metadata field to support gRPC metadata
- Update README to reflect current header-based implementation
- Add test to verify selector is passed via metadata, not request body
- Aligns with flagd v0.11.0+ selector normalization standard
Co-authored-by: aepfli <[email protected]>
Copy file name to clipboardExpand all lines: providers/openfeature-provider-flagd/README.md
+9-15Lines changed: 9 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,12 +111,9 @@ The default options can be defined in the FlagdProvider constructor.
111
111
> [!IMPORTANT]
112
112
> This section only applies to **in-process** and **file** resolver modes. RPC mode is not affected by selector handling changes.
113
113
114
-
#### Migration Guidance
114
+
#### Current Implementation
115
115
116
-
As of flagd v0.11.0 and related services, selector normalization has been updated to prefer gRPC metadata headers over request body fields for the `selector` parameter. This change affects how the in-process provider communicates with flagd's sync service.
117
-
118
-
**Current Behavior (Preferred):**
119
-
The Python SDK currently passes the `selector` via the gRPC request body when using in-process mode. While this approach continues to work for backward compatibility, the flagd ecosystem is transitioning to header-based selector passing.
116
+
As of this SDK version, the `selector` parameter is passed via gRPC metadata headers (`flagd-selector`) when using in-process mode. This aligns with flagd v0.11.0+ selector normalization standards.
120
117
121
118
**Configuration Example:**
122
119
```python
@@ -126,22 +123,19 @@ from openfeature.contrib.provider.flagd.config import ResolverType
126
123
127
124
api.set_provider(FlagdProvider(
128
125
resolver_type=ResolverType.IN_PROCESS,
129
-
selector="my-flag-source", #Currently passed in request body
126
+
selector="my-flag-source", #Passed via flagd-selector header
130
127
))
131
128
```
132
129
133
-
#### Backward Compatibility
134
-
135
-
The current implementation maintains backward compatibility by continuing to pass selectors in the request body. flagd services support both approaches:
136
-
-**Request body selector** (current implementation) - Supported for backward compatibility
137
-
-**Header-based selector** (future preferred) - Will be supported in a future SDK update
130
+
The selector is automatically passed via the `flagd-selector` gRPC metadata header, ensuring compatibility with flagd services that implement selector normalization.
138
131
139
-
#### Future Breaking Change
132
+
#### Backward Compatibility
140
133
141
-
In a future major version of this SDK, the selector handling will be updated to use gRPC metadata headers (`flagd-selector`) instead of the request body field. This aligns with the flagd ecosystem's standardized approach to selector normalization.
134
+
flagd services maintain backward compatibility with both selector passing approaches:
135
+
-**gRPC metadata header** (`flagd-selector`) - Current implementation (recommended)
136
+
-**Request body selector** - Legacy approach (still supported by flagd for backward compatibility)
142
137
143
-
**Action Required:**
144
-
No immediate action is required. The current implementation will continue to work with both current and future versions of flagd services. Monitor release notes for announcements about the transition to header-based selectors.
138
+
This ensures the Python SDK works correctly with both older and newer versions of flagd services.
Copy file name to clipboardExpand all lines: providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py
+19-2Lines changed: 19 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -205,13 +205,24 @@ def shutdown(self) -> None:
205
205
206
206
def_create_request_args(self) ->dict:
207
207
request_args= {}
208
-
ifself.selectorisnotNone:
209
-
request_args["selector"] =self.selector
208
+
# Note: selector is now passed via gRPC metadata header instead of request body
209
+
# This maintains compatibility with flagd v0.11.0+ selector normalization
0 commit comments