Skip to content

Commit c7446f5

Browse files
committed
decouple logging service
Signed-off-by: pyalex <[email protected]>
1 parent f3ff812 commit c7446f5

40 files changed

+1399
-1109
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ coverage.xml
105105
.hypothesis/
106106
.pytest_cache/
107107
infra/scripts/*.conf
108-
go/cmd/server/logging/feature_repo/data/
108+
go/internal/test/feature_repo/data/
109109

110110
# Translations
111111
*.mo

go/embedded/online_features.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@ package embedded
33
import (
44
"context"
55
"fmt"
6-
"github.com/feast-dev/feast/go/internal/feast/server"
7-
"github.com/feast-dev/feast/go/internal/feast/server/logging"
8-
"github.com/feast-dev/feast/go/protos/feast/serving"
9-
"google.golang.org/grpc"
106
"log"
117
"net"
128
"os"
139
"os/signal"
1410
"syscall"
1511

12+
"google.golang.org/grpc"
13+
14+
"github.com/feast-dev/feast/go/internal/feast/server"
15+
"github.com/feast-dev/feast/go/internal/feast/server/logging"
16+
"github.com/feast-dev/feast/go/protos/feast/serving"
17+
1618
"github.com/apache/arrow/go/v8/arrow"
1719
"github.com/apache/arrow/go/v8/arrow/array"
1820
"github.com/apache/arrow/go/v8/arrow/cdata"
1921
"github.com/apache/arrow/go/v8/arrow/memory"
22+
2023
"github.com/feast-dev/feast/go/internal/feast"
2124
"github.com/feast-dev/feast/go/internal/feast/model"
2225
"github.com/feast-dev/feast/go/internal/feast/onlineserving"

go/internal/feast/featurestore.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66

77
"github.com/apache/arrow/go/v8/arrow/memory"
8+
89
"github.com/feast-dev/feast/go/internal/feast/model"
910
"github.com/feast-dev/feast/go/internal/feast/onlineserving"
1011
"github.com/feast-dev/feast/go/internal/feast/onlinestore"
@@ -287,3 +288,32 @@ func (fs *FeatureStore) readFromOnlineStore(ctx context.Context, entityRows []*p
287288
}
288289
return fs.onlineStore.OnlineRead(ctx, entityRowsValue, requestedFeatureViewNames, requestedFeatureNames)
289290
}
291+
292+
func (fs *FeatureStore) GetFcosMap() (map[string]*model.Entity, map[string]*model.FeatureView, map[string]*model.OnDemandFeatureView, error) {
293+
odfvs, err := fs.ListOnDemandFeatureViews()
294+
if err != nil {
295+
return nil, nil, nil, err
296+
}
297+
fvs, err := fs.ListFeatureViews()
298+
if err != nil {
299+
return nil, nil, nil, err
300+
}
301+
entities, err := fs.ListEntities(true)
302+
if err != nil {
303+
return nil, nil, nil, err
304+
}
305+
306+
entityMap := make(map[string]*model.Entity)
307+
for _, entity := range entities {
308+
entityMap[entity.Name] = entity
309+
}
310+
fvMap := make(map[string]*model.FeatureView)
311+
for _, fv := range fvs {
312+
fvMap[fv.Base.Name] = fv
313+
}
314+
odfvMap := make(map[string]*model.OnDemandFeatureView)
315+
for _, odfv := range odfvs {
316+
odfvMap[odfv.Base.Name] = odfv
317+
}
318+
return entityMap, fvMap, odfvMap, nil
319+
}

go/internal/feast/featurestore_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import (
66
"runtime"
77
"testing"
88

9+
"github.com/stretchr/testify/assert"
10+
911
"github.com/feast-dev/feast/go/internal/feast/onlinestore"
1012
"github.com/feast-dev/feast/go/internal/feast/registry"
1113
"github.com/feast-dev/feast/go/protos/feast/types"
12-
"github.com/stretchr/testify/assert"
1314
)
1415

1516
// Return absolute path to the test_repo registry regardless of the working directory
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package model
22

33
import (
4-
"github.com/feast-dev/feast/go/protos/feast/core"
54
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
5+
6+
"github.com/feast-dev/feast/go/protos/feast/core"
67
)
78

89
type FeatureService struct {
@@ -11,17 +12,29 @@ type FeatureService struct {
1112
CreatedTimestamp *timestamppb.Timestamp
1213
LastUpdatedTimestamp *timestamppb.Timestamp
1314
Projections []*FeatureViewProjection
15+
LoggingConfig *FeatureServiceLoggingConfig
16+
}
17+
18+
type FeatureServiceLoggingConfig struct {
19+
SampleRate float32
1420
}
1521

1622
func NewFeatureServiceFromProto(proto *core.FeatureService) *FeatureService {
1723
projections := make([]*FeatureViewProjection, len(proto.Spec.Features))
1824
for index, projectionProto := range proto.Spec.Features {
1925
projections[index] = NewFeatureViewProjectionFromProto(projectionProto)
2026
}
27+
var loggingConfig *FeatureServiceLoggingConfig
28+
if proto.GetSpec().GetLoggingConfig() != nil {
29+
loggingConfig = &FeatureServiceLoggingConfig{
30+
SampleRate: proto.GetSpec().GetLoggingConfig().SampleRate,
31+
}
32+
}
2133
return &FeatureService{Name: proto.Spec.Name,
2234
Project: proto.Spec.Project,
2335
CreatedTimestamp: proto.Meta.CreatedTimestamp,
2436
LastUpdatedTimestamp: proto.Meta.LastUpdatedTimestamp,
2537
Projections: projections,
38+
LoggingConfig: loggingConfig,
2639
}
2740
}

go/internal/feast/model/featureview.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package model
22

33
import (
4+
durationpb "google.golang.org/protobuf/types/known/durationpb"
5+
46
"github.com/feast-dev/feast/go/protos/feast/core"
57
"github.com/feast-dev/feast/go/protos/feast/types"
6-
durationpb "google.golang.org/protobuf/types/known/durationpb"
78
)
89

910
const (

go/internal/feast/model/ondemandfeatureview.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ func (fs *OnDemandFeatureView) NewWithProjection(projection *FeatureViewProjecti
4949
}
5050

5151
func NewOnDemandFeatureViewFromBase(base *BaseFeatureView) *OnDemandFeatureView {
52-
53-
featureView := &OnDemandFeatureView{Base: base}
52+
featureView := &OnDemandFeatureView{
53+
Base: base,
54+
SourceFeatureViewProjections: map[string]*FeatureViewProjection{},
55+
SourceRequestDataSources: map[string]*core.DataSource_RequestDataOptions{}}
5456
return featureView
5557
}
5658

go/internal/feast/onlineserving/serving.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import (
99

1010
"github.com/apache/arrow/go/v8/arrow"
1111
"github.com/apache/arrow/go/v8/arrow/memory"
12+
"github.com/golang/protobuf/proto"
13+
"google.golang.org/protobuf/types/known/durationpb"
14+
"google.golang.org/protobuf/types/known/timestamppb"
15+
1216
"github.com/feast-dev/feast/go/internal/feast/model"
1317
"github.com/feast-dev/feast/go/internal/feast/onlinestore"
1418
"github.com/feast-dev/feast/go/protos/feast/serving"
1519
prototypes "github.com/feast-dev/feast/go/protos/feast/types"
1620
"github.com/feast-dev/feast/go/types"
17-
"github.com/golang/protobuf/proto"
18-
"google.golang.org/protobuf/types/known/durationpb"
19-
"google.golang.org/protobuf/types/known/timestamppb"
2021
)
2122

2223
/*

go/internal/feast/onlineserving/serving_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package onlineserving
33
import (
44
"testing"
55

6-
"github.com/feast-dev/feast/go/internal/feast/model"
7-
"github.com/feast-dev/feast/go/protos/feast/core"
8-
"github.com/feast-dev/feast/go/protos/feast/types"
96
"github.com/stretchr/testify/assert"
107
"google.golang.org/protobuf/types/known/durationpb"
118
"google.golang.org/protobuf/types/known/timestamppb"
9+
10+
"github.com/feast-dev/feast/go/internal/feast/model"
11+
"github.com/feast-dev/feast/go/protos/feast/core"
12+
"github.com/feast-dev/feast/go/protos/feast/types"
1213
)
1314

1415
func TestGroupingFeatureRefs(t *testing.T) {

go/internal/feast/onlinestore/onlinestore.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ package onlinestore
33
import (
44
"context"
55
"fmt"
6+
67
"github.com/feast-dev/feast/go/internal/feast/registry"
78

9+
"github.com/golang/protobuf/ptypes/timestamp"
10+
811
"github.com/feast-dev/feast/go/protos/feast/serving"
912
"github.com/feast-dev/feast/go/protos/feast/types"
10-
"github.com/golang/protobuf/ptypes/timestamp"
1113
)
1214

1315
type FeatureData struct {

0 commit comments

Comments
 (0)