Skip to content

Commit

Permalink
enhance: Change some frequency log to rated level (milvus-io#29720)
Browse files Browse the repository at this point in the history
This PR change some frequency log to rated level

Signed-off-by: Wei Liu <[email protected]>
  • Loading branch information
weiliu1031 authored Jan 11, 2024
1 parent 673f980 commit 7978479
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion internal/proxy/meta_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ func (m *MetaCache) DeprecateShardCache(database, collectionName string) {
}

func (m *MetaCache) expireShardLeaderCache(ctx context.Context) {
log := log.Ctx(ctx).WithRateGroup("proxy.expireShardLeaderCache", 1, 60)
go func() {
ticker := time.NewTicker(params.Params.ProxyCfg.ShardLeaderCacheInterval.GetAsDuration(time.Second))
defer ticker.Stop()
Expand All @@ -941,7 +942,7 @@ func (m *MetaCache) expireShardLeaderCache(ctx context.Context) {
case <-ticker.C:
m.mu.RLock()
for database, db := range m.collInfo {
log.Info("expire all shard leader cache",
log.RatedInfo(10, "expire all shard leader cache",
zap.String("database", database),
zap.Strings("collections", lo.Keys(db)))
for _, info := range db {
Expand Down
4 changes: 2 additions & 2 deletions internal/querycoordv2/observers/collection_observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (ob *CollectionObserver) observeLoadStatus(ctx context.Context) {
}

func (ob *CollectionObserver) observePartitionLoadStatus(ctx context.Context, partition *meta.Partition, replicaNum int32) {
log := log.With(
log := log.Ctx(ctx).WithRateGroup("qcv2.observePartitionLoadStatus", 1, 60).With(
zap.Int64("collectionID", partition.GetCollectionID()),
zap.Int64("partitionID", partition.GetPartitionID()),
)
Expand All @@ -185,7 +185,7 @@ func (ob *CollectionObserver) observePartitionLoadStatus(ctx context.Context, pa
return
}

log.Info("partition targets",
log.RatedInfo(10, "partition targets",
zap.Int("segmentTargetNum", len(segmentTargets)),
zap.Int("channelTargetNum", len(channelTargets)),
zap.Int("totalTargetNum", targetNum),
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/etcd_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ func (es *EtcdSource) UpdateOptions(opts Options) {
}

func (es *EtcdSource) refreshConfigurations() error {
log := log.Ctx(context.TODO()).WithRateGroup("config.etcdSource", 1, 60)
es.RLock()
prefix := path.Join(es.keyPrefix, "config")
es.RUnlock()

ctx, cancel := context.WithTimeout(es.ctx, ReadConfigTimeout)
defer cancel()
log.Debug("etcd refreshConfigurations", zap.String("prefix", prefix), zap.Any("endpoints", es.etcdCli.Endpoints()))
log.RatedDebug(10, "etcd refreshConfigurations", zap.String("prefix", prefix), zap.Any("endpoints", es.etcdCli.Endpoints()))
response, err := es.etcdCli.Get(ctx, prefix, clientv3.WithPrefix(), clientv3.WithSerializable())
if err != nil {
return err
Expand Down

0 comments on commit 7978479

Please sign in to comment.