Documentation ¶
Index ¶
- Constants
- Variables
- func AddHttpProtocal(url string) string
- func Bool2String(i bool) string
- func CheckFileMode(path string, fileMode os.FileMode) error
- func CreateDirIfNotExist(dir string) (err error)
- func DecodeString(target string) (result string, err error)
- func DecompressGzip(packPath, dstDir string) (packDir string, err error)
- func DecompressZip(packFilePath, dstDir string) (packDir string, err error)
- func DeleteMapValue(m map[string]interface{}, keys ...string) (interface{}, bool)
- func EncodeString(target string) (result string)
- func ExtractField(slice []string) ([]string, error)
- func GetEnv(env string) string
- func GetKeys(keyStr string) []string
- func GetMapValue(m map[string]interface{}, keys ...string) (interface{}, error)
- func GetRealPath(path string) (newPath string, fi os.FileInfo, err error)
- func Hash(s string) string
- func IsJsonString(s string) bool
- func LogDirAndPattern(logpath string) (dir, pattern string, err error)
- func PandoraKey(key string) string
- func ReadDirByTime(dir string) (files []os.FileInfo, err error)
- func RemoveHttpProtocal(url string) (hostport, schema string)
- func SetMapValue(m map[string]interface{}, val interface{}, coercive bool, keys ...string) error
- func SortFilesByTime(files []os.FileInfo) (soredfiles []os.FileInfo)
- func TrimeList(strs []string) (ret []string)
- func TuoDecode(value []byte) (values [][]byte, err error)
- func TuoEncode(values []sql.RawBytes) (ret []byte)
- type AuthTokens
- type Data
- type ErrorResponse
- type File
- type HashSet
- func (s *HashSet) Add(ele interface{})
- func (s *HashSet) AddStringArray(ele []string)
- func (s *HashSet) Clear()
- func (s *HashSet) Elements() []interface{}
- func (s *HashSet) IsEmpty() bool
- func (s *HashSet) IsIn(ele interface{}) bool
- func (s *HashSet) Len() int
- func (s *HashSet) Remove(ele interface{})
- type Int64Slice
- type KeyValue
- type LagInfo
- type Option
- type SchemaErr
- type StatsError
- type StatsInfo
Constants ¶
View Source
const ( // 一切正常 ErrNothing = "L200" // 单机版 Runner 操作 ErrConfigName = "L1001" ErrRunnerAdd = "L1002" ErrRunnerDelete = "L1003" ErrRunnerStart = "L1004" ErrRunnerStop = "L1005" ErrRunnerReset = "L1006" ErrRunnerUpdate = "L1007" // read 相关 ErrReadRead = "L1101" // parse 相关 ErrParseParse = "L1201" // transform 相关 ErrTransformTransform = "L1301" // send 相关 ErrSendSend = "L1401" // 集群版 master API ErrClusterSlaves = "L2001" ErrClusterStatus = "L2002" ErrClusterConfigs = "L2003" ErrClusterRegister = "L2004" ErrClusterConfig = "L2014" // 集群版 slave API ErrClusterTag = "L2005" // 集群版 master 对 slaves 的操作 ErrClusterRunnerAdd = "L2006" ErrClusterRunnerDelete = "L2007" ErrClusterRunnerStart = "L2008" ErrClusterRunnerStop = "L2009" ErrClusterRunnerReset = "L2010" ErrClusterRunnerUpdate = "L2011" ErrClusterSlavesDelete = "L2012" ErrClusterSlavesTag = "L2013" )
View Source
const ( GlobalKeyName = "name" ExtraInfo = "extra_info" KeyCore = "core" KeyHostName = "hostname" KeyOsInfo = "osinfo" KeyLocalIp = "localip" ContentTypeHeader = "Content-Type" ContentEncodingHeader = "Content-Encoding" ApplicationJson = "application/json" ApplicationGzip = "application/gzip" KeyPandoraStash = "pandora_stash" // 当只有一条数据且 sendError 时候,将其转化为 raw 发送到 pandora_stash 这个字段 SchemaFreeTokensPrefix = "schema_free_tokens_" LogDBTokensPrefix = "logdb_tokens_" TsDBTokensPrefix = "tsdb_tokens_" KodoTokensPrefix = "kodo_tokens_" DefaultDirPerm = 0755 DefaultFilePerm = 0600 )
View Source
const ( // pandora_sender key, 可选参数 当sender_type 为pandora 的时候,需要必填的字段 KeyPandoraAk = "pandora_ak" KeyPandoraSk = "pandora_sk" KeyPandoraHost = "pandora_host" KeyPandoraWorkflowName = "pandora_workflow_name" KeyPandoraRepoName = "pandora_repo_name" KeyPandoraRegion = "pandora_region" KeyPandoraSchema = "pandora_schema" KeyPandoraSchemaUpdateInterval = "pandora_schema_update_interval" KeyPandoraAutoCreate = "pandora_auto_create" KeyPandoraSchemaFree = "pandora_schema_free" KeyPandoraExtraInfo = "pandora_extra_info" KeyPandoraEnableLogDB = "pandora_enable_logdb" KeyPandoraLogDBName = "pandora_logdb_name" KeyPandoraLogDBHost = "pandora_logdb_host" KeyPandoraEnableTSDB = "pandora_enable_tsdb" KeyPandoraTSDBName = "pandora_tsdb_name" KeyPandoraTSDBSeriesName = "pandora_tsdb_series_name" KeyPandoraTSDBSeriesTags = "pandora_tsdb_series_tags" KeyPandoraTSDBHost = "pandora_tsdb_host" KeyPandoraTSDBTimeStamp = "pandora_tsdb_timestamp" KeyPandoraEnableKodo = "pandora_enable_kodo" KeyPandoraKodoBucketName = "pandora_bucket_name" KeyPandoraKodoFilePrefix = "pandora_kodo_prefix" KeyPandoraKodoCompressPrefix = "pandora_kodo_compress" KeyPandoraEmail = "qiniu_email" KeyRequestRateLimit = "request_rate_limit" KeyFlowRateLimit = "flow_rate_limit" KeyPandoraGzip = "pandora_gzip" KeyPandoraUUID = "pandora_uuid" KeyPandoraWithIP = "pandora_withip" KeyForceMicrosecond = "force_microsecond" KeyForceDataConvert = "pandora_force_convert" KeyNumberUseFloat = "number_use_float" KeyPandoraAutoConvertDate = "pandora_auto_convert_date" KeyIgnoreInvalidField = "ignore_invalid_field" KeyPandoraUnescape = "pandora_unescape" KeyInsecureServer = "insecure_server" PandoraUUID = "Pandora_UUID" TimestampPrecision = 19 // Sender's conf keys KeySenderType = "sender_type" KeyFaultTolerant = "fault_tolerant" KeyName = "name" KeyRunnerName = "runner_name" KeyLogkitSendTime = "logkit_send_time" KeyIsMetrics = "is_metrics" KeyMetricTime = "timestamp" UnderfinedRunnerName = "UnderfinedRunnerName" // SenderType 发送类型 TypeFile = "file" // 本地文件 TypePandora = "pandora" // pandora 打点 TypeMongodbAccumulate = "mongodb_acc" // mongodb 并且按字段聚合 TypeInfluxdb = "influxdb" // influxdb TypeMock = "mock" // mock sender TypeDiscard = "discard" // discard sender TypeElastic = "elasticsearch" // elastic TypeKafka = "kafka" // kafka TypeHttp = "http" // http sender InnerUserAgent = "_useragent" )
Variables ¶
View Source
var ErrorCodeHumanize = map[string]string{ ErrNothing: "操作成功", ErrConfigName: "获取 Config 出现错误", ErrRunnerAdd: "添加 Runner 出现错误", ErrRunnerDelete: "删除 Runner 出现错误", ErrRunnerStart: "开启 Runner 出现错误", ErrRunnerStop: "关闭 Runner 出现错误", ErrRunnerReset: "重置 Runner 出现错误", ErrRunnerUpdate: "更新 Runner 出现错误", ErrParseParse: "解析字符串失败", ErrTransformTransform: "转化字段失败", ErrClusterSlaves: "获取 Slaves 列表出现错误", ErrClusterStatus: "获取 Slaves 状态出现错误", ErrClusterConfig: "获取 Slaves Config 出现错误", ErrClusterConfigs: "获取 Slaves Configs 出现错误", ErrClusterRegister: "接受 Slaves 注册出现错误", ErrClusterTag: "更改 Tag 出现错误", ErrClusterRunnerAdd: "Slaves 添加 Runner 出现错误", ErrClusterRunnerDelete: "Slaves 删除 Runner 出现错误", ErrClusterRunnerStart: "Slaves 启动 Runner 出现错误", ErrClusterRunnerStop: "Slaves 关闭 Runner 出现错误", ErrClusterRunnerReset: "Slaves 重置 Runner 出现错误", ErrClusterRunnerUpdate: "Slaves 更新 Runner 出现错误", ErrClusterSlavesDelete: "Slaves 从列表中移除时出现错误", ErrClusterSlavesTag: "Slaves 更改 Tag 出现错误", }
Functions ¶
func AddHttpProtocal ¶ added in v1.4.6
func Bool2String ¶ added in v1.4.7
func CreateDirIfNotExist ¶ added in v1.4.6
CreateDirIfNotExist 检查文件夹,不存在时创建
func DecodeString ¶ added in v1.4.7
func DecompressGzip ¶ added in v1.4.6
func DecompressZip ¶ added in v1.4.6
func DeleteMapValue ¶ added in v1.4.6
通过层级key删除key-val,并返回被删除的val,是否删除成功 如果key不存在,则返回 nil,false
func EncodeString ¶ added in v1.4.7
func ExtractField ¶ added in v1.4.6
func GetMapValue ¶ added in v1.4.6
通过层级key获取value. 所有层级的map必须为 map[string]interface{} 类型. keys为空切片,返回原m
func GetRealPath ¶ added in v1.4.6
GetRealPath 处理软链接等,找到文件真实路径
func IsJsonString ¶ added in v1.4.6
func LogDirAndPattern ¶ added in v1.4.6
创建目录,并返回日志模式
func PandoraKey ¶ added in v1.4.7
func ReadDirByTime ¶ added in v1.4.6
ReadDirByTime 读取文件目录后按时间排序,时间最新的文件在前
func RemoveHttpProtocal ¶ added in v1.4.6
func SetMapValue ¶ added in v1.4.6
通过层级key设置value值. 如果key不存在,将会自动创建. 当coercive为true时,会强制将非map[string]interface{}类型替换为map[string]interface{}类型,有可能导致数据丢失
func SortFilesByTime ¶ added in v1.4.6
SortFilesByTime 按照文件更新的unixnano从大到小排,即最新的文件在前
Types ¶
type AuthTokens ¶ added in v1.4.4
type ErrorResponse ¶ added in v1.4.6
type ErrorResponse struct {
Error error `json:"error"`
}
func NewErrorResponse ¶ added in v1.4.6
func NewErrorResponse(err error) *ErrorResponse
type File ¶ added in v1.4.6
func GetLogFiles ¶ added in v1.4.6
type HashSet ¶ added in v1.4.6
type HashSet struct {
// contains filtered or unexported fields
}
func NewHashSet ¶ added in v1.4.6
func NewHashSet() *HashSet
func (*HashSet) AddStringArray ¶ added in v1.4.6
type Int64Slice ¶ added in v1.4.6
type Int64Slice []int64
Int64Slice attaches the methods of Interface to []int64, sorting in decreasing order.
func (Int64Slice) Len ¶ added in v1.4.6
func (p Int64Slice) Len() int
func (Int64Slice) Less ¶ added in v1.4.6
func (p Int64Slice) Less(i, j int) bool
func (Int64Slice) Swap ¶ added in v1.4.6
func (p Int64Slice) Swap(i, j int)
type Option ¶
type Option struct { KeyName string ChooseOnly bool ChooseOptions []interface{} Default interface{} DefaultNoUse bool Description string CheckRegex string Style string `json:"style"` Required bool `json:"required"` Placeholder string `json:"placeholder"` Type string `json:"Type,omitempty"` Secret bool Advance bool `json:"advance,omitempty"` AdvanceDepend string `json:"advance_depend,omitempty"` ToolTip string `json:"tooltip,omitempty"` ToolTipActive bool `json:"tooltip_active,omitempty"` }
type StatsError ¶ added in v1.4.6
type StatsError struct { StatsInfo ErrorDetail error `json:"error"` Ft bool `json:"-"` ErrorIndex []int }
func (*StatsError) AddErrors ¶ added in v1.4.6
func (se *StatsError) AddErrors()
func (*StatsError) AddSuccess ¶ added in v1.4.6
func (se *StatsError) AddSuccess()
func (*StatsError) Error ¶ added in v1.4.6
func (se *StatsError) Error() string
func (*StatsError) ErrorIndexIn ¶ added in v1.4.6
func (se *StatsError) ErrorIndexIn(idx int) bool
Click to show internal directories.
Click to hide internal directories.