Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate to connectrpc/connect-go #990

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions core/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module github.com/open-feature/flagd/core
go 1.20

require (
buf.build/gen/go/open-feature/flagd/bufbuild/connect-go v1.9.0-20230720212818-3675556880a1.1
buf.build/gen/go/open-feature/flagd/connectrpc/go v1.12.0-20231031123731-ac2ec0f39838.1
buf.build/gen/go/open-feature/flagd/grpc/go v1.3.0-20230710190440-2333a9579c1a.1
buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.31.0-20230720212818-3675556880a1.1
github.com/bufbuild/connect-go v1.10.0
github.com/bufbuild/connect-opentelemetry-go v0.4.0
buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.31.0-20231031123731-ac2ec0f39838.2
connectrpc.com/connect v1.12.0
connectrpc.com/otelconnect v0.6.0
github.com/diegoholiveira/jsonlogic/v3 v3.3.2
github.com/fsnotify/fsnotify v1.7.0
github.com/golang/mock v1.6.0
Expand Down Expand Up @@ -85,11 +85,9 @@ require (
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
Expand Down
185 changes: 13 additions & 172 deletions core/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/pkg/service/flag-evaluation/connect_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sync"
"time"

schemaConnectV1 "buf.build/gen/go/open-feature/flagd/bufbuild/connect-go/schema/v1/schemav1connect"
schemaConnectV1 "buf.build/gen/go/open-feature/flagd/connectrpc/go/schema/v1/schemav1connect"
"github.com/open-feature/flagd/core/pkg/eval"
"github.com/open-feature/flagd/core/pkg/logger"
"github.com/open-feature/flagd/core/pkg/service"
Expand Down
2 changes: 1 addition & 1 deletion core/pkg/service/flag-evaluation/flag_evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

schemaV1 "buf.build/gen/go/open-feature/flagd/protocolbuffers/go/schema/v1"
"github.com/bufbuild/connect-go"
"connectrpc.com/connect"
"github.com/open-feature/flagd/core/pkg/eval"
"github.com/open-feature/flagd/core/pkg/logger"
"github.com/open-feature/flagd/core/pkg/model"
Expand Down
2 changes: 1 addition & 1 deletion core/pkg/service/flag-evaluation/flag_evaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

schemaV1 "buf.build/gen/go/open-feature/flagd/protocolbuffers/go/schema/v1"
"github.com/bufbuild/connect-go"
"connectrpc.com/connect"
"github.com/golang/mock/gomock"
"github.com/open-feature/flagd/core/pkg/eval"
mock "github.com/open-feature/flagd/core/pkg/eval/mock"
Expand Down
2 changes: 1 addition & 1 deletion core/pkg/service/flag-evaluation/flag_evaluator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

schemaV1 "buf.build/gen/go/open-feature/flagd/protocolbuffers/go/schema/v1"
"github.com/bufbuild/connect-go"
"connectrpc.com/connect"
"google.golang.org/protobuf/types/known/structpb"
)

Expand Down
4 changes: 2 additions & 2 deletions core/pkg/service/flag-evaluation/json_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"errors"
"fmt"

"github.com/bufbuild/connect-go"
"connectrpc.com/connect"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/runtime/protoiface"
)

// WithJSON customizes a connect-go Client or Handler's JSON by exposing MarshalOptions, and UnmarshalOptions
// See: https://github.com/bufbuild/connect-go/blob/main/codec.go
// See: https://github.com/connectrpc/connect-go/blob/main/codec.go
// Heavily inspired by https://github.com/akshayjshah/connectproto
func WithJSON(marshal protojson.MarshalOptions, unmarshal protojson.UnmarshalOptions) connect.Option {
return connect.WithOptions(
Expand Down
2 changes: 1 addition & 1 deletion core/pkg/service/iservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package service
import (
"context"

"github.com/bufbuild/connect-go"
"connectrpc.com/connect"
)

type NotificationType string
Expand Down
2 changes: 1 addition & 1 deletion core/pkg/service/middleware/metrics/http_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (w *responseWriterInterceptor) Hijack() (net.Conn, *bufio.ReadWriter, error
}

// Flush need to exist to be compatible with connect-go.
// See github.com/bufbuild/connect-go@v1.5.2/protocol_connect.go @ line 135
// See https://github.com/connectrpc/connect-go/blob/main/protocol_connect.go
func (w *responseWriterInterceptor) Flush() {
f, ok := w.ResponseWriter.(http.Flusher)
if !ok {
Expand Down
4 changes: 2 additions & 2 deletions core/pkg/telemetry/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"time"

"github.com/bufbuild/connect-go"
otelconnect "github.com/bufbuild/connect-opentelemetry-go"
"connectrpc.com/connect"
"connectrpc.com/otelconnect"
"github.com/open-feature/flagd/core/pkg/logger"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"
Expand Down
2 changes: 0 additions & 2 deletions flagd-proxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,13 @@ require (
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
Expand Down
Loading
Loading