manager

package
v1.1.19 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package manager for managing pipeline scripts

Package manager for managing pipeline scripts

Package manager for managing pipeline scripts

Index

Constants

View Source
const (
	TypIPLOC    = "iploc"
	TypGeoLite2 = "geolite2"
)
View Source
const (
	// pipeline关键字段.
	FieldTime       = "time"
	FieldMessage    = "message"
	FieldStatus     = "status"
	PlLoggingSource = "source"

	DefaultStatus = "unknown"
)
View Source
const (
	DefaultScriptNS = "default" // 内置 pl script, 优先级最低
	GitRepoScriptNS = "gitrepo" // git 管理的 pl script
	ConfdScriptNS   = "confd"   // confd 管理的 pl script
	RemoteScriptNS  = "remote"  // remote pl script,优先级最高
)

Variables

This section is empty.

Functions

func CategoryDirName

func CategoryDirName() map[point.Category]string

func CopyDefalutPatterns

func CopyDefalutPatterns() map[string]string

func FillScriptCategoryMap

func FillScriptCategoryMap(scripts map[point.Category](map[string]string)) map[point.Category](map[string]string)

func InitIPdb

func InitIPdb(dataDir string, pipelineCfg *PipelineCfg) (ipdb.IPdb, error)

InitIPdb init ipdb instance.

func InitLog

func InitLog()

func InitStore

func InitStore(center *Manager, installDir string, tags map[string]string)

func LoadDefaultScripts2Store

func LoadDefaultScripts2Store(center *Manager, rootDir string, tags map[string]string)

func LoadPatterns

func LoadPatterns(patternDir string) error

func LoadScript

func LoadScript(centor *Manager, category point.Category, ns string,
	scripts, path, tags map[string]string,
)

func LoadScripts

func LoadScripts(center *Manager, ns string, scripts, scriptPath map[point.Category](map[string]string),
	tags map[string]string,
)

LoadScripts is used to load and clean the script, parameter scripts example: {datakit.Logging: {ScriptName: ScriptContent},... }.

func LoadScripts2StoreFromPlStructPath

func LoadScripts2StoreFromPlStructPath(center *Manager, ns, plPath string, tags map[string]string)

func NSFindPriority

func NSFindPriority(ns string) int

func NewScripts

func NewScripts(scripts, scriptPath, scriptTags map[string]string, ns string, cat point.Category,
	buks ...*plmap.AggBuckets,
) (map[string]*PlScript, map[string]error)

func ProcLoggingStatus

func ProcLoggingStatus(plpt ptinput.PlInputPt, disable bool, ignore []string)

func ReadPlScriptFromDir

func ReadPlScriptFromDir(dirPath string) (map[string]string, map[string]string)

func ReadPlScriptFromFile

func ReadPlScriptFromFile(fp string) (string, string, error)

func ReadPlScriptFromPlStructPath

func ReadPlScriptFromPlStructPath(basePath string) (
	map[point.Category](map[string]string), map[point.Category](map[string]string),
)

func SearchPlFilePathFormDir

func SearchPlFilePathFormDir(dirPath string) map[string]string

func SearchPlFilePathFromPlStructPath

func SearchPlFilePathFromPlStructPath(basePath string) map[point.Category](map[string]string)

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(cfg ManagerCfg) *Manager

func (*Manager) GetScriptRelation

func (c *Manager) GetScriptRelation() *relation.ScriptRelation

func (*Manager) QueryScript

func (c *Manager) QueryScript(category point.Category, name string) (*PlScript, bool)

func (*Manager) ScriptCount

func (c *Manager) ScriptCount(category point.Category) int

type ManagerCfg

type ManagerCfg struct {
	// contains filtered or unexported fields
}

func NewManagerCfg

func NewManagerCfg(upFn plmap.UploadFunc, gTags [][2]string) ManagerCfg

type Option

type Option struct {
	MaxFieldValLen        int // deprecated
	DisableAddStatusField bool
	IgnoreStatus          []string
	ScriptMap             map[string]string
}

type PipelineCfg

type PipelineCfg struct {
	IPdbAttr               map[string]string      `toml:"ipdb_attr"`
	IPdbType               string                 `toml:"ipdb_type"`
	RemotePullInterval     string                 `toml:"remote_pull_interval"`
	ReferTableURL          string                 `toml:"refer_table_url"`
	ReferTablePullInterval string                 `toml:"refer_table_pull_interval"`
	UseSQLite              bool                   `toml:"use_sqlite"`
	SQLiteMemMode          bool                   `toml:"sqlite_mem_mode"`
	Offload                *offload.OffloadConfig `toml:"offload"`
}

type PlScript

type PlScript struct {
	// contains filtered or unexported fields
}

func (*PlScript) Category

func (script *PlScript) Category() point.Category

func (*PlScript) Engine

func (script *PlScript) Engine() *plruntime.Script

func (PlScript) FilePath

func (script PlScript) FilePath() string

func (*PlScript) NS

func (script *PlScript) NS() string

func (*PlScript) Name

func (script *PlScript) Name() string

func (*PlScript) Run

func (script *PlScript) Run(plpt ptinput.PlInputPt, signal plruntime.Signal, opt *Option,
) error

func (*PlScript) SetAggBuks

func (script *PlScript) SetAggBuks(buks *plmap.AggBuckets)

type ScriptStore

type ScriptStore struct {
	// contains filtered or unexported fields
}

func NewScriptStore

func NewScriptStore(category point.Category, cfg ManagerCfg) *ScriptStore

func (*ScriptStore) Count

func (store *ScriptStore) Count() int

func (*ScriptStore) GetWithNs

func (store *ScriptStore) GetWithNs(name, ns string) (*PlScript, bool)

func (*ScriptStore) IndexGet

func (store *ScriptStore) IndexGet(name string) (*PlScript, bool)

func (*ScriptStore) LoadDotPScript2Store

func (store *ScriptStore) LoadDotPScript2Store(ns, dirPath string, scriptTags map[string]string, filePath []string)

func (*ScriptStore) UpdateScriptsWithNS

func (store *ScriptStore) UpdateScriptsWithNS(ns string,
	namedScript, scriptPath, scriptTags map[string]string,
) map[string]error

Directories

Path Synopsis
Package relation record source-name relation
Package relation record source-name relation

Jump to

Keyboard shortcuts

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