open-feature / open-feature/flagd

[FEATURE] Make gRPC sync's gRPC connection customizable

Open
#1,554 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Needs Triage
Dominant language
Go
Stars
997
Forks
136
Avg merge
4d 8h
Merged PRs (30d)
11

Description

Requirements

Today https://github.com/open-feature/flagd/blob/main/core/pkg/sync/grpc/grpc_sync.go is very rigid in terms of how it configures the gRPC connection and its credentials. Should a sync API implementation require clients to set up connections using particular credential types, or things like custom headers, it's impossible.

My proposal to solve that would be to be extend the Sync struct to have an optional field for fully custom []grpc.DialOption that would be used by grpc.NewClient() call. This is flexible and reasonably future proof:


type Sync struct {
	(...)
+	GrpcDialOptionsOverride []grpc.DialOption
	(...)
}

func (g *Sync) Init(_ context.Context) error {
	(...)
+	if len(g.GrpcDialOptionsOverride) > 0 {
+		g.Logger.Debug("GRPC DialOptions override provided")
+		rpcCon, err = grpc.NewClient(g.URI, g.GrpcDialOptionsOverride...)
+	} else {
		// Current logic
	(...)
}

Initially, I would like to contribute functionality to the flagd Go SDK that would utilize this new option (e.g. by extending the provider with WithGrpcDialOptionsOverride() option). I will file an issue in the Go SDK once we agree on the proposed solution here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with core/pkg/sync/grpc/grpc_sync.go, especially the Sync struct and Init method where grpc.NewClient() is called. Trace the current connection and credential setup, then verify that an optional []grpc.DialOption override can be used while preserving the existing path when no override is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.