Make Etcd log level configurable. (#15737)

Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>
pull/15753/head
Nemo 2022-02-25 15:03:53 +08:00 committed by GitHub
parent a05df77e96
commit cdcb3627b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -21,6 +21,10 @@ etcd:
rootPath: by-dev # The root path where data is stored in etcd rootPath: by-dev # The root path where data is stored in etcd
metaSubPath: meta # metaRootPath = rootPath + '/' + metaSubPath metaSubPath: meta # metaRootPath = rootPath + '/' + metaSubPath
kvSubPath: kv # kvRootPath = rootPath + '/' + kvSubPath kvSubPath: kv # kvRootPath = rootPath + '/' + kvSubPath
log:
level: info # Only supports debug, info, warn, error, panic, or fatal. Default 'info'.
use:
embed: false # Whether to enable embedded Etcd (an in-process EtcdServer).
# Related configuration of minio, which is responsible for data persistence for Milvus. # Related configuration of minio, which is responsible for data persistence for Milvus.
minio: minio:
@ -203,7 +207,7 @@ localStorage:
# Configures the system log output. # Configures the system log output.
log: log:
level: debug # info, warn, error, panic, fatal level: info # Only supports debug, info, warn, error, panic, or fatal. Default 'info'.
file: file:
rootPath: "" # default to stdout, stderr rootPath: "" # default to stdout, stderr
maxSize: 300 # MB maxSize: 300 # MB

View File

@ -46,6 +46,7 @@ func InitEtcdServer(etcdCfg *paramtable.EtcdConfig) error {
cfg = embed.NewConfig() cfg = embed.NewConfig()
} }
cfg.Dir = etcdCfg.DataDir cfg.Dir = etcdCfg.DataDir
cfg.LogLevel = etcdCfg.EtcdLogLevel
e, err := embed.StartEtcd(cfg) e, err := embed.StartEtcd(cfg)
if err != nil { if err != nil {
return err return err

View File

@ -28,6 +28,7 @@ import (
const ( const (
// SuggestPulsarMaxMessageSize defines the maximum size of Pulsar message. // SuggestPulsarMaxMessageSize defines the maximum size of Pulsar message.
SuggestPulsarMaxMessageSize = 5 * 1024 * 1024 SuggestPulsarMaxMessageSize = 5 * 1024 * 1024
defaultEtcdLogLevel = "info"
) )
// ServiceParam is used to quickly and easily access all basic service configurations. // ServiceParam is used to quickly and easily access all basic service configurations.
@ -58,6 +59,7 @@ type EtcdConfig struct {
Endpoints []string Endpoints []string
MetaRootPath string MetaRootPath string
KvRootPath string KvRootPath string
EtcdLogLevel string
// --- Embed ETCD --- // --- Embed ETCD ---
UseEmbedEtcd bool UseEmbedEtcd bool
@ -80,6 +82,7 @@ func (p *EtcdConfig) LoadCfgToMemory() {
} }
p.initMetaRootPath() p.initMetaRootPath()
p.initKvRootPath() p.initKvRootPath()
p.initEtcdLogLevel()
} }
func (p *EtcdConfig) initUseEmbedEtcd() { func (p *EtcdConfig) initUseEmbedEtcd() {
@ -131,6 +134,10 @@ func (p *EtcdConfig) initKvRootPath() {
p.KvRootPath = path.Join(rootPath, subPath) p.KvRootPath = path.Join(rootPath, subPath)
} }
func (p *EtcdConfig) initEtcdLogLevel() {
p.EtcdLogLevel = p.Base.LoadWithDefault("etcd.log.level", defaultEtcdLogLevel)
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// --- pulsar --- // --- pulsar ---
type PulsarConfig struct { type PulsarConfig struct {