Skip to content

Commit

Permalink
Merge pull request #1203 from PapaPiya/fix_metric_meta
Browse files Browse the repository at this point in the history
[PDR-16341][fix(meta)]: 监控采集任务meta目录设置不生效
  • Loading branch information
redHJ authored Jan 21, 2022
2 parents 01200fd + fe1201d commit 480816e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mgr/metric_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package mgr
import (
"errors"
"fmt"
"path/filepath"
"runtime/debug"
"strconv"
"strings"
Expand Down Expand Up @@ -82,10 +83,15 @@ func NewMetricRunner(rc RunnerConfig, wg *sync.WaitGroup, sr *sender.Registry) (
return nil, errors.New("Runner " + rc.RunnerName + " has no metric, ignore it")
}
interval := time.Duration(rc.CollectInterval) * time.Second
metaPath := ""
if rc.MetaDir != "" {
metaPath = filepath.Join(rc.MetaDir, fmt.Sprintf("%s_%s", rc.RunnerName, Hash("")))
}
cf := conf.MapConf{
GlobalKeyName: rc.RunnerName,
KeyRunnerName: rc.RunnerName,
KeyMode: reader.ModeMetrics,
KeyMetaPath: metaPath,
}
if rc.ExtraInfo {
cf[ExtraInfo] = Bool2String(rc.ExtraInfo)
Expand Down
1 change: 1 addition & 0 deletions mgr/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type RunnerInfo struct {
InternalKeyPrefix string `json:"internal_key_prefix"` // 内置字段名前缀
MaxLineLen int64 `json:"max_line_len"` // 限制单条数据/每个key对应的value大小,防止读取数据/发送数据出错时内存/磁盘占用过大
IsBlock bool `json:"is_block"` // 阻塞式发送
MetaDir string `json:"meta_dir"` // meta目录
}

type ErrorsList struct {
Expand Down

0 comments on commit 480816e

Please sign in to comment.