Skip to content

Commit

Permalink
feat: adding client id for tracking requests to registry (#84)
Browse files Browse the repository at this point in the history
* feat: adding client id for tracking requests to registry

---------

Co-authored-by: vbhagwat <[email protected]>
  • Loading branch information
vanitabhagwat and vbhagwat authored Feb 26, 2024
1 parent 9fc0d77 commit 5e7271d
Show file tree
Hide file tree
Showing 6 changed files with 619 additions and 27 deletions.
15 changes: 9 additions & 6 deletions go/internal/feast/featurestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,22 @@ func NewFeatureStore(config *registry.RepoConfig, callback transformation.Transf
if err != nil {
return nil, err
}

registry, err := registry.NewRegistry(config.GetRegistryConfig(), config.RepoPath, config.Project)
registryConfig, err := config.GetRegistryConfig()
if err != nil {
return nil, err
}
registry, err := registry.NewRegistry(registryConfig, config.RepoPath, config.Project)
if err != nil {
return nil, err
}
err = registry.InitializeRegistry()
if err != nil {
return nil, err
}
sanitizedProjectName := strings.Replace(config.Project, "_", "-", -1)
productName := os.Getenv("PRODUCT")
endpoint := fmt.Sprintf("%s-transformations.%s.svc.cluster.local:80", sanitizedProjectName, productName)
transformationService, _ := transformation.NewGrpcTransformationService(config, endpoint)
sanitizedProjectName := strings.Replace(config.Project, "_", "-", -1)
productName := os.Getenv("PRODUCT")
endpoint := fmt.Sprintf("%s-transformations.%s.svc.cluster.local:80", sanitizedProjectName, productName)
transformationService, _ := transformation.NewGrpcTransformationService(config, endpoint)

return &FeatureStore{
config: config,
Expand Down
3 changes: 2 additions & 1 deletion go/internal/feast/onlinestore/sqliteonlinestore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ func TestSqliteAndFeatureRepoSetup(t *testing.T) {
err := test.SetupCleanFeatureRepo(dir)
assert.Nil(t, err)
config, err := registry.NewRepoConfigFromFile(feature_repo_path)
registryConfig, err := config.GetRegistryConfig()
assert.Nil(t, err)
assert.Equal(t, "my_project", config.Project)
assert.Equal(t, "data/registry.db", config.GetRegistryConfig().Path)
assert.Equal(t, "data/registry.db", registryConfig.Path)
assert.Equal(t, "local", config.Provider)
assert.Equal(t, map[string]interface{}{
"path": "data/online_store.db",
Expand Down
11 changes: 6 additions & 5 deletions go/internal/feast/registry/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ package registry
import (
"crypto/tls"
"fmt"
"github.com/feast-dev/feast/go/protos/feast/core"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/proto"
"io"
"net/http"
"time"

"google.golang.org/protobuf/proto"

"github.com/feast-dev/feast/go/protos/feast/core"
"github.com/rs/zerolog/log"
)

type HttpRegistryStore struct {
project string
endpoint string
clientId string
client http.Client
}

Expand All @@ -38,6 +37,7 @@ func NewHttpRegistryStore(config *RegistryConfig, project string) (*HttpRegistry
hrs := &HttpRegistryStore{
project: project,
endpoint: config.Path,
clientId: config.ClientId,
client: http.Client{
Transport: tr,
Timeout: 5 * time.Second,
Expand Down Expand Up @@ -72,6 +72,7 @@ func (r *HttpRegistryStore) makeHttpRequest(url string) (*http.Response, error)
}

req.Header.Add("Accept", "application/x-protobuf")
req.Header.Add("Client-Id", r.clientId)

resp, err := r.client.Do(req)
if err != nil {
Expand Down
Loading

0 comments on commit 5e7271d

Please sign in to comment.