Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

flagd provider: allow custom gRPC metadata on the in-process SyncFlags stream

未关闭
#403 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
78/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
冷清
技术栈
grpc, python
领域
api, backend

调研方向

首先,跨越 config.py、provider.py 和 grpc_watcher.py 跟踪进程内的 SyncFlags 流和 _create_metadata。添加 sync_metadata 配置路径,并验证 selector 和自定义键值对会一起发送,同时没有 selector 或自定义 metadata 时仍不会产生 metadata。

由索引模型根据 Issue 内容生成。

描述

Problem

The in-process resolver of the flagd provider opens a long-lived gRPC stream. It calls the SyncFlags method. The provider builds the gRPC metadata for this call. The function _create_metadata adds only one header. It adds the flagd-selector header. It adds this header only when the user sets a selector.

The provider gives the user no way to add other metadata headers. The Config object has no field for custom metadata. The user cannot add a header to the sync stream.

Effect

A user cannot send an infrastructure-specific header on the sync stream. One example is a proxy timeout header. A proxy can close a stream after a default request timeout. To keep the stream open, the client must send a header such as x-envoy-upstream-rq-timeout-ms: 0. The current provider cannot send this header. Because of this, a proxy can close the long-lived sync stream.

Proposed change

  1. Add a sync_metadata option to FlagdProvider and to Config. The value is a sequence of key-value pairs (header name and header value).
  2. In _create_metadata, add these pairs to the metadata. Keep the flagd-selector header. Send both the selector header and the user headers together.
  3. Keep the current behavior when the user does not set sync_metadata. If the user sets no selector and no custom metadata, the function returns no metadata, as before.

Compatibility

The change is backward compatible. The custom metadata is added only when the user sets sync_metadata. The default behavior does not change.

Scope

The change is small. It touches config.py, provider.py, and grpc_watcher.py. It affects only the in-process resolver, because only that resolver uses the SyncFlags metadata function.

主要语言
Python
星标
27
派生
33
平均合并
11 小时 10 分钟
30 天内合并 PR
14

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

open-feature/python-sdk-contrib 的其他 Issue

查看 open-feature/python-sdk-contrib 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。