Documentation ¶
Index ¶
- Constants
- func PoolPutLogStatValue(value *LogStatValue)
- type EventLogReporter
- type EventQueue
- type LogStatHandler
- type LogStatKey
- type LogStatValue
- type RateLimitCurveReporter
- func (s *RateLimitCurveReporter) BuildReportRecord() *ReportRecord
- func (s *RateLimitCurveReporter) CreateCollectorV1() *plugin.RateLimitStatCollectorV1
- func (s *RateLimitCurveReporter) CreateCollectorV2() *plugin.RateLimitStatCollectorV2
- func (s *RateLimitCurveReporter) DropCollector(collector plugin.RateLimitStatCollector)
- func (s *RateLimitCurveReporter) GetTagStr(value plugin.RateLimitStatValue) string
- func (s *RateLimitCurveReporter) GetValueStr(value plugin.RateLimitStatValue) string
- func (s *RateLimitCurveReporter) MergeAllStatValues(isCurve bool) map[interface{}]plugin.RateLimitStatValue
- type ReportConfig
- type ReportHandler
- type ReportItem
- type ReportRecord
- type ServerCurveReporter
- func (s *ServerCurveReporter) AddIncrement(apiCallStatValue plugin.APICallStatValue)
- func (s *ServerCurveReporter) BuildReportRecord() *ReportRecord
- func (s *ServerCurveReporter) GetTagStr(value plugin.APICallStatValue) string
- func (s *ServerCurveReporter) GetValueStr(value plugin.APICallStatValue) string
- type StaticsWorker
- func (s *StaticsWorker) AddAPICall(value plugin.APICallStatValue)
- func (s *StaticsWorker) AddEventToLog(value plugin.EventToLog)
- func (s *StaticsWorker) CreateRateLimitStatCollectorV1() *plugin.RateLimitStatCollectorV1
- func (s *StaticsWorker) CreateRateLimitStatCollectorV2() *plugin.RateLimitStatCollectorV2
- func (s *StaticsWorker) Destroy() error
- func (s *StaticsWorker) DropRateLimitStatCollector(value plugin.RateLimitStatCollector)
- func (s *StaticsWorker) Initialize(conf *plugin.ConfigEntry) error
- func (s *StaticsWorker) Name() string
- func (s *StaticsWorker) Start(ctx context.Context)
Constants ¶
const ( // ServerTagStrPattern 标签字符串模板 ServerTagStrPattern = "inf=%s&err_code=%d&duration=%s&msg_type=%s&limit_service=%s" // ServerTagValuePatter 数据字符串模板 ServerTagValuePatter = "latency.max.interface=%d&latency.avg.interface=%d&count.network_err=%d" + "&count.system_err=%d&count.user_err=%d&count.success=%d&count.total=%d" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventLogReporter ¶
type EventLogReporter struct {
// contains filtered or unexported fields
}
EventLogReporter 事件日志上报器
func NewEventLogReporter ¶
func NewEventLogReporter(cfg *ReportConfig) *EventLogReporter
NewEventLogReporter 创建对象
func (*EventLogReporter) AddEvent ¶
func (e *EventLogReporter) AddEvent(event plugin.EventToLog)
AddEvent 写入事件
func (*EventLogReporter) LogAllEvents ¶
func (e *EventLogReporter) LogAllEvents() int
LogAllEvents 获取所有的事件日志
type EventQueue ¶
type EventQueue struct {
// contains filtered or unexported fields
}
EventQueue 事件收集器
type LogStatHandler ¶
type LogStatHandler struct {
// contains filtered or unexported fields
}
LogStatHandler 统计日志打印处理器
func NewLogStatHandler ¶
func NewLogStatHandler(cfg *ReportConfig) *LogStatHandler
NewLogStatHandler 创建曲线上报系统
func (*LogStatHandler) LogPrecisionRecord ¶
func (l *LogStatHandler) LogPrecisionRecord(values map[interface{}]plugin.RateLimitStatValue) int
LogPrecisionRecord 打印精度上报记录
type LogStatKey ¶
type LogStatKey struct { Namespace string `json:"namespace"` Service string `json:"service"` Method string `json:"method"` AppId string `json:"app_id"` Uin string `json:"uin"` Labels string `json:"labels"` Duration int64 `json:"duration"` }
LogStatKey 日志上报的Key
type LogStatValue ¶
type LogStatValue struct { LogStatKey Passed int64 `json:"passed"` Total int64 `json:"total"` Limited int64 `json:"limited"` TimeNumber int64 `json:"time_number"` TimeStr string `json:"time_str"` }
LogStatValue 日志总体统计内容
type RateLimitCurveReporter ¶
type RateLimitCurveReporter struct {
// contains filtered or unexported fields
}
RateLimitCurveReporter 限流曲线上报
func NewRateLimitCurveReporter ¶
func NewRateLimitCurveReporter(config *ReportConfig) *RateLimitCurveReporter
NewRateLimitCurveReporter 创建曲线上报系统
func (*RateLimitCurveReporter) BuildReportRecord ¶
func (s *RateLimitCurveReporter) BuildReportRecord() *ReportRecord
BuildReportRecord 构建上报记录
func (*RateLimitCurveReporter) CreateCollectorV1 ¶
func (s *RateLimitCurveReporter) CreateCollectorV1() *plugin.RateLimitStatCollectorV1
CreateCollectorV1 创建采集器V2
func (*RateLimitCurveReporter) CreateCollectorV2 ¶
func (s *RateLimitCurveReporter) CreateCollectorV2() *plugin.RateLimitStatCollectorV2
CreateCollectorV2 创建采集器V2
func (*RateLimitCurveReporter) DropCollector ¶
func (s *RateLimitCurveReporter) DropCollector(collector plugin.RateLimitStatCollector)
DropCollector 创建采集器V2
func (*RateLimitCurveReporter) GetTagStr ¶
func (s *RateLimitCurveReporter) GetTagStr(value plugin.RateLimitStatValue) string
GetTagStr 上报的Tag字符串
func (*RateLimitCurveReporter) GetValueStr ¶
func (s *RateLimitCurveReporter) GetValueStr(value plugin.RateLimitStatValue) string
GetValueStr 上报的数据值
func (*RateLimitCurveReporter) MergeAllStatValues ¶
func (s *RateLimitCurveReporter) MergeAllStatValues(isCurve bool) map[interface{}]plugin.RateLimitStatValue
MergeAllStatValues 汇总所有的统计数据
type ReportConfig ¶
type ReportConfig struct { RateLimitAppName string `json:"ratelimit-app-name"` RateLimitReportLogPath string `json:"ratelimit_report_log_path"` RateLimitPrecisionLogPath string `json:"ratelimit_precision_log_path"` RateLimitEventLogPath string `json:"ratelimit_event_log_path"` ServerAppName string `json:"server-app-name"` ServerReportLogPath string `json:"server_report_log_path"` PrecisionLogInterval int `json:"precision_log_interval"` LogInterval int `json:"log_interval"` LogSize int `json:"log_size"` LogBackups int `json:"log_backups"` LogMaxAge int `json:"log_max_age"` }
ReportConfig 智研上报配置项
type ReportHandler ¶
type ReportHandler interface { // Report 上报 Report(*ReportRecord) }
ReportHandler 上报处理器
func NewReportHandler ¶
func NewReportHandler(cfg *ReportConfig) ReportHandler
NewReportHandler 新建上报处理器
type ReportRecord ¶
type ReportRecord struct { AppName string Tags []*ReportItem }
ReportRecord 上报数据
type ServerCurveReporter ¶
type ServerCurveReporter struct {
// contains filtered or unexported fields
}
ServerCurveReporter 限流曲线上报
func NewServerCurveReporter ¶
func NewServerCurveReporter(config *ReportConfig) *ServerCurveReporter
NewServerCurveReporter 创建曲线上报系统
func (*ServerCurveReporter) AddIncrement ¶
func (s *ServerCurveReporter) AddIncrement(apiCallStatValue plugin.APICallStatValue)
AddIncrement 添加增量数据
func (*ServerCurveReporter) BuildReportRecord ¶
func (s *ServerCurveReporter) BuildReportRecord() *ReportRecord
BuildReportRecord 构建上报记录
func (*ServerCurveReporter) GetTagStr ¶
func (s *ServerCurveReporter) GetTagStr(value plugin.APICallStatValue) string
GetTagStr 上报的Tag字符串
func (*ServerCurveReporter) GetValueStr ¶
func (s *ServerCurveReporter) GetValueStr(value plugin.APICallStatValue) string
GetValueStr 上报的数据值
type StaticsWorker ¶
type StaticsWorker struct {
// contains filtered or unexported fields
}
StaticsWorker 智研上报处理器
func (*StaticsWorker) AddAPICall ¶
func (s *StaticsWorker) AddAPICall(value plugin.APICallStatValue)
AddAPICall 服务方法调用结果反馈,含有规则的计算周期
func (*StaticsWorker) AddEventToLog ¶
func (s *StaticsWorker) AddEventToLog(value plugin.EventToLog)
AddEventToLog 添加事件
func (*StaticsWorker) CreateRateLimitStatCollectorV1 ¶
func (s *StaticsWorker) CreateRateLimitStatCollectorV1() *plugin.RateLimitStatCollectorV1
CreateRateLimitStatCollectorV1 创建采集器V1,每个stream上来后获取一次
func (*StaticsWorker) CreateRateLimitStatCollectorV2 ¶
func (s *StaticsWorker) CreateRateLimitStatCollectorV2() *plugin.RateLimitStatCollectorV2
CreateRateLimitStatCollectorV2 创建采集器V2,每个stream上来后获取一次
func (*StaticsWorker) DropRateLimitStatCollector ¶
func (s *StaticsWorker) DropRateLimitStatCollector(value plugin.RateLimitStatCollector)
DropRateLimitStatCollector 归还采集器
func (*StaticsWorker) Initialize ¶
func (s *StaticsWorker) Initialize(conf *plugin.ConfigEntry) error
Initialize 初始化统计插件