Documentation
¶
Index ¶
- Constants
- Variables
- func AdjustHash(shardhash string, buckets int) (string, error)
- func AdjustHashOld(shardhash string, buckets int) (string, error)
- func BitCount(buckets int) (int, error)
- func FillZero(x string, n int) string
- func GenerateLog(logTime uint32, addLogMap map[string]string) *sls.Log
- func GetLogListSize(logList []*sls.Log) int
- func GetLogSizeCalculate(log *sls.Log) int
- func GetTimeMs(t int64) int64
- func Md5ToBin(md5 string) string
- func ToMd5(name string) string
- type Attempt
- type CallBack
- type IoThreadPool
- type IoWorker
- type LogAccumulator
- type LogStorePackIdGenerator
- type Mover
- type PackIdGenerator
- type Producer
- func (producer *Producer) Close(timeoutMs int64) error
- func (producer *Producer) HashSendLog(project, logstore, shardHash, topic, source string, log *sls.Log) error
- func (producer *Producer) HashSendLogList(project, logstore, shardHash, topic, source string, logList []*sls.Log) (err error)
- func (producer *Producer) HashSendLogListWithCallBack(project, logstore, shardHash, topic, source string, logList []*sls.Log, ...) (err error)
- func (producer *Producer) HashSendLogWithCallBack(project, logstore, shardHash, topic, source string, log *sls.Log, ...) error
- func (producer *Producer) SafeClose()
- func (producer *Producer) SendLog(project, logstore, topic, source string, log *sls.Log) error
- func (producer *Producer) SendLogList(project, logstore, topic, source string, logList []*sls.Log) (err error)
- func (producer *Producer) SendLogListWithCallBack(project, logstore, topic, source string, logList []*sls.Log, callback CallBack) (err error)
- func (producer *Producer) SendLogWithCallBack(project, logstore, topic, source string, log *sls.Log, callback CallBack) error
- func (producer *Producer) Start()
- type ProducerBatch
- type ProducerConfig
- type ProducerMetrics
- type ProducerMonitor
- type Result
- func (result *Result) GetErrorCode() string
- func (result *Result) GetErrorMessage() string
- func (result *Result) GetLastAttemptCostMs() int64
- func (result *Result) GetRequestId() string
- func (result *Result) GetReservedAttempts() []*Attempt
- func (result *Result) GetTimeStampMs() int64
- func (result *Result) IsSuccessful() bool
- type RetryQueue
- type UpdateStsTokenFunc
Constants ¶
View Source
const ( TimeoutExecption = "TimeoutExecption" IllegalStateException = "IllegalStateException" )
View Source
const Delimiter = "|"
Variables ¶
View Source
var PACK_ID_KEY = "__pack_id__"
Functions ¶
func AdjustHashOld ¶ added in v0.1.12
func GenerateLog ¶
func GetLogListSize ¶
func GetLogListSize(logList []*sls.Log) int
func GetLogSizeCalculate ¶
func GetLogSizeCalculate(log *sls.Log) int
Types ¶
type IoThreadPool ¶
type IoThreadPool struct {
// contains filtered or unexported fields
}
func (*IoThreadPool) ShutDown ¶ added in v0.1.93
func (threadPool *IoThreadPool) ShutDown()
func (*IoThreadPool) Stopped ¶ added in v0.1.93
func (threadPool *IoThreadPool) Stopped() bool
type LogAccumulator ¶
type LogAccumulator struct {
// contains filtered or unexported fields
}
type LogStorePackIdGenerator ¶ added in v0.1.90
type LogStorePackIdGenerator struct {
// contains filtered or unexported fields
}
type PackIdGenerator ¶ added in v0.1.90
type PackIdGenerator struct {
// contains filtered or unexported fields
}
func (*PackIdGenerator) GeneratePackId ¶ added in v0.1.90
func (g *PackIdGenerator) GeneratePackId(project, logstore string) string
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
func InitProducer
deprecated
func InitProducer(producerConfig *ProducerConfig) *Producer
Deprecated: use NewProducer instead.
func NewProducer ¶ added in v0.1.84
func NewProducer(producerConfig *ProducerConfig) (*Producer, error)
func (*Producer) Close ¶
Limited closing transfer parameter nil, safe closing transfer timeout time, timeout Ms parameter in milliseconds
func (*Producer) HashSendLog ¶
func (*Producer) HashSendLogList ¶
func (*Producer) HashSendLogListWithCallBack ¶
func (*Producer) HashSendLogWithCallBack ¶
func (*Producer) SendLogList ¶
func (*Producer) SendLogListWithCallBack ¶
func (*Producer) SendLogWithCallBack ¶
type ProducerBatch ¶
type ProducerBatch struct {
// contains filtered or unexported fields
}
func (*ProducerBatch) OnFail ¶ added in v0.1.93
func (producerBatch *ProducerBatch) OnFail(err *sls.Error, begin time.Time)
func (*ProducerBatch) OnSuccess ¶ added in v0.1.93
func (producerBatch *ProducerBatch) OnSuccess(begin time.Time)
type ProducerConfig ¶
type ProducerConfig struct {
TotalSizeLnBytes int64
MaxIoWorkerCount int64
MaxBlockSec int
MaxBatchSize int64
MaxBatchCount int
LingerMs int64
Retries int
MaxReservedAttempts int
BaseRetryBackoffMs int64
MaxRetryBackoffMs int64
AdjustShargHash bool
Buckets int
// Optional, defaults to nil.
// The logger is used to record the runtime status of the consumer.
// The logs generated by the logger will only be stored locally.
// The parameters AllowLogLevel/LogFileName/LogMaxSize/LogMaxBackups/LogCompass
// are ignored if the Logger is not nil.
Logger log.Logger
// Optional, defaults to info.
// AllowLogLevel can be debug/info/warn/error, set the minimum level of the log to be recorded.
AllowLogLevel string
// Optional.
// Setting Log File Path,eg: "/root/log/log_file.log". if not set, the log will go to stdout.
LogFileName string
// Optional, defaults to false.
// Set whether the log output type is JSON.
IsJsonType bool
// Optional, defaults to 100, in megabytes.
// MaxSize is the maximum size in megabytes of the log file before it gets rotated.
LogMaxSize int
// Optional, defaults to 10.
// MaxBackups is the maximum number of old log files to retain.
LogMaxBackups int
// Optional, defaults to false.
// Compress determines if the rotated log files should be compressed using gzip.
LogCompress bool
Endpoint string
NoRetryStatusCodeList []int
HTTPClient *http.Client
UserAgent string
LogTags []*sls.LogTag
GeneratePackId bool
CredentialsProvider sls.CredentialsProvider
UseMetricStoreURL bool
DisableRuntimeMetrics bool // disable runtime metrics, runtime metrics prints to local log.
// Deprecated: use CredentialsProvider and UpdateFuncProviderAdapter instead.
//
// Example:
// provider := sls.NewUpdateFuncProviderAdapter(updateStsTokenFunc)
// config := &ProducerConfig{
// CredentialsProvider: provider,
// }
UpdateStsToken UpdateStsTokenFunc
StsTokenShutDown chan struct{}
AccessKeyID string // Deprecated: use CredentialsProvider instead
AccessKeySecret string // Deprecated: use CredentialsProvider instead
Region string
AuthVersion sls.AuthVersionType
CompressType int // only work for logstore now
Processor string // ingest processor
}
func GetDefaultProducerConfig ¶
func GetDefaultProducerConfig() *ProducerConfig
type ProducerMetrics ¶ added in v0.1.93
type ProducerMetrics struct {
// contains filtered or unexported fields
}
type ProducerMonitor ¶ added in v0.1.93
type ProducerMonitor struct {
// contains filtered or unexported fields
}
func (*ProducerMonitor) Stop ¶ added in v0.1.110
func (m *ProducerMonitor) Stop()
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) GetErrorCode ¶
func (*Result) GetErrorMessage ¶
func (*Result) GetLastAttemptCostMs ¶ added in v0.1.29
func (*Result) GetRequestId ¶
func (*Result) GetReservedAttempts ¶
func (*Result) GetTimeStampMs ¶
func (*Result) IsSuccessful ¶
type RetryQueue ¶
type RetryQueue struct {
// contains filtered or unexported fields
}
RetryQueue cache ProducerBatch and retry latter
func (*RetryQueue) Len ¶
func (retryQueue *RetryQueue) Len() int
func (*RetryQueue) Less ¶
func (retryQueue *RetryQueue) Less(i, j int) bool
func (*RetryQueue) Pop ¶
func (retryQueue *RetryQueue) Pop() interface{}
func (*RetryQueue) Push ¶
func (retryQueue *RetryQueue) Push(x interface{})
func (*RetryQueue) Swap ¶
func (retryQueue *RetryQueue) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.