Skip to content

Commit

Permalink
*: format log fields using kebab-case style (#8956)
Browse files Browse the repository at this point in the history
ref #4322

Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx authored Jan 2, 2025
1 parent 5ad4301 commit c2d4854
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions pkg/core/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ func scanRegion(regionTree *regionTree, keyRange *KeyRange, limit int, outputMus
keyRange.StartKey, keyRange.EndKey,
lastRegion.GetStartKey(), lastRegion.GetEndKey(),
region.GetStartKey(), region.GetEndKey())
log.Warn("scan regions failed", zap.Bool("outputMustContainAllKeyRange",
log.Warn("scan regions failed", zap.Bool("contain-all-key-range",
outputMustContainAllKeyRange), zap.Error(err))
if outputMustContainAllKeyRange {
return false
Expand All @@ -1907,7 +1907,7 @@ func scanRegion(regionTree *regionTree, keyRange *KeyRange, limit int, outputMus
keyRange.StartKey, keyRange.EndKey,
lastRegion.GetStartKey(), lastRegion.GetEndKey(),
lastRegion.GetEndKey(), keyRange.EndKey)
log.Warn("scan regions failed", zap.Bool("outputMustContainAllKeyRange",
log.Warn("scan regions failed", zap.Bool("contain-all-key-range",
outputMustContainAllKeyRange), zap.Error(err))
if outputMustContainAllKeyRange {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/encryption/key_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (m *Manager) rotateKeyIfNeeded(forceUpdate bool) error {
keys.Keys[keyID] = key
keys.CurrentKeyId = keyID
rotated = true
log.Info("ready to create or rotate data encryption key", zap.Uint64("keyID", keyID))
log.Info("ready to create or rotate data encryption key", zap.Uint64("key-id", keyID))
break
}
// Duplicated key id. retry.
Expand Down
2 changes: 1 addition & 1 deletion pkg/keyspace/keyspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ func (manager *Manager) UpdateKeyspaceState(name string, newState keyspacepb.Key
return nil, err
}
log.Info("[keyspace] keyspace state updated",
zap.Uint32("ID", meta.GetId()),
zap.Uint32("id", meta.GetId()),
zap.String("keyspace-id", meta.GetName()),
zap.String("new-state", newState.String()),
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/mcs/resourcemanager/server/token_buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (gts *GroupTokenBucketState) balanceSlotTokens(
if time.Since(slot.lastReqTime) >= slotExpireTimeout {
delete(gts.tokenSlots, clientUniqueID)
log.Info("delete resource group slot because expire", zap.Time("last-req-time", slot.lastReqTime),
zap.Any("expire timeout", slotExpireTimeout), zap.Any("del client id", clientUniqueID), zap.Any("len", len(gts.tokenSlots)))
zap.Duration("expire-timeout", slotExpireTimeout), zap.Uint64("del-client-id", clientUniqueID), zap.Int("len", len(gts.tokenSlots)))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/memory/meminfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ func InitMemoryHook() {
MemTotal = MemTotalCGroup
MemUsed = MemUsedCGroup
sysutil.RegisterGetMemoryCapacity(MemTotalCGroup)
log.Info("use cgroup memory hook", zap.Int64("cgroupMemorySize", int64(cgroupValue)), zap.Int64("physicalMemorySize", int64(physicalValue)))
log.Info("use cgroup memory hook", zap.Int64("cgroup-memory-size", int64(cgroupValue)), zap.Int64("physical-memory-size", int64(physicalValue)))
} else {
log.Info("use physical memory hook", zap.Int64("cgroupMemorySize", int64(cgroupValue)), zap.Int64("physicalMemorySize", int64(physicalValue)))
log.Info("use physical memory hook", zap.Int64("cgroup-memory-size", int64(cgroupValue)), zap.Int64("physical-memory-size", int64(physicalValue)))
}
_, err = MemTotal()
mustNil(err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/schedule/config/store_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (c *StoreConfig) CheckRegionKeys(keys, mergeKeys uint64) error {
}

if smallKeys := keys % c.GetRegionSplitKeys(); smallKeys <= mergeKeys && smallKeys > 0 {
log.Debug("region keys is too small", zap.Uint64("keys", keys), zap.Uint64("merge-keys", mergeKeys), zap.Uint64("smallSize", smallKeys))
log.Debug("region keys is too small", zap.Uint64("keys", keys), zap.Uint64("merge-keys", mergeKeys), zap.Uint64("small-keys", smallKeys))
return errs.ErrCheckerMergeAgain.FastGenByArgs("the smallest region of the split regions is less than max-merge-region-keys")
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/schedule/schedulers/grant_hot_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (s *grantHotRegionScheduler) randomSchedule(cluster sche.SchedulerCluster,
op, err := s.transfer(cluster, peer.RegionID, srcStoreID, isLeader)
if err != nil {
log.Debug("fail to create grant hot region operator", zap.Uint64("region-id", peer.RegionID),
zap.Uint64("src store id", srcStoreID), errs.ZapError(err))
zap.Uint64("src-store-id", srcStoreID), errs.ZapError(err))
continue
}
return []*operator.Operator{op}
Expand Down
2 changes: 1 addition & 1 deletion pkg/tso/global_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (gta *GlobalTSOAllocator) primaryElectionLoop() {
zap.String("server-name", gta.member.Name()),
zap.String("expected-primary-id", expectedPrimary),
zap.Uint64("member-id", gta.member.ID()),
zap.String("cur-memberValue", gta.member.MemberValue()))
zap.String("cur-member-value", gta.member.MemberValue()))
time.Sleep(200 * time.Millisecond)
continue
}
Expand Down
22 changes: 11 additions & 11 deletions pkg/tso/keyspace_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ func (kgm *KeyspaceGroupManager) mergingChecker(ctx context.Context, mergeTarget
log.Info("start to merge the keyspace group",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList))
zap.Uint32s("merge-list", mergeList))
defer logutil.LogPanic()
defer kgm.wg.Done()

Expand All @@ -1316,7 +1316,7 @@ mergeLoop:
log.Info("merging checker is closed",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList))
zap.Uint32s("merge-list", mergeList))
return
case <-checkTicker.C:
}
Expand All @@ -1326,7 +1326,7 @@ mergeLoop:
log.Warn("unable to get the merge target allocator manager",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("keyspace-group-id", mergeTargetID),
zap.Any("merge-list", mergeList),
zap.Uint32s("merge-list", mergeList),
zap.Error(err))
continue
}
Expand All @@ -1336,7 +1336,7 @@ mergeLoop:
log.Debug("current tso node is not the merge target primary",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList))
zap.Uint32s("merge-list", mergeList))
continue
}
// Check if the keyspace group primaries in the merge map are all gone.
Expand All @@ -1351,7 +1351,7 @@ mergeLoop:
log.Error("failed to check if the keyspace group primary in the merge list has gone",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList),
zap.Uint32s("merge-list", mergeList),
zap.Uint32("merge-id", id),
zap.Any("remaining", mergeMap),
zap.Error(err))
Expand All @@ -1370,7 +1370,7 @@ mergeLoop:
"start to calculate the newly merged TSO",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList))
zap.Uint32s("merge-list", mergeList))
// All the keyspace group primaries in the merge list are gone,
// calculate the newly merged TSO to make sure it is greater than the original ones.
var mergedTS time.Time
Expand All @@ -1380,7 +1380,7 @@ mergeLoop:
log.Error("failed to load the keyspace group TSO",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList),
zap.Uint32s("merge-list", mergeList),
zap.Uint32("merge-id", id),
zap.Time("ts", ts),
zap.Error(err))
Expand All @@ -1396,7 +1396,7 @@ mergeLoop:
log.Info("start to set the newly merged TSO",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList),
zap.Uint32s("merge-list", mergeList),
zap.Time("merged-ts", mergedTS))
err = am.GetAllocator().SetTSO(
tsoutil.GenerateTS(tsoutil.GenerateTimestamp(mergedTS, 1)),
Expand All @@ -1405,7 +1405,7 @@ mergeLoop:
log.Error("failed to update the newly merged TSO",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList),
zap.Uint32s("merge-list", mergeList),
zap.Time("merged-ts", mergedTS),
zap.Error(err))
continue
Expand All @@ -1417,15 +1417,15 @@ mergeLoop:
log.Error("failed to finish the merge",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList),
zap.Uint32s("merge-list", mergeList),
zap.Error(err))
continue
}
kgm.metrics.mergeDuration.Observe(time.Since(startTime).Seconds())
log.Info("finished merging keyspace group",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
zap.Uint32("merge-target-id", mergeTargetID),
zap.Any("merge-list", mergeList),
zap.Uint32s("merge-list", mergeList),
zap.Time("merged-ts", mergedTS))
return
}
Expand Down
2 changes: 1 addition & 1 deletion server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,7 @@ func (s *GrpcServer) ReportMinResolvedTS(ctx context.Context, request *pdpb.Repo
}
log.Debug("updated min resolved-ts",
zap.Uint64("store", storeID),
zap.Uint64("min resolved-ts", minResolvedTS))
zap.Uint64("min-resolved-ts", minResolvedTS))
return &pdpb.ReportMinResolvedTsResponse{
Header: wrapHeader(),
}, nil
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ func (s *Server) GetExternalTS() uint64 {
func (s *Server) SetExternalTS(externalTS, globalTS uint64) error {
if tsoutil.CompareTimestampUint64(externalTS, globalTS) == 1 {
desc := "the external timestamp should not be larger than global ts"
log.Error(desc, zap.Uint64("request timestamp", externalTS), zap.Uint64("global ts", globalTS))
log.Error(desc, zap.Uint64("request-timestamp", externalTS), zap.Uint64("global-ts", globalTS))
return errors.New(desc)
}
c := s.GetRaftCluster()
Expand Down
2 changes: 1 addition & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func CheckPDVersionWithClusterVersion(opt *config.PersistOptions) {
if pdVersion.LessThan(clusterVersion) {
log.Warn(
"PD version less than cluster version, please upgrade PD",
zap.String("PD-version", pdVersion.String()),
zap.String("pd-version", pdVersion.String()),
zap.String("cluster-version", clusterVersion.String()))
}
}
Expand Down

0 comments on commit c2d4854

Please sign in to comment.