Documentation ¶
Index ¶
- Constants
- func SetCustomLogger(logger TDLogger)
- func SetLogLevel(level TDLogLevel)
- func SetLoggerConfig(config LoggerConfig)deprecated
- type Consumerdeprecated
- type Data
- type LogConfigdeprecated
- type LogConsumerdeprecated
- type LogTypedeprecated
- type LoggerConfigdeprecated
- type RotateMode
- type TDAnalytics
- func (ta *TDAnalytics) ClearSuperProperties()
- func (ta *TDAnalytics) Close() error
- func (ta *TDAnalytics) Flush() error
- func (ta *TDAnalytics) GetDynamicSuperProperties() map[string]interface{}
- func (ta *TDAnalytics) GetSuperProperties() map[string]interface{}
- func (ta *TDAnalytics) SetDynamicSuperProperties(action func() map[string]interface{})
- func (ta *TDAnalytics) SetSuperProperties(superProperties map[string]interface{})
- func (ta *TDAnalytics) Track(accountId, distinctId, eventName string, properties map[string]interface{}) error
- func (ta *TDAnalytics) TrackFirst(accountId, distinctId, eventName, firstCheckId string, ...) error
- func (ta *TDAnalytics) TrackOverwrite(accountId, distinctId, eventName, eventId string, ...) error
- func (ta *TDAnalytics) TrackUpdate(accountId, distinctId, eventName, eventId string, ...) error
- func (ta *TDAnalytics) UserAdd(accountId string, distinctId string, properties map[string]interface{}) error
- func (ta *TDAnalytics) UserAppend(accountId string, distinctId string, properties map[string]interface{}) error
- func (ta *TDAnalytics) UserDelete(accountId string, distinctId string) error
- func (ta *TDAnalytics) UserSet(accountId string, distinctId string, properties map[string]interface{}) error
- func (ta *TDAnalytics) UserSetOnce(accountId string, distinctId string, properties map[string]interface{}) error
- func (ta *TDAnalytics) UserUniqAppend(accountId string, distinctId string, properties map[string]interface{}) error
- func (ta *TDAnalytics) UserUnset(accountId string, distinctId string, s []string) error
- type TDBatchConfig
- type TDBatchConsumer
- type TDConsumer
- func NewBatchConsumer(serverUrl string, appId string) (TDConsumer, error)
- func NewBatchConsumerWithBatchSize(serverUrl string, appId string, batchSize int) (TDConsumer, error)
- func NewBatchConsumerWithCompress(serverUrl string, appId string, compress bool) (TDConsumer, error)
- func NewBatchConsumerWithConfig(config TDBatchConfig) (TDConsumer, error)
- func NewDebugConsumer(serverUrl string, appId string) (TDConsumer, error)
- func NewDebugConsumerWithDeviceId(serverUrl string, appId string, writeData bool, deviceId string) (TDConsumer, error)
- func NewDebugConsumerWithWriter(serverUrl string, appId string, writeData bool) (TDConsumer, error)
- func NewLogConsumer(directory string, r RotateMode) (TDConsumer, error)
- func NewLogConsumerWithConfig(config TDLogConsumerConfig) (TDConsumer, error)
- func NewLogConsumerWithFileSize(directory string, r RotateMode, size int) (TDConsumer, error)
- type TDDebugConsumer
- type TDLogConsumer
- type TDLogConsumerConfig
- type TDLogLevel
- type TDLogger
Constants ¶
const ( DefaultTimeOut = 30000 DefaultBatchSize = 20 MaxBatchSize = 200 DefaultInterval = 30 DefaultCacheCapacity = 50 )
const ( Track = "track" TrackUpdate = "track_update" TrackOverwrite = "track_overwrite" UserSet = "user_set" UserUnset = "user_unset" UserSetOnce = "user_setOnce" UserAdd = "user_add" UserAppend = "user_append" UserUniqAppend = "user_uniq_append" UserDel = "user_del" SdkVersion = "2.0.1" LibName = "Golang" )
const ( DATE_FORMAT = "2006-01-02 15:04:05.000" KEY_PATTERN = "^[a-zA-Z#][A-Za-z0-9_]{0,49}$" )
const SDK_LOG_PREFIX = "[WildfireData]"
SDK_LOG_PREFIX const
Variables ¶
This section is empty.
Functions ¶
func SetCustomLogger ¶
func SetCustomLogger(logger TDLogger)
SetCustomLogger Set a custom log input class, usually you don't need to set it up.
func SetLoggerConfig
deprecated
func SetLoggerConfig(config LoggerConfig)
Deprecated: please use wildfiredata.SetLogLevel(wildfiredata.TDLogLevelOff)
Types ¶
type Consumer
deprecated
type Consumer interface { TDConsumer }
Deprecated: please use TDConsumer
type Data ¶
type Data struct { IsComplex bool `json:"-"` // properties are nested or not AccountId string `json:"#account_id,omitempty"` DistinctId string `json:"#distinct_id,omitempty"` Type string `json:"#type"` Time string `json:"#time"` EventName string `json:"#event_name,omitempty"` EventId string `json:"#event_id,omitempty"` FirstCheckId string `json:"#first_check_id,omitempty"` Ip string `json:"#ip,omitempty"` UUID string `json:"#uuid,omitempty"` AppId string `json:"#app_id,omitempty"` Properties map[string]interface{} `json:"properties"` }
type LogConfig
deprecated
type LogConfig struct {
TDLogConsumerConfig
}
Deprecated: please use TDLogConsumerConfig
type LogConsumer
deprecated
type LogConsumer struct {
TDLogConsumer
}
Deprecated: please use TDLogConsumer
type LogType
deprecated
type LogType int32
Deprecated: please use wildfiredata.SetLogLevel(wildfiredata.TDLogLevelOff)
const ( LoggerTypeOff LogType = 1 << 0 // disable log LoggerTypePrint LogType = 1 << 1 // print on console LoggerTypeWriteFile LogType = 1 << 2 // print to file LoggerTypePrintAndWriteFile = LoggerTypePrint | LoggerTypeWriteFile // print both on console and file )
Deprecated: please use wildfiredata.SetLogLevel(wildfiredata.TDLogLevelOff)
type LoggerConfig
deprecated
type RotateMode ¶
type RotateMode int32
const ( DefaultChannelSize = 1000 // channel size ROTATE_DAILY RotateMode = 0 // by the day ROTATE_HOURLY RotateMode = 1 // by the hour )
type TDAnalytics ¶
type TDAnalytics struct {
// contains filtered or unexported fields
}
func (*TDAnalytics) ClearSuperProperties ¶
func (ta *TDAnalytics) ClearSuperProperties()
ClearSuperProperties clear common properties
func (*TDAnalytics) GetDynamicSuperProperties ¶
func (ta *TDAnalytics) GetDynamicSuperProperties() map[string]interface{}
GetDynamicSuperProperties dynamic common properties
func (*TDAnalytics) GetSuperProperties ¶
func (ta *TDAnalytics) GetSuperProperties() map[string]interface{}
GetSuperProperties get common properties
func (*TDAnalytics) SetDynamicSuperProperties ¶
func (ta *TDAnalytics) SetDynamicSuperProperties(action func() map[string]interface{})
SetDynamicSuperProperties set common properties dynamically. not recommend to add the operation which with a lot of computation
func (*TDAnalytics) SetSuperProperties ¶
func (ta *TDAnalytics) SetSuperProperties(superProperties map[string]interface{})
SetSuperProperties set common properties
func (*TDAnalytics) Track ¶
func (ta *TDAnalytics) Track(accountId, distinctId, eventName string, properties map[string]interface{}) error
Track report ordinary event
func (*TDAnalytics) TrackFirst ¶
func (ta *TDAnalytics) TrackFirst(accountId, distinctId, eventName, firstCheckId string, properties map[string]interface{}) error
TrackFirst report first event
func (*TDAnalytics) TrackOverwrite ¶
func (ta *TDAnalytics) TrackOverwrite(accountId, distinctId, eventName, eventId string, properties map[string]interface{}) error
TrackOverwrite report overridable event
func (*TDAnalytics) TrackUpdate ¶
func (ta *TDAnalytics) TrackUpdate(accountId, distinctId, eventName, eventId string, properties map[string]interface{}) error
TrackUpdate report updatable event
func (*TDAnalytics) UserAdd ¶
func (ta *TDAnalytics) UserAdd(accountId string, distinctId string, properties map[string]interface{}) error
UserAdd to accumulate operations against the property.
func (*TDAnalytics) UserAppend ¶
func (ta *TDAnalytics) UserAppend(accountId string, distinctId string, properties map[string]interface{}) error
UserAppend to add user properties of array type.
func (*TDAnalytics) UserDelete ¶
func (ta *TDAnalytics) UserDelete(accountId string, distinctId string) error
UserDelete delete a user, This operation cannot be undone.
func (*TDAnalytics) UserSet ¶
func (ta *TDAnalytics) UserSet(accountId string, distinctId string, properties map[string]interface{}) error
UserSet set user properties. would overwrite existing names.
func (*TDAnalytics) UserSetOnce ¶
func (ta *TDAnalytics) UserSetOnce(accountId string, distinctId string, properties map[string]interface{}) error
UserSetOnce set user properties, If such property had been set before, this message would be neglected.
func (*TDAnalytics) UserUniqAppend ¶
func (ta *TDAnalytics) UserUniqAppend(accountId string, distinctId string, properties map[string]interface{}) error
UserUniqAppend append user properties to array type by unique.
type TDBatchConfig ¶
type TDBatchConfig struct { ServerUrl string // serverUrl AppId string // appId BatchSize int // flush event count each time Timeout int // http timeout (mill second) Compress bool // enable compress data AutoFlush bool // enable auto flush Interval int // auto flush spacing (second) CacheCapacity int // cache event count }
type TDBatchConsumer ¶
type TDBatchConsumer struct {
// contains filtered or unexported fields
}
TDBatchConsumer upload data to TE by http
func (*TDBatchConsumer) Add ¶
func (c *TDBatchConsumer) Add(d Data) error
func (*TDBatchConsumer) Close ¶
func (c *TDBatchConsumer) Close() error
func (*TDBatchConsumer) Flush ¶
func (c *TDBatchConsumer) Flush() error
func (*TDBatchConsumer) FlushAll ¶
func (c *TDBatchConsumer) FlushAll() error
func (*TDBatchConsumer) IsStringent ¶
func (c *TDBatchConsumer) IsStringent() bool
type TDConsumer ¶
type TDConsumer interface { Add(d Data) error Flush() error Close() error IsStringent() bool // check data or not. }
TDConsumer define operation interface
func NewBatchConsumer ¶
func NewBatchConsumer(serverUrl string, appId string) (TDConsumer, error)
NewBatchConsumer create TDBatchConsumer
func NewBatchConsumerWithBatchSize ¶
func NewBatchConsumerWithBatchSize(serverUrl string, appId string, batchSize int) (TDConsumer, error)
NewBatchConsumerWithBatchSize create TDBatchConsumer serverUrl appId batchSize: flush event count each time
func NewBatchConsumerWithCompress ¶
func NewBatchConsumerWithCompress(serverUrl string, appId string, compress bool) (TDConsumer, error)
NewBatchConsumerWithCompress create TDBatchConsumer serverUrl appId compress: enable data compress
func NewBatchConsumerWithConfig ¶
func NewBatchConsumerWithConfig(config TDBatchConfig) (TDConsumer, error)
func NewDebugConsumer ¶
func NewDebugConsumer(serverUrl string, appId string) (TDConsumer, error)
NewDebugConsumer init TDDebugConsumer
func NewDebugConsumerWithWriter ¶
func NewDebugConsumerWithWriter(serverUrl string, appId string, writeData bool) (TDConsumer, error)
func NewLogConsumer ¶
func NewLogConsumer(directory string, r RotateMode) (TDConsumer, error)
func NewLogConsumerWithConfig ¶
func NewLogConsumerWithConfig(config TDLogConsumerConfig) (TDConsumer, error)
func NewLogConsumerWithFileSize ¶
func NewLogConsumerWithFileSize(directory string, r RotateMode, size int) (TDConsumer, error)
NewLogConsumerWithFileSize init TDLogConsumer directory: directory of log file r: rotate mode of log file. (in days / hours) size: max size of single log file (MByte)
type TDDebugConsumer ¶
type TDDebugConsumer struct {
// contains filtered or unexported fields
}
TDDebugConsumer The data is reported one by one, and when an error occurs, the log will be printed on the console.
func (*TDDebugConsumer) Add ¶
func (c *TDDebugConsumer) Add(d Data) error
func (*TDDebugConsumer) Close ¶
func (c *TDDebugConsumer) Close() error
func (*TDDebugConsumer) Flush ¶
func (c *TDDebugConsumer) Flush() error
func (*TDDebugConsumer) IsStringent ¶
func (c *TDDebugConsumer) IsStringent() bool
type TDLogConsumer ¶
type TDLogConsumer struct {
// contains filtered or unexported fields
}
TDLogConsumer write data to file, it works with LogBus
func (*TDLogConsumer) Add ¶
func (c *TDLogConsumer) Add(d Data) error
func (*TDLogConsumer) Close ¶
func (c *TDLogConsumer) Close() error
func (*TDLogConsumer) Flush ¶
func (c *TDLogConsumer) Flush() error
func (*TDLogConsumer) IsStringent ¶
func (c *TDLogConsumer) IsStringent() bool
type TDLogConsumerConfig ¶
type TDLogConsumerConfig struct { Directory string // directory of log file RotateMode RotateMode // rotate mode of log file FileSize int // max size of single log file (MByte) FileNamePrefix string // prefix of log file ChannelSize int }
type TDLogLevel ¶
type TDLogLevel int32
const ( TDLogLevelOff TDLogLevel = 1 TDLogLevelError TDLogLevel = 2 TDLogLevelWarning TDLogLevel = 3 TDLogLevelInfo TDLogLevel = 4 TDLogLevelDebug TDLogLevel = 5 )