Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateProducerHash(instanceID string) string
- func GetLocalIP() (string, error)
- func GetLogListSize(logList []*Log) (int, error)
- func GetLogSizeCalculate(log *Log) (int, error)
- func GetTimeMs(t int64) int64
- func NewCLSClient(options *Options) (*CLSClient, *CLSError)
- func SetUserAgent(agent string)
- func SetVersion(ver string)
- func ZSTDCompress(params ZstdEncoderParams, dst, src []byte) ([]byte, error)
- func ZSTDDecompress(params ZstdDecoderParams, dst, src []byte) ([]byte, error)
- type Accumulator
- type AsyncProducerClient
- func (producer *AsyncProducerClient) Close(timeoutMs int64) error
- func (producer *AsyncProducerClient) SendLog(topicId string, log *Log, callback CallBack) error
- func (producer *AsyncProducerClient) SendLogList(topicId string, logList []*Log, callback CallBack) (err error)
- func (producer *AsyncProducerClient) Start()
- type AsyncProducerClientConfig
- type Attempt
- type CLSClient
- type CLSError
- type CallBack
- type Credentials
- type ErrorMessage
- type Log
- func (*Log) Descriptor() ([]byte, []int)
- func (m *Log) GetCollectTime() int64
- func (m *Log) GetContents() []*Log_Content
- func (m *Log) GetTime() int64
- func (m *Log) Marshal() (dAtA []byte, err error)
- func (m *Log) MarshalTo(dAtA []byte) (int, error)
- func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Log) ProtoMessage()
- func (m *Log) Reset()
- func (m *Log) Size() (n int)
- func (m *Log) String() string
- func (m *Log) Unmarshal(dAtA []byte) error
- func (m *Log) XXX_DiscardUnknown()
- func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Log) XXX_Merge(src proto.Message)
- func (m *Log) XXX_Size() int
- func (m *Log) XXX_Unmarshal(b []byte) error
- type LogGroup
- func (*LogGroup) Descriptor() ([]byte, []int)
- func (m *LogGroup) GetContextFlow() string
- func (m *LogGroup) GetFilename() string
- func (m *LogGroup) GetHostname() string
- func (m *LogGroup) GetLogTags() []*LogTag
- func (m *LogGroup) GetLogs() []*Log
- func (m *LogGroup) GetSource() string
- func (m *LogGroup) Marshal() (dAtA []byte, err error)
- func (m *LogGroup) MarshalTo(dAtA []byte) (int, error)
- func (m *LogGroup) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*LogGroup) ProtoMessage()
- func (m *LogGroup) Reset()
- func (m *LogGroup) Size() (n int)
- func (m *LogGroup) String() string
- func (m *LogGroup) Unmarshal(dAtA []byte) error
- func (m *LogGroup) XXX_DiscardUnknown()
- func (m *LogGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LogGroup) XXX_Merge(src proto.Message)
- func (m *LogGroup) XXX_Size() int
- func (m *LogGroup) XXX_Unmarshal(b []byte) error
- type LogGroupList
- func (*LogGroupList) Descriptor() ([]byte, []int)
- func (m *LogGroupList) GetLogGroupList() []*LogGroup
- func (m *LogGroupList) Marshal() (dAtA []byte, err error)
- func (m *LogGroupList) MarshalTo(dAtA []byte) (int, error)
- func (m *LogGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*LogGroupList) ProtoMessage()
- func (m *LogGroupList) Reset()
- func (m *LogGroupList) Size() (n int)
- func (m *LogGroupList) String() string
- func (m *LogGroupList) Unmarshal(dAtA []byte) error
- func (m *LogGroupList) XXX_DiscardUnknown()
- func (m *LogGroupList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LogGroupList) XXX_Merge(src proto.Message)
- func (m *LogGroupList) XXX_Size() int
- func (m *LogGroupList) XXX_Unmarshal(b []byte) error
- type LogSendRetryQueue
- type LogTag
- func (*LogTag) Descriptor() ([]byte, []int)
- func (m *LogTag) GetKey() string
- func (m *LogTag) GetValue() string
- func (m *LogTag) Marshal() (dAtA []byte, err error)
- func (m *LogTag) MarshalTo(dAtA []byte) (int, error)
- func (m *LogTag) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*LogTag) ProtoMessage()
- func (m *LogTag) Reset()
- func (m *LogTag) Size() (n int)
- func (m *LogTag) String() string
- func (m *LogTag) Unmarshal(dAtA []byte) error
- func (m *LogTag) XXX_DiscardUnknown()
- func (m *LogTag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LogTag) XXX_Merge(src proto.Message)
- func (m *LogTag) XXX_Size() int
- func (m *LogTag) XXX_Unmarshal(b []byte) error
- type Log_Content
- func (*Log_Content) Descriptor() ([]byte, []int)
- func (m *Log_Content) GetKey() string
- func (m *Log_Content) GetValue() string
- func (m *Log_Content) Marshal() (dAtA []byte, err error)
- func (m *Log_Content) MarshalTo(dAtA []byte) (int, error)
- func (m *Log_Content) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Log_Content) ProtoMessage()
- func (m *Log_Content) Reset()
- func (m *Log_Content) Size() (n int)
- func (m *Log_Content) String() string
- func (m *Log_Content) Unmarshal(dAtA []byte) error
- func (m *Log_Content) XXX_DiscardUnknown()
- func (m *Log_Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Log_Content) XXX_Merge(src proto.Message)
- func (m *Log_Content) XXX_Size() int
- func (m *Log_Content) XXX_Unmarshal(b []byte) error
- type Options
- type ProducerBatch
- type Result
- type SendThreadPool
- type SyncProducerClient
- func (c *SyncProducerClient) ResetSecretToken(secretID string, secretKEY string, secretToken string) error
- func (c *SyncProducerClient) SendLogGroupList(ctx context.Context, topicID string, logGroupList []*LogGroup) error
- func (c *SyncProducerClient) SendLogList(ctx context.Context, topicID string, logList []*Log) error
- type SyncProducerClientConfig
- type TimerSendLogTask
- type Worker
- type ZstdDecoderParams
- type ZstdEncoderParams
Constants ¶
const BAD_REQUEST = "BadRequest"
const CompressionLevelDefault = -1000
const INTERNAL_SERVER_ERROR = "InternalError"
const MISSING_HOST = "MissingHost"
const MISS_ACCESS_KEY_ID = "MissAccessKeyId"
const MISS_ACCESS_SECRET = "MissAccessKeyId"
const MISS_ACCESS_TOKEN = "MissAccessKeyId"
const UNKNOWN_ERROR = "UnknownError"
const WRITE_QUOTA_EXCEED = "WriteQuotaExceed"
Variables ¶
Functions ¶
func GenerateProducerHash ¶ added in v1.0.7
GenerateProducerHash ...
func GetLogListSize ¶
func GetLogSizeCalculate ¶
func NewCLSClient ¶
func ZSTDCompress ¶ added in v1.0.2
func ZSTDCompress(params ZstdEncoderParams, dst, src []byte) ([]byte, error)
func ZSTDDecompress ¶ added in v1.0.2
func ZSTDDecompress(params ZstdDecoderParams, dst, src []byte) ([]byte, error)
Types ¶
type Accumulator ¶
type Accumulator struct {
// contains filtered or unexported fields
}
func NewAccumulator ¶
func NewAccumulator(config *AsyncProducerClientConfig, worker *Worker, threadPool *SendThreadPool, producer *AsyncProducerClient) *Accumulator
NewAccumulator ...
type AsyncProducerClient ¶
type AsyncProducerClient struct { Client *CLSClient // contains filtered or unexported fields }
AsyncProducerClient async producer client
func NewAsyncProducerClient ¶
func NewAsyncProducerClient(asyncProducerClientConfig *AsyncProducerClientConfig) (*AsyncProducerClient, error)
NewAsyncProducerClient 初始化Async Producer Client
func (*AsyncProducerClient) Close ¶
func (producer *AsyncProducerClient) Close(timeoutMs int64) error
func (*AsyncProducerClient) SendLog ¶
func (producer *AsyncProducerClient) SendLog(topicId string, log *Log, callback CallBack) error
func (*AsyncProducerClient) SendLogList ¶
func (producer *AsyncProducerClient) SendLogList(topicId string, logList []*Log, callback CallBack) (err error)
func (*AsyncProducerClient) Start ¶
func (producer *AsyncProducerClient) Start()
type AsyncProducerClientConfig ¶
type AsyncProducerClientConfig struct { TotalSizeLnBytes int64 MaxSendWorkerCount int64 MaxBlockSec int MaxBatchSize int64 MaxBatchCount int LingerMs int64 Retries int MaxReservedAttempts int BaseRetryBackoffMs int64 MaxRetryBackoffMs int64 Endpoint string AccessKeyID string AccessKeySecret string AccessToken string Source string Timeout int IdleConn int CompressType string HostName string }
AsyncProducerClientConfig Producer Config
func GetDefaultAsyncProducerClientConfig ¶
func GetDefaultAsyncProducerClientConfig() *AsyncProducerClientConfig
GetDefaultAsyncProducerClientConfig 获取默认的Producer Config
type Attempt ¶
type CLSClient ¶
type CLSClient struct {
// contains filtered or unexported fields
}
func (*CLSClient) ResetSecretToken ¶
type CLSError ¶
type CLSError struct { HTTPCode int32 `json:"httpCode"` Code string `json:"errorCode"` Message string `json:"errorMessage"` RequestID string `json:"requestID"` }
Error defines sls error
type Credentials ¶ added in v1.0.6
type ErrorMessage ¶
type Log ¶
type Log struct { Time *int64 `protobuf:"varint,1,req,name=time" json:"time,omitempty"` Contents []*Log_Content `protobuf:"bytes,2,rep,name=contents" json:"contents,omitempty"` CollectTime *int64 `protobuf:"varint,3,opt,name=collectTime" json:"collectTime,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Log) Descriptor ¶
func (*Log) GetCollectTime ¶ added in v1.0.8
func (*Log) GetContents ¶
func (m *Log) GetContents() []*Log_Content
func (*Log) ProtoMessage ¶
func (*Log) ProtoMessage()
func (*Log) XXX_DiscardUnknown ¶
func (m *Log) XXX_DiscardUnknown()
func (*Log) XXX_Unmarshal ¶
type LogGroup ¶
type LogGroup struct { Logs []*Log `protobuf:"bytes,1,rep,name=logs" json:"logs,omitempty"` ContextFlow *string `protobuf:"bytes,2,opt,name=contextFlow" json:"contextFlow,omitempty"` Filename *string `protobuf:"bytes,3,opt,name=filename" json:"filename,omitempty"` Source *string `protobuf:"bytes,4,opt,name=source" json:"source,omitempty"` LogTags []*LogTag `protobuf:"bytes,5,rep,name=logTags" json:"logTags,omitempty"` Hostname *string `protobuf:"bytes,6,opt,name=hostname" json:"hostname,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LogGroup) Descriptor ¶
func (*LogGroup) GetContextFlow ¶
func (*LogGroup) GetFilename ¶
func (*LogGroup) GetHostname ¶ added in v1.0.8
func (*LogGroup) GetLogTags ¶
func (*LogGroup) MarshalToSizedBuffer ¶
func (*LogGroup) ProtoMessage ¶
func (*LogGroup) ProtoMessage()
func (*LogGroup) XXX_DiscardUnknown ¶
func (m *LogGroup) XXX_DiscardUnknown()
func (*LogGroup) XXX_Marshal ¶
func (*LogGroup) XXX_Unmarshal ¶
type LogGroupList ¶
type LogGroupList struct { LogGroupList []*LogGroup `protobuf:"bytes,1,rep,name=logGroupList" json:"logGroupList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LogGroupList) Descriptor ¶
func (*LogGroupList) Descriptor() ([]byte, []int)
func (*LogGroupList) GetLogGroupList ¶
func (m *LogGroupList) GetLogGroupList() []*LogGroup
func (*LogGroupList) Marshal ¶
func (m *LogGroupList) Marshal() (dAtA []byte, err error)
func (*LogGroupList) MarshalToSizedBuffer ¶
func (m *LogGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*LogGroupList) ProtoMessage ¶
func (*LogGroupList) ProtoMessage()
func (*LogGroupList) Reset ¶
func (m *LogGroupList) Reset()
func (*LogGroupList) Size ¶
func (m *LogGroupList) Size() (n int)
func (*LogGroupList) String ¶
func (m *LogGroupList) String() string
func (*LogGroupList) Unmarshal ¶
func (m *LogGroupList) Unmarshal(dAtA []byte) error
func (*LogGroupList) XXX_DiscardUnknown ¶
func (m *LogGroupList) XXX_DiscardUnknown()
func (*LogGroupList) XXX_Marshal ¶
func (m *LogGroupList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*LogGroupList) XXX_Merge ¶
func (m *LogGroupList) XXX_Merge(src proto.Message)
func (*LogGroupList) XXX_Size ¶
func (m *LogGroupList) XXX_Size() int
func (*LogGroupList) XXX_Unmarshal ¶
func (m *LogGroupList) XXX_Unmarshal(b []byte) error
type LogSendRetryQueue ¶
type LogSendRetryQueue struct {
// contains filtered or unexported fields
}
LogSendRetryQueue RetryQueue cache ProducerBatch and retry latter
func (*LogSendRetryQueue) Len ¶
func (retryQueue *LogSendRetryQueue) Len() int
func (*LogSendRetryQueue) Less ¶
func (retryQueue *LogSendRetryQueue) Less(i, j int) bool
func (*LogSendRetryQueue) Pop ¶
func (retryQueue *LogSendRetryQueue) Pop() interface{}
func (*LogSendRetryQueue) Push ¶
func (retryQueue *LogSendRetryQueue) Push(x interface{})
func (*LogSendRetryQueue) Swap ¶
func (retryQueue *LogSendRetryQueue) Swap(i, j int)
type LogTag ¶
type LogTag struct { Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LogTag) Descriptor ¶
func (*LogTag) MarshalToSizedBuffer ¶
func (*LogTag) ProtoMessage ¶
func (*LogTag) ProtoMessage()
func (*LogTag) XXX_DiscardUnknown ¶
func (m *LogTag) XXX_DiscardUnknown()
func (*LogTag) XXX_Marshal ¶
func (*LogTag) XXX_Unmarshal ¶
type Log_Content ¶
type Log_Content struct { Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Log_Content) Descriptor ¶
func (*Log_Content) Descriptor() ([]byte, []int)
func (*Log_Content) GetKey ¶
func (m *Log_Content) GetKey() string
func (*Log_Content) GetValue ¶
func (m *Log_Content) GetValue() string
func (*Log_Content) Marshal ¶
func (m *Log_Content) Marshal() (dAtA []byte, err error)
func (*Log_Content) MarshalToSizedBuffer ¶
func (m *Log_Content) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Log_Content) ProtoMessage ¶
func (*Log_Content) ProtoMessage()
func (*Log_Content) Reset ¶
func (m *Log_Content) Reset()
func (*Log_Content) Size ¶
func (m *Log_Content) Size() (n int)
func (*Log_Content) String ¶
func (m *Log_Content) String() string
func (*Log_Content) Unmarshal ¶
func (m *Log_Content) Unmarshal(dAtA []byte) error
func (*Log_Content) XXX_DiscardUnknown ¶
func (m *Log_Content) XXX_DiscardUnknown()
func (*Log_Content) XXX_Marshal ¶
func (m *Log_Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Log_Content) XXX_Merge ¶
func (m *Log_Content) XXX_Merge(src proto.Message)
func (*Log_Content) XXX_Size ¶
func (m *Log_Content) XXX_Size() int
func (*Log_Content) XXX_Unmarshal ¶
func (m *Log_Content) XXX_Unmarshal(b []byte) error
type Options ¶
type Options struct { Host string Timeout int IdleConn int CompressType string Credentials Credentials }
type ProducerBatch ¶
type ProducerBatch struct {
// contains filtered or unexported fields
}
func NewProducerBatch ¶
func NewProducerBatch(topicID string, config *AsyncProducerClientConfig, callBackFunc CallBack, logData interface{}, packageID string) *ProducerBatch
NewProducerBatch 初始化Producer batch
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) GetErrorCode ¶
func (*Result) GetErrorMessage ¶
func (*Result) GetRequestId ¶
func (*Result) GetReservedAttempts ¶
func (*Result) GetTimeStampMs ¶
func (*Result) IsSuccessful ¶
type SendThreadPool ¶
type SendThreadPool struct {
// contains filtered or unexported fields
}
func NewSendThreadPool ¶
func NewSendThreadPool(worker *Worker) *SendThreadPool
type SyncProducerClient ¶ added in v1.0.3
type SyncProducerClient struct {
// contains filtered or unexported fields
}
SyncProducerClient synchronized producer client
func NewSyncProducerClient ¶ added in v1.0.3
func NewSyncProducerClient(config *SyncProducerClientConfig) (*SyncProducerClient, error)
NewSyncProducerClient new sync producer client
func (*SyncProducerClient) ResetSecretToken ¶ added in v1.0.3
func (c *SyncProducerClient) ResetSecretToken(secretID string, secretKEY string, secretToken string) error
ResetSecretToken reset temporary secret info
func (*SyncProducerClient) SendLogGroupList ¶ added in v1.0.6
func (c *SyncProducerClient) SendLogGroupList(ctx context.Context, topicID string, logGroupList []*LogGroup) error
SendLogGroupList send batched logs to cls
func (*SyncProducerClient) SendLogList ¶ added in v1.0.3
SendLogList send batched logs to cls
type SyncProducerClientConfig ¶ added in v1.0.3
type SyncProducerClientConfig struct { Endpoint string AccessKeyID string AccessKeySecret string AccessToken string Timeout int IdleConn int CompressType string NeedSource bool HostName string }
SyncProducerClientConfig sync producer config
func GetDefaultSyncProducerClientConfig ¶ added in v1.0.3
func GetDefaultSyncProducerClientConfig() *SyncProducerClientConfig
GetDefaultSyncProducerClientConfig get default sync producer config
type TimerSendLogTask ¶
type TimerSendLogTask struct {
// contains filtered or unexported fields
}
func NewTimerSendLogTask ¶
func NewTimerSendLogTask(logAccumulator *Accumulator, retryQueue *LogSendRetryQueue, ioWorker *Worker, threadPool *SendThreadPool) *TimerSendLogTask
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func NewWorker ¶
func NewWorker(clsClient *CLSClient, retryQueue *LogSendRetryQueue, maxSendWorkerCount int64, producer *AsyncProducerClient) *Worker
NewWorker ...
type ZstdDecoderParams ¶ added in v1.0.2
type ZstdDecoderParams struct { }
type ZstdEncoderParams ¶ added in v1.0.2
type ZstdEncoderParams struct {
Level int
}
Source Files ¶
- async_producer_client.go
- async_producer_client_config.go
- attempt.go
- callback.go
- cls.pb.go
- cls_client.go
- error.go
- error_code.go
- log_accumulator.go
- log_send_retry_queue.go
- log_send_thread_pool.go
- producer_batch.go
- result.go
- signature.go
- sync_producer_client.go
- sync_producer_client_config.go
- timer_send_log_task.go
- utils.go
- version.go
- woker.go
- zstd.go