Skip to content

Commit 0310179

Browse files
author
zhongming Fan
committed
kingbase: database mode
1 parent bb06d5a commit 0310179

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

config/config.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ const (
2424
)
2525

2626
var (
27-
EnablePing bool
28-
IgnoreMissingVals bool
29-
DsnOverride string
30-
TargetLabel string
27+
EnablePing bool
28+
IgnoreMissingVals bool
29+
DsnOverride string
30+
TargetLabel string
31+
kingbaseDatabaseMode = os.Getenv("KINGBASE.DATABASE_MODE")
3132
)
3233

3334
// Load attempts to parse the given config file and return a Config object.
@@ -177,6 +178,13 @@ func (c *Config) YAML() ([]byte, error) {
177178
// loadCollectorFiles resolves all collector file globs to files and loads the collectors they define.
178179
func (c *Config) loadCollectorFiles() error {
179180
baseDir := filepath.Dir(c.configFile)
181+
182+
// pg模式下写死采集sql文件
183+
if kingbaseDatabaseMode == "pg" {
184+
klog.Warningf("Using pg mode, setting collector files to kingbase.collector.pg.yml")
185+
c.CollectorFiles = []string{"kingbase.collector.pg.yml"}
186+
}
187+
180188
for _, cfglob := range c.CollectorFiles {
181189
// Resolve relative paths by joining them to the configuration file's directory.
182190
if len(cfglob) > 0 && !filepath.IsAbs(cfglob) {

0 commit comments

Comments
 (0)