Skip to content

Commit

Permalink
chore: Added logging to print cluster endpoint used (#140)
Browse files Browse the repository at this point in the history
* chore: Added logging to print cluster endpoint used

Signed-off-by: Bhargav Dodla <[email protected]>

---------

Signed-off-by: Bhargav Dodla <[email protected]>
Co-authored-by: Bhargav Dodla <[email protected]>
  • Loading branch information
EXPEbdodla and Bhargav Dodla authored Sep 30, 2024
1 parent 2a5cfed commit 49a9c5f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions go/internal/feast/onlinestore/redisonlinestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/feast-dev/feast/go/protos/feast/serving"
"github.com/feast-dev/feast/go/protos/feast/types"
"github.com/rs/zerolog/log"
redistrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/redis/go-redis.v9"
)

Expand Down Expand Up @@ -112,19 +113,21 @@ func NewRedisOnlineStore(project string, config *registry.RepoConfig, onlineStor
}

if redisStoreType == redisNode {
log.Info().Msgf("Using Redis: %s", address[0])
store.client = redis.NewClient(&redis.Options{
Addr: address[0],
Password: password, // No password set
Password: password,
DB: db,
TLSConfig: tlsConfig,
})
if strings.ToLower(os.Getenv("ENABLE_DATADOG_REDIS_TRACING")) == "true" {
redistrace.WrapClient(store.client, redistrace.WithServiceName(redisTraceServiceName))
}
} else if redisStoreType == redisCluster {
log.Info().Msgf("Using Redis Cluster: %s", address)
store.clusterClient = redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{address[0]},
Password: password, // No password set
Addrs: address,
Password: password,
TLSConfig: tlsConfig,
ReadOnly: true,
})
Expand Down
1 change: 1 addition & 0 deletions go/internal/feast/registry/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func NewHttpRegistryStore(config *RegistryConfig, project string) (*HttpRegistry
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
IdleConnTimeout: 60 * time.Second,
}
log.Info().Msgf("Using Feature Registry: %s", config.Path)

hrs := &HttpRegistryStore{
project: project,
Expand Down
3 changes: 3 additions & 0 deletions sdk/python/feast/infra/online_stores/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def _get_client(self, online_store_config: RedisOnlineStoreConfig):
online_store_config.connection_string
)
if online_store_config.redis_type == RedisType.redis_cluster:
logger.info(f"Using Redis Cluster: {startup_nodes}")
kwargs["startup_nodes"] = [
ClusterNode(**node) for node in startup_nodes
]
Expand All @@ -233,10 +234,12 @@ def _get_client(self, online_store_config: RedisOnlineStoreConfig):
for item in startup_nodes:
sentinel_hosts.append((item["host"], int(item["port"])))

logger.info(f"Using Redis Sentinel: {sentinel_hosts}")
sentinel = Sentinel(sentinel_hosts, **kwargs)
master = sentinel.master_for(online_store_config.sentinel_master)
self._client = master
else:
logger.info(f"Using Redis: {startup_nodes[0]}")
kwargs["host"] = startup_nodes[0]["host"]
kwargs["port"] = startup_nodes[0]["port"]
self._client = Redis(**kwargs)
Expand Down

0 comments on commit 49a9c5f

Please sign in to comment.