Documentation ¶
Index ¶
- Constants
- Variables
- func CheckSQLiteDB(itemId int64) bool
- func DecodeSumKey(sumKey string) (serverId int64, timeString string, version int32, err error)
- func DecodeSumValue(data []byte) (count uint64, total uint64)
- func DecodeValueKey(valueKey string) (serverId int64, timeString string, version int32, value int64, hash string, ...)
- func EncodeSumValue(count uint64, total uint64) []byte
- func UniqueKey(serverId int64, keys []string, time string, version int32, itemId int64) string
- type BaseTask
- type ItemEncoder
- type KVTask
- func (this *KVTask) CleanExpired() error
- func (this *KVTask) Delete() error
- func (this *KVTask) Flush() error
- func (this *KVTask) Init() error
- func (this *KVTask) InsertStat(stat *Stat) error
- func (this *KVTask) Start() error
- func (this *KVTask) Stop() error
- func (this *KVTask) TestInspect(t *testing.T)
- func (this *KVTask) Truncate() error
- func (this *KVTask) Upload(pauseDuration time.Duration) error
- type Manager
- func (this *Manager) Add(obj MetricInterface)
- func (this *Manager) HasHTTPMetrics() bool
- func (this *Manager) HasTCPMetrics() bool
- func (this *Manager) HasUDPMetrics() bool
- func (this *Manager) Quit()
- func (this *Manager) TaskMap() map[int64]Task
- func (this *Manager) Update(items []*serverconfigs.MetricItemConfig)
- type MetricInterface
- type SQLiteTask
- func (this *SQLiteTask) CleanExpired() error
- func (this *SQLiteTask) Delete() error
- func (this *SQLiteTask) Init() error
- func (this *SQLiteTask) InsertStat(stat *Stat) error
- func (this *SQLiteTask) Start() error
- func (this *SQLiteTask) Stop() error
- func (this *SQLiteTask) Upload(pauseDuration time.Duration) error
- type Stat
- type Task
Constants ¶
View Source
const MaxQueueSize = 256 // TODO 可以配置,可以在单个任务里配置
Variables ¶
Functions ¶
func CheckSQLiteDB ¶ added in v1.3.5
func DecodeSumKey ¶ added in v1.3.5
func DecodeSumValue ¶ added in v1.3.5
func DecodeValueKey ¶ added in v1.3.5
func EncodeSumValue ¶ added in v1.3.5
Types ¶
type BaseTask ¶ added in v1.3.5
type BaseTask struct {
// contains filtered or unexported fields
}
func (*BaseTask) Item ¶ added in v1.3.5
func (this *BaseTask) Item() *serverconfigs.MetricItemConfig
func (*BaseTask) SetItem ¶ added in v1.3.5
func (this *BaseTask) SetItem(itemConfig *serverconfigs.MetricItemConfig)
type ItemEncoder ¶ added in v1.3.5
type ItemEncoder[T interface{ *Stat }] struct { }
func (*ItemEncoder[T]) Decode ¶ added in v1.3.5
func (this *ItemEncoder[T]) Decode(valueBytes []byte) (value T, err error)
func (*ItemEncoder[T]) Encode ¶ added in v1.3.5
func (this *ItemEncoder[T]) Encode(value T) ([]byte, error)
func (*ItemEncoder[T]) EncodeField ¶ added in v1.3.5
func (this *ItemEncoder[T]) EncodeField(value T, fieldName string) ([]byte, error)
type KVTask ¶ added in v1.3.5
type KVTask struct { BaseTask // contains filtered or unexported fields }
KVTask KV存储实现的任务管理
func NewKVTask ¶ added in v1.3.5
func NewKVTask(itemConfig *serverconfigs.MetricItemConfig) *KVTask
func (*KVTask) CleanExpired ¶ added in v1.3.5
func (*KVTask) InsertStat ¶ added in v1.3.5
func (*KVTask) TestInspect ¶ added in v1.3.5
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
func (*Manager) HasHTTPMetrics ¶
func (*Manager) HasTCPMetrics ¶
func (*Manager) HasUDPMetrics ¶
func (*Manager) Update ¶
func (this *Manager) Update(items []*serverconfigs.MetricItemConfig)
type MetricInterface ¶
type SQLiteTask ¶ added in v1.3.5
type SQLiteTask struct { BaseTask // contains filtered or unexported fields }
SQLiteTask 单个指标任务 数据库存储:
data/ metric.$ID.db stats id, keys, value, time, serverId, hash 原理: 添加或者有变更时 isUploaded = false 上传时检查 isUploaded 状态 只上传每个服务中排序最前面的 N 个数据
func NewSQLiteTask ¶ added in v1.3.5
func NewSQLiteTask(item *serverconfigs.MetricItemConfig) *SQLiteTask
NewSQLiteTask 获取新任务
func (*SQLiteTask) CleanExpired ¶ added in v1.3.5
func (this *SQLiteTask) CleanExpired() error
CleanExpired 清理数据
func (*SQLiteTask) Delete ¶ added in v1.3.5
func (this *SQLiteTask) Delete() error
func (*SQLiteTask) InsertStat ¶ added in v1.3.5
func (this *SQLiteTask) InsertStat(stat *Stat) error
InsertStat 写入数据
type Stat ¶
type Stat struct { ServerId int64 `json:"serverId"` Keys []string `json:"keys"` Hash string `json:"hash"` Value int64 `json:"value"` Time string `json:"time"` }
func (*Stat) EncodeSumKey ¶ added in v1.3.5
func (*Stat) EncodeValueKey ¶ added in v1.3.5
type Task ¶
type Task interface { Init() error Item() *serverconfigs.MetricItemConfig SetItem(item *serverconfigs.MetricItemConfig) Add(obj MetricInterface) InsertStat(stat *Stat) error Upload(pauseDuration time.Duration) error Start() error Stop() error Delete() error CleanExpired() error }
Click to show internal directories.
Click to hide internal directories.