script

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecCmdLine = utils.RunString

ExecCmdLine is so tests can mock out exec.Command usage.

Functions

func FormatOutput

func FormatOutput(out []byte, ts int64, offsetTime time.Duration, handler tasks.TimestampHandler) (map[int64]map[string]tasks.PromEvent, error)

FormatOutput 解析 Prom 格式数据,输出结构化数据,同时输出失败记录

func New

func New(globalConfig define.Config, taskConfig define.TaskConfig) define.Task

func ShellWordPreProcess

func ShellWordPreProcess(cmdline string) string

Types

type Event

type Event struct {
	DataID    int32
	TaskID    int32
	TaskType  string
	ErrorCode define.NamedCode
	BizID     int32
	StartAt   time.Time
	EndAt     time.Time
	Dimension common.MapStr
	Metric    common.MapStr
	Message   string
	Timestamp int64
	LocalTime string
	UTCTime   string
	UserTime  string
	Labels    []map[string]string
	Exemplar  common.MapStr
}

func NewEvent

func NewEvent(t define.Task) *Event

func (*Event) AsMapStr

func (e *Event) AsMapStr() common.MapStr

func (*Event) GetType

func (e *Event) GetType() string

func (*Event) IgnoreCMDBLevel

func (e *Event) IgnoreCMDBLevel() bool

func (*Event) Success

func (e *Event) Success()

Success 普通指标事件正常结束

func (*Event) TaskDuration

func (e *Event) TaskDuration() time.Duration

type Gather

type Gather struct {
	tasks.BaseTask
}

func (*Gather) KeepOneDimension

func (g *Gather) KeepOneDimension(data map[int64]map[string]tasks.PromEvent)

KeepOneDimension 只在测试模式需要这么处理 指标名+维度字段名 作为唯一的 key 不同维度值只保留一个,但是如果有多的维度名,那么需要保留,详细可以看 test 里的案例

func (*Gather) Run

func (g *Gather) Run(ctx context.Context, e chan<- define.Event)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL