Documentation ¶
Index ¶
- Constants
- Variables
- func AddMetadata(collector ilogtail.Collector, time time.Time, node *MetaNode)
- func AddMetric(collector ilogtail.Collector, name string, time time.Time, labels string, ...)
- func ContainerCenterInit()
- func ContainerProcessAlive(pid int) bool
- func CreateDockerClient(opt ...docker.Opt) (client *docker.Client, err error)
- func ExtractPodWorkload(name string) string
- func ExtractStatefulSetNum(pod string) int
- func GetAddressAndDialer(endpoint string) (string, func(addr string, timeout time.Duration) (net.Conn, error), error)
- func GetContainerByAcceptedInfo(includeLabel map[string]string, excludeLabel map[string]string, ...) map[string]*DockerInfoDetail
- func GetContainerByAcceptedInfoV2(fullList map[string]bool, matchList map[string]*DockerInfoDetail, ...) (int, int)
- func GetContainersLastUpdateTime() int64
- func GetFileOffsetTag(log *protocol.Log) *protocol.Log_Content
- func GetFreePort() (port int, err error)
- func GetMountedFilePath(logPath string) string
- func GetMountedFilePathWithBasePath(basePath, logPath string) string
- func HasEnvTags(tagKey string, tagValue string) bool
- func IsCRIRuntimeValid(criRuntimeEndpoint string) bool
- func IsCRIStatusValid(criRuntimeEndpoint string) bool
- func IsSafeString(str1, str2 string) bool
- func LoadEnvTags()
- func MakeMetric(name string, labels string, timeNano int64, value float64) ([]string, []string)
- func NewAverageMetric(n string) ilogtail.CounterMetric
- func NewAverageMetricAndRegister(n string, c ilogtail.Context) ilogtail.CounterMetric
- func NewCounterMetric(n string) ilogtail.CounterMetric
- func NewCounterMetricAndRegister(n string, c ilogtail.Context) ilogtail.CounterMetric
- func NewGoKitLogWrapper(context ilogtail.Context, alarmType string) log.Logger
- func NewLatencyMetric(n string) ilogtail.LatencyMetric
- func NewLatencyMetricAndRegister(n string, c ilogtail.Context) ilogtail.LatencyMetric
- func NewStringMetric(n string) ilogtail.StringMetric
- func NewStringMetricAndRegister(n string, c ilogtail.Context) ilogtail.StringMetric
- func NormalizeWindowsPath(path string) string
- func ProcessContainerAllInfo(processor func(*DockerInfoDetail))
- func ReadOpen(path string) (*os.File, error)
- func RegisterDockerEventListener(c chan events.Message)
- func ReplaceInvalidChars(in *string)
- func ReviseFileOffset(log *protocol.Log, offset int64, enableMeta bool)
- func SetEnvConfigPrefix(prefix string)
- func SplitRegexFromMap(input map[string]string) (staticResult map[string]string, regexResult map[string]*regexp.Regexp, ...)
- func StartService(name string, context ilogtail.Context, f func())
- func UnRegisterDockerEventListener(c chan events.Message)
- func ZeroCopySlice(s string) (b []byte)
- func ZeroCopyString(b []byte) (s string)
- type Attributes
- type AvgMetric
- type CRIRuntimeWrapper
- type ContainerDiscoverManager
- func (c *ContainerDiscoverManager) Clean()
- func (c *ContainerDiscoverManager) FetchAll()
- func (c *ContainerDiscoverManager) FetchOne(containerID string) error
- func (c *ContainerDiscoverManager) Init(initTryTimes int)
- func (c *ContainerDiscoverManager) LogAlarm(err error, msg string)
- func (c *ContainerDiscoverManager) SyncContainers()
- func (c *ContainerDiscoverManager) TimerFetch()
- type ContainerMeta
- type DockerCenter
- type DockerInfoDetail
- func (did *DockerInfoDetail) DiffMount(other *DockerInfoDetail) bool
- func (did *DockerInfoDetail) DiffName(other *DockerInfoDetail) bool
- func (did *DockerInfoDetail) FindAllEnvConfig(envConfigPrefix string, selfConfigFlag bool)
- func (did *DockerInfoDetail) FindBestMatchedPath(pth string) (sourcePath, containerPath string)
- func (did *DockerInfoDetail) GetCustomExternalTags(tags, envs, k8sLabels map[string]string)
- func (did *DockerInfoDetail) GetEnv(key string) string
- func (did *DockerInfoDetail) GetExternalTags(envs, k8sLabels map[string]string) map[string]string
- func (did *DockerInfoDetail) IDPrefix() string
- func (did *DockerInfoDetail) IsTimeout() bool
- func (did *DockerInfoDetail) MakeSureEnvConfigExist(configName string) *EnvConfigInfo
- func (did *DockerInfoDetail) PodName() string
- func (did *DockerInfoDetail) Status() string
- type EnvConfigInfo
- type GrpcClientConfig
- type K8SFilter
- type K8SInfo
- type KeyValue
- type KeyValues
- func (kv *KeyValues) Append(key, value string)
- func (kv *KeyValues) AppendMap(mapVal map[string]string)
- func (kv *KeyValues) Clone() KeyValues
- func (kv *KeyValues) Len() int
- func (kv *KeyValues) Less(i, j int) bool
- func (kv *KeyValues) Replace(key, value string)
- func (kv *KeyValues) Sort()
- func (kv *KeyValues) String() string
- func (kv *KeyValues) Swap(i, j int)
- type Labels
- type LatMetric
- type LocalCollector
- func (p *LocalCollector) AddData(tags map[string]string, fields map[string]string, t ...time.Time)
- func (p *LocalCollector) AddDataArray(tags map[string]string, columns []string, values []string, t ...time.Time)
- func (p *LocalCollector) AddDataArrayWithContext(tags map[string]string, columns []string, values []string, ...)
- func (p *LocalCollector) AddDataWithContext(tags map[string]string, fields map[string]string, ctx map[string]interface{}, ...)
- func (p *LocalCollector) AddRawLog(log *protocol.Log)
- func (p *LocalCollector) AddRawLogWithContext(log *protocol.Log, ctx map[string]interface{})
- type LocalContext
- func (p *LocalContext) AddPlugin(name string)
- func (p *LocalContext) GetCheckPoint(key string) (value []byte, exist bool)
- func (p *LocalContext) GetCheckPointObject(key string, obj interface{}) (exist bool)
- func (p *LocalContext) GetConfigName() string
- func (p *LocalContext) GetLogstore() string
- func (p *LocalContext) GetProject() string
- func (p *LocalContext) GetRuntimeContext() context.Context
- func (p *LocalContext) InitContext(project, logstore, configName string)
- func (p *LocalContext) MetricSerializeToPB(log *protocol.Log)
- func (p *LocalContext) RegisterCounterMetric(metric ilogtail.CounterMetric)
- func (p *LocalContext) RegisterLatencyMetric(metric ilogtail.LatencyMetric)
- func (p *LocalContext) RegisterStringMetric(metric ilogtail.StringMetric)
- func (p *LocalContext) SaveCheckPoint(key string, value []byte) error
- func (p *LocalContext) SaveCheckPointObject(key string, obj interface{}) error
- type LogFileProcessor
- type LogFileReader
- func (r *LogFileReader) CheckFileChange() bool
- func (r *LogFileReader) CloseFile(reason string)
- func (r *LogFileReader) GetCheckpoint() (checkpoint LogFileReaderCheckPoint, updateFlag bool)
- func (r *LogFileReader) GetLastEndOfLine(n int) int
- func (r *LogFileReader) GetProcessor() LogFileProcessor
- func (r *LogFileReader) ProcessAfterRead(n int)
- func (r *LogFileReader) ReadAndProcess(once bool)
- func (r *LogFileReader) ReadOpen() error
- func (r *LogFileReader) Run()
- func (r *LogFileReader) SetForceRead()
- func (r *LogFileReader) Start()
- func (r *LogFileReader) Stop()
- func (r *LogFileReader) UpdateProcessResult(readN, processedN int)
- type LogFileReaderCheckPoint
- type LogFileReaderConfig
- type ManagerMeta
- type MetaNode
- func (v MetaNode) MarshalEasyJSON(w *jwriter.Writer)
- func (v MetaNode) MarshalJSON() ([]byte, error)
- func (v *MetaNode) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *MetaNode) UnmarshalJSON(data []byte) error
- func (n *MetaNode) WithAttribute(k string, v interface{}) *MetaNode
- func (n *MetaNode) WithAttributes(attributes Attributes) *MetaNode
- func (n *MetaNode) WithLabel(k, v string) *MetaNode
- func (n *MetaNode) WithLabels(labels Labels) *MetaNode
- func (n *MetaNode) WithParent(key, parentID, parentName string) *MetaNode
- func (n *MetaNode) WithParents(parents Parents) *MetaNode
- type NormalMetric
- type Parents
- type ReaderMetricTracker
- type RetryConfig
- type RetryInfo
- type StateOS
- type StrMetric
Constants ¶
const ( ContainerStatusRunning = "running" ContainerStatusExited = "exited" )
const ContainerIDPrefixSize = 12
const DockerTimeFormat = "2006-01-02T15:04:05.999999999Z"
Variables ¶
var ContainerInfoDeletedTimeout = time.Second * time.Duration(30)
var DefaultLogFileReaderConfig = LogFileReaderConfig{ ReadIntervalMs: 1000, MaxReadBlockSize: 512 * 1024, CloseFileSec: 60, Tracker: nil, }
var DefaultLogtailMountPath string
var DefaultSyncContainersPeriod = time.Second * 3 // should be same as docker_config_update_interval gflag in C
var DockerCenterTimeout = time.Second * time.Duration(30)
var EnvTags []string
EnvTags to be add to every logroup
var EventListenerTimeout = time.Second * time.Duration(3600)
var FetchAllInterval = time.Second * time.Duration(300)
var FileOffsetKey = "__tag__:__file_offset__"
var MaxFetchOneTriggerPerSecond int32 = 200
Functions ¶
func AddMetadata ¶
AddMetadata to the collector.
func AddMetric ¶
func AddMetric(collector ilogtail.Collector, name string, time time.Time, labels string, value float64)
AddMetric to the collector.
func ContainerCenterInit ¶ added in v1.1.0
func ContainerCenterInit()
func ContainerProcessAlive ¶ added in v1.0.33
func CreateDockerClient ¶ added in v1.1.0
func ExtractPodWorkload ¶ added in v1.2.0
func ExtractStatefulSetNum ¶ added in v1.2.0
func GetAddressAndDialer ¶
func GetAddressAndDialer(endpoint string) (string, func(addr string, timeout time.Duration) (net.Conn, error), error)
GetAddressAndDialer returns the address parsed from the given endpoint and a dialer.
func GetContainerByAcceptedInfo ¶ added in v1.1.0
func GetContainerByAcceptedInfo( includeLabel map[string]string, excludeLabel map[string]string, includeLabelRegex map[string]*regexp.Regexp, excludeLabelRegex map[string]*regexp.Regexp, includeEnv map[string]string, excludeEnv map[string]string, includeEnvRegex map[string]*regexp.Regexp, excludeEnvRegex map[string]*regexp.Regexp, k8sFilter *K8SFilter, ) map[string]*DockerInfoDetail
GetContainerByAcceptedInfo gathers all info of containers that match the input parameters. Two conditions (&&) for matched container: 1. has a label in @includeLabel and don't have any label in @excludeLabel. 2. has a env in @includeEnv and don't have any env in @excludeEnv. If the input parameters is empty, then all containers are matched. It returns a map contains docker container info.
func GetContainerByAcceptedInfoV2 ¶ added in v1.1.0
func GetContainerByAcceptedInfoV2( fullList map[string]bool, matchList map[string]*DockerInfoDetail, includeLabel map[string]string, excludeLabel map[string]string, includeLabelRegex map[string]*regexp.Regexp, excludeLabelRegex map[string]*regexp.Regexp, includeEnv map[string]string, excludeEnv map[string]string, includeEnvRegex map[string]*regexp.Regexp, excludeEnvRegex map[string]*regexp.Regexp, k8sFilter *K8SFilter, ) (int, int)
GetContainerByAcceptedInfoV2 works like GetContainerByAcceptedInfo, but uses less CPU. It reduces CPU cost by using full list and match list to find containers that need to be check.
deleted = fullList - containerMap newList = containerMap - fullList matchList -= deleted + filter(newList) return len(deleted), len(filter(newList))
@param fullList [in,out]: all containers. @param matchList [in,out]: all matched containers.
It returns two integers: the number of new matched containers
and deleted containers.
func GetContainersLastUpdateTime ¶ added in v1.1.0
func GetContainersLastUpdateTime() int64
func GetFileOffsetTag ¶ added in v1.3.0
func GetFileOffsetTag(log *protocol.Log) *protocol.Log_Content
func GetFreePort ¶ added in v1.1.2
func GetMountedFilePath ¶
func HasEnvTags ¶
HasEnvTags check if specific tags exist in envTags
func IsCRIRuntimeValid ¶
func IsCRIStatusValid ¶ added in v1.0.32
func IsSafeString ¶ added in v1.0.31
func MakeMetric ¶
MakeMetric ...
func NewAverageMetric ¶
func NewAverageMetric(n string) ilogtail.CounterMetric
func NewAverageMetricAndRegister ¶
func NewAverageMetricAndRegister(n string, c ilogtail.Context) ilogtail.CounterMetric
func NewCounterMetric ¶
func NewCounterMetric(n string) ilogtail.CounterMetric
func NewCounterMetricAndRegister ¶
func NewCounterMetricAndRegister(n string, c ilogtail.Context) ilogtail.CounterMetric
func NewGoKitLogWrapper ¶
NewGoKitLogWrapper returns a logger that log with context.
func NewLatencyMetric ¶
func NewLatencyMetric(n string) ilogtail.LatencyMetric
func NewLatencyMetricAndRegister ¶
func NewLatencyMetricAndRegister(n string, c ilogtail.Context) ilogtail.LatencyMetric
func NewStringMetric ¶
func NewStringMetric(n string) ilogtail.StringMetric
func NewStringMetricAndRegister ¶
func NewStringMetricAndRegister(n string, c ilogtail.Context) ilogtail.StringMetric
func NormalizeWindowsPath ¶ added in v1.0.30
NormalizeWindowsPath returns the normal path in heterogeneous platform. parses the root path with windows system driver.
func ProcessContainerAllInfo ¶ added in v1.1.0
func ProcessContainerAllInfo(processor func(*DockerInfoDetail))
func RegisterDockerEventListener ¶ added in v1.1.0
func ReplaceInvalidChars ¶ added in v1.1.2
func ReplaceInvalidChars(in *string)
ReplaceInvalidChars analog of invalidChars = regexp.MustCompile("[^a-zA-Z0-9_]")
func ReviseFileOffset ¶ added in v1.3.0
func SetEnvConfigPrefix ¶
func SetEnvConfigPrefix(prefix string)
func SplitRegexFromMap ¶
func SplitRegexFromMap(input map[string]string) (staticResult map[string]string, regexResult map[string]*regexp.Regexp, err error)
SplitRegexFromMap extract regex from user config regex must begin with ^ and end with $(we only check ^)
func StartService ¶
StartService ..
func UnRegisterDockerEventListener ¶ added in v1.1.0
func ZeroCopySlice ¶ added in v1.0.31
func ZeroCopyString ¶ added in v1.0.31
Types ¶
type Attributes ¶
type Attributes map[string]interface{}
Attributes used to store attributes in common conditions.
func (Attributes) MarshalEasyJSON ¶
func (v Attributes) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Attributes) MarshalJSON ¶
func (v Attributes) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Attributes) UnmarshalEasyJSON ¶
func (v *Attributes) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Attributes) UnmarshalJSON ¶
func (v *Attributes) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type CRIRuntimeWrapper ¶
type CRIRuntimeWrapper struct {
// contains filtered or unexported fields
}
func NewCRIRuntimeWrapper ¶
func NewCRIRuntimeWrapper(dockerCenter *DockerCenter) (*CRIRuntimeWrapper, error)
NewCRIRuntimeWrapper ...
type ContainerDiscoverManager ¶ added in v1.1.0
type ContainerDiscoverManager struct {
// contains filtered or unexported fields
}
func NewContainerDiscoverManager ¶ added in v1.1.0
func NewContainerDiscoverManager(enableDockerDiscover, enableCRIDiscover, enableStaticDiscover bool) *ContainerDiscoverManager
func (*ContainerDiscoverManager) Clean ¶ added in v1.1.0
func (c *ContainerDiscoverManager) Clean()
func (*ContainerDiscoverManager) FetchAll ¶ added in v1.1.0
func (c *ContainerDiscoverManager) FetchAll()
FetchAll Currently, there are 3 ways to find containers, which are docker interface, cri interface and static container info file.
func (*ContainerDiscoverManager) FetchOne ¶ added in v1.1.0
func (c *ContainerDiscoverManager) FetchOne(containerID string) error
func (*ContainerDiscoverManager) Init ¶ added in v1.1.0
func (c *ContainerDiscoverManager) Init(initTryTimes int)
func (*ContainerDiscoverManager) LogAlarm ¶ added in v1.1.0
func (c *ContainerDiscoverManager) LogAlarm(err error, msg string)
func (*ContainerDiscoverManager) SyncContainers ¶ added in v1.1.0
func (c *ContainerDiscoverManager) SyncContainers()
func (*ContainerDiscoverManager) TimerFetch ¶ added in v1.1.0
func (c *ContainerDiscoverManager) TimerFetch()
type ContainerMeta ¶ added in v1.1.1
type ContainerMeta struct { PodName string K8sNamespace string ContainerName string Image string K8sLabels map[string]string ContainerLabels map[string]string Env map[string]string }
func GetContainerMeta ¶ added in v1.1.1
func GetContainerMeta(containerID string) *ContainerMeta
GetContainerMeta get a thread safe container meta struct.
type DockerCenter ¶
type DockerCenter struct {
// contains filtered or unexported fields
}
func (*DockerCenter) CreateInfoDetail ¶
func (dc *DockerCenter) CreateInfoDetail(info types.ContainerJSON, envConfigPrefix string, selfConfigFlag bool) *DockerInfoDetail
CreateInfoDetail create DockerInfoDetail with docker.Container Container property used in this function : HostsPath, Config.Hostname, Name, Config.Image, Config.Env, Mounts ContainerInfo.GraphDriver.Data["UpperDir"] Config.Labels
type DockerInfoDetail ¶
type DockerInfoDetail struct { ContainerInfo types.ContainerJSON ContainerNameTag map[string]string K8SInfo *K8SInfo EnvConfigInfoMap map[string]*EnvConfigInfo ContainerIP string DefaultRootPath string // contains filtered or unexported fields }
func CreateContainerInfoDetail ¶ added in v1.1.0
func CreateContainerInfoDetail(info types.ContainerJSON, envConfigPrefix string, selfConfigFlag bool) *DockerInfoDetail
func GetContainerBySpecificInfo ¶ added in v1.1.0
func GetContainerBySpecificInfo(filter func(*DockerInfoDetail) bool) (infoList []*DockerInfoDetail)
func (*DockerInfoDetail) DiffMount ¶
func (did *DockerInfoDetail) DiffMount(other *DockerInfoDetail) bool
func (*DockerInfoDetail) DiffName ¶
func (did *DockerInfoDetail) DiffName(other *DockerInfoDetail) bool
func (*DockerInfoDetail) FindAllEnvConfig ¶
func (did *DockerInfoDetail) FindAllEnvConfig(envConfigPrefix string, selfConfigFlag bool)
FindAllEnvConfig find and pre process all env config, add tags for docker info
func (*DockerInfoDetail) FindBestMatchedPath ¶
func (did *DockerInfoDetail) FindBestMatchedPath(pth string) (sourcePath, containerPath string)
func (*DockerInfoDetail) GetCustomExternalTags ¶ added in v1.2.0
func (did *DockerInfoDetail) GetCustomExternalTags(tags, envs, k8sLabels map[string]string)
func (*DockerInfoDetail) GetEnv ¶
func (did *DockerInfoDetail) GetEnv(key string) string
func (*DockerInfoDetail) GetExternalTags ¶
func (did *DockerInfoDetail) GetExternalTags(envs, k8sLabels map[string]string) map[string]string
func (*DockerInfoDetail) IDPrefix ¶ added in v1.3.0
func (did *DockerInfoDetail) IDPrefix() string
func (*DockerInfoDetail) IsTimeout ¶
func (did *DockerInfoDetail) IsTimeout() bool
func (*DockerInfoDetail) MakeSureEnvConfigExist ¶
func (did *DockerInfoDetail) MakeSureEnvConfigExist(configName string) *EnvConfigInfo
func (*DockerInfoDetail) PodName ¶ added in v1.3.0
func (did *DockerInfoDetail) PodName() string
func (*DockerInfoDetail) Status ¶ added in v1.3.0
func (did *DockerInfoDetail) Status() string
type EnvConfigInfo ¶
type GrpcClientConfig ¶ added in v1.3.0
type GrpcClientConfig struct { Endpoint string `json:"Endpoint"` // The compression key for supported compression types within collector. Compression string `json:"Compression"` // The headers associated with gRPC requests. Headers map[string]string `json:"Headers"` // Sets the balancer in grpclb_policy to discover the servers. Default is pick_first. // https://github.com/grpc/grpc-go/blob/master/examples/features/load_balancing/README.md BalancerName string `json:"BalancerName"` // WaitForReady parameter configures client to wait for ready state before sending data. // (https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md) WaitForReady bool `json:"WaitForReady"` // ReadBufferSize for gRPC client. See grpchelper.WithReadBufferSize. // (https://godoc.org/google.golang.org/grpc#WithReadBufferSize). ReadBufferSize int `json:"ReadBufferSize"` // WriteBufferSize for gRPC gRPC. See grpchelper.WithWriteBufferSize. // (https://godoc.org/google.golang.org/grpc#WithWriteBufferSize). WriteBufferSize int `json:"WriteBufferSize"` // Send retry setting Retry RetryConfig `json:"Retry"` Timeout int `json:"Timeout"` }
func (*GrpcClientConfig) GetDialOptions ¶ added in v1.3.0
func (cfg *GrpcClientConfig) GetDialOptions() ([]grpc.DialOption, error)
GetDialOptions maps GrpcClientConfig to a slice of dial options for gRPC.
func (*GrpcClientConfig) GetEndpoint ¶ added in v1.3.0
func (cfg *GrpcClientConfig) GetEndpoint() string
func (*GrpcClientConfig) GetTimeout ¶ added in v1.3.0
func (cfg *GrpcClientConfig) GetTimeout() time.Duration
type K8SFilter ¶
type K8SFilter struct { NamespaceReg *regexp.Regexp PodReg *regexp.Regexp ContainerReg *regexp.Regexp IncludeLabels map[string]string ExcludeLabels map[string]string IncludeLabelRegs map[string]*regexp.Regexp ExcludeLabelRegs map[string]*regexp.Regexp // contains filtered or unexported fields }
K8SFilter used for find specific container
type K8SInfo ¶
type K8SInfo struct { Namespace string Pod string ContainerName string Labels map[string]string PausedContainer bool // contains filtered or unexported fields }
"io.kubernetes.container.logpath": "/var/log/pods/222e88ff-8f08-11e8-851d-00163f008685/logtail_0.log", "io.kubernetes.container.name": "logtail", "io.kubernetes.docker.type": "container", "io.kubernetes.pod.name": "logtail-z2224", "io.kubernetes.pod.namespace": "kube-system", "io.kubernetes.pod.uid": "222e88ff-8f08-11e8-851d-00163f008685",
func (*K8SInfo) ExtractK8sLabels ¶
func (info *K8SInfo) ExtractK8sLabels(containerInfo types.ContainerJSON)
ExtractK8sLabels only work for original docker container.
type KeyValues ¶
type KeyValues struct {
// contains filtered or unexported fields
}
KeyValues ...
type Labels ¶
func (Labels) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Labels) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Labels) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Labels) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type LocalCollector ¶
LocalCollector for unit test
func (*LocalCollector) AddDataArray ¶
func (*LocalCollector) AddDataArrayWithContext ¶ added in v1.1.2
func (*LocalCollector) AddDataWithContext ¶ added in v1.1.2
func (*LocalCollector) AddRawLog ¶
func (p *LocalCollector) AddRawLog(log *protocol.Log)
func (*LocalCollector) AddRawLogWithContext ¶ added in v1.1.2
func (p *LocalCollector) AddRawLogWithContext(log *protocol.Log, ctx map[string]interface{})
type LocalContext ¶
type LocalContext struct { StringMetrics map[string]ilogtail.StringMetric CounterMetrics map[string]ilogtail.CounterMetric LatencyMetrics map[string]ilogtail.LatencyMetric AllCheckPoint map[string][]byte // contains filtered or unexported fields }
func (*LocalContext) AddPlugin ¶
func (p *LocalContext) AddPlugin(name string)
func (*LocalContext) GetCheckPoint ¶
func (p *LocalContext) GetCheckPoint(key string) (value []byte, exist bool)
func (*LocalContext) GetCheckPointObject ¶
func (p *LocalContext) GetCheckPointObject(key string, obj interface{}) (exist bool)
func (*LocalContext) GetConfigName ¶
func (p *LocalContext) GetConfigName() string
func (*LocalContext) GetLogstore ¶
func (p *LocalContext) GetLogstore() string
func (*LocalContext) GetProject ¶
func (p *LocalContext) GetProject() string
func (*LocalContext) GetRuntimeContext ¶
func (p *LocalContext) GetRuntimeContext() context.Context
func (*LocalContext) InitContext ¶
func (p *LocalContext) InitContext(project, logstore, configName string)
func (*LocalContext) MetricSerializeToPB ¶
func (p *LocalContext) MetricSerializeToPB(log *protocol.Log)
func (*LocalContext) RegisterCounterMetric ¶
func (p *LocalContext) RegisterCounterMetric(metric ilogtail.CounterMetric)
func (*LocalContext) RegisterLatencyMetric ¶
func (p *LocalContext) RegisterLatencyMetric(metric ilogtail.LatencyMetric)
func (*LocalContext) RegisterStringMetric ¶
func (p *LocalContext) RegisterStringMetric(metric ilogtail.StringMetric)
func (*LocalContext) SaveCheckPoint ¶
func (p *LocalContext) SaveCheckPoint(key string, value []byte) error
func (*LocalContext) SaveCheckPointObject ¶
func (p *LocalContext) SaveCheckPointObject(key string, obj interface{}) error
type LogFileProcessor ¶
type LogFileProcessor interface { // Process the file block and return how many bytes are processed // LogFileReader will find last '\n' and call Process // @note fileBlock may be nil, in this situation, processor should check multi line timeout Process(fileBlock []byte, noChangeInterval time.Duration) int }
LogFileProcessor interface
type LogFileReader ¶
type LogFileReader struct { Config LogFileReaderConfig // contains filtered or unexported fields }
func NewLogFileReader ¶
func NewLogFileReader(context context.Context, checkpoint LogFileReaderCheckPoint, config LogFileReaderConfig, processor LogFileProcessor) (*LogFileReader, error)
func (*LogFileReader) CheckFileChange ¶
func (r *LogFileReader) CheckFileChange() bool
func (*LogFileReader) CloseFile ¶
func (r *LogFileReader) CloseFile(reason string)
func (*LogFileReader) GetCheckpoint ¶
func (r *LogFileReader) GetCheckpoint() (checkpoint LogFileReaderCheckPoint, updateFlag bool)
func (*LogFileReader) GetLastEndOfLine ¶
func (r *LogFileReader) GetLastEndOfLine(n int) int
GetLastEndOfLine return new read bytes end with '\n' @note will return n + r.lastBufferSize when n + r.lastBufferSize == len(r.nowBlock)
func (*LogFileReader) GetProcessor ¶
func (r *LogFileReader) GetProcessor() LogFileProcessor
func (*LogFileReader) ProcessAfterRead ¶
func (r *LogFileReader) ProcessAfterRead(n int)
func (*LogFileReader) ReadAndProcess ¶
func (r *LogFileReader) ReadAndProcess(once bool)
func (*LogFileReader) ReadOpen ¶
func (r *LogFileReader) ReadOpen() error
func (*LogFileReader) Run ¶
func (r *LogFileReader) Run()
func (*LogFileReader) SetForceRead ¶
func (r *LogFileReader) SetForceRead()
SetForceRead force read file when reader start
func (*LogFileReader) Start ¶
func (r *LogFileReader) Start()
func (*LogFileReader) Stop ¶
func (r *LogFileReader) Stop()
func (*LogFileReader) UpdateProcessResult ¶
func (r *LogFileReader) UpdateProcessResult(readN, processedN int)
type LogFileReaderCheckPoint ¶
func (*LogFileReaderCheckPoint) IsSame ¶
func (checkpoint *LogFileReaderCheckPoint) IsSame(other *LogFileReaderCheckPoint) bool
IsSame check if the checkpoints is same
type LogFileReaderConfig ¶
type LogFileReaderConfig struct { ReadIntervalMs int MaxReadBlockSize int CloseFileSec int Tracker *ReaderMetricTracker }
type ManagerMeta ¶ added in v1.1.2
type ManagerMeta struct { Metas map[string]map[string]map[string]struct{} // contains filtered or unexported fields }
ManagerMeta is designed for a special input plugin to log self telemetry data, such as telegraf. The kind of plugin would connect with other agents, so most of them have a global manager to control or connect with other agents.
func NewmanagerMeta ¶ added in v1.1.2
func NewmanagerMeta(configName string) *ManagerMeta
func (*ManagerMeta) Add ¶ added in v1.1.2
func (b *ManagerMeta) Add(prj, logstore, cfg string)
func (*ManagerMeta) Delete ¶ added in v1.1.2
func (b *ManagerMeta) Delete(prj, logstore, cfg string)
func (*ManagerMeta) GetAlarm ¶ added in v1.1.2
func (b *ManagerMeta) GetAlarm() *util.Alarm
func (*ManagerMeta) GetContext ¶ added in v1.1.2
func (b *ManagerMeta) GetContext() context.Context
func (*ManagerMeta) UpdateAlarm ¶ added in v1.1.2
func (b *ManagerMeta) UpdateAlarm()
type MetaNode ¶
type MetaNode struct { ID string Type string Attributes Attributes Labels Labels Parents Parents }
MetaNode describes a superset of the metadata that probes can collect about a given node in a given topology, along with the edges (aka adjacency) emanating from the node.
func NewMetaNode ¶
func (MetaNode) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (MetaNode) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*MetaNode) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*MetaNode) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*MetaNode) WithAttribute ¶
func (*MetaNode) WithAttributes ¶
func (n *MetaNode) WithAttributes(attributes Attributes) *MetaNode
func (*MetaNode) WithLabels ¶
func (*MetaNode) WithParent ¶
func (*MetaNode) WithParents ¶
type NormalMetric ¶
type NormalMetric struct {
// contains filtered or unexported fields
}
func (*NormalMetric) Add ¶
func (s *NormalMetric) Add(v int64)
func (*NormalMetric) Clear ¶
func (s *NormalMetric) Clear(v int64)
func (*NormalMetric) Get ¶
func (s *NormalMetric) Get() int64
func (*NormalMetric) Name ¶
func (s *NormalMetric) Name() string
func (*NormalMetric) Serialize ¶
func (s *NormalMetric) Serialize(log *protocol.Log)
type Parents ¶
type Parents []string
func (Parents) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Parents) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Parents) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Parents) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ReaderMetricTracker ¶
type ReaderMetricTracker struct { OpenCounter ilogtail.CounterMetric CloseCounter ilogtail.CounterMetric FileSizeCounter ilogtail.CounterMetric FileRotatorCounter ilogtail.CounterMetric ReadCounter ilogtail.CounterMetric ReadSizeCounter ilogtail.CounterMetric ProcessLatency ilogtail.LatencyMetric }
func NewReaderMetricTracker ¶
func NewReaderMetricTracker() *ReaderMetricTracker
type RetryConfig ¶ added in v1.3.0
type RetryInfo ¶ added in v1.3.0
type RetryInfo struct {
// contains filtered or unexported fields
}
RetryInfo Handle retry for grpc. Refer to https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/otlpexporter/otlp.go#L121
func GetRetryInfo ¶ added in v1.3.0
type StateOS ¶
func GetOSState ¶
GetOSState returns the FileStateOS for non windows systems
func (StateOS) IsFileChange ¶
Source Files ¶
- container_discover_controller.go
- container_export.go
- docker_center.go
- docker_center_file_discover.go
- docker_cri_adapter.go
- env_tags.go
- file_helper_linux.go
- go_kit_log_wrapper.go
- grpc_helper.go
- input_manager_helper.go
- k8s.go
- local_collector.go
- local_context.go
- log_file_processor.go
- log_file_reader.go
- meta_helper.go
- meta_helper_easyjson.go
- metrics_helper.go
- mount_others.go
- net.go
- path_helper.go
- probe_http.go
- process_helper_linux.go
- self_metric_imp.go
- service_helper.go
- split_log_helper.go
- string_helper.go