Documentation
¶
Index ¶
- type Metrics
- type Options
- type Reporter
- func (r *Reporter) DecInflight()
- func (r *Reporter) IncError(_ string, reason string)
- func (r *Reporter) IncInflight()
- func (r *Reporter) ObserveBatchAssemble(d time.Duration)
- func (r *Reporter) ObserveBatchSize(n int)
- func (r *Reporter) ObserveEnqueueLatency(d time.Duration)
- func (r *Reporter) ObserveExecuteDuration(table string, n int, d time.Duration, status string)
- func (r *Reporter) SetConcurrency(n int)
- func (r *Reporter) SetQueueLength(n int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics 指标容器
func (*Metrics) StartServer ¶
StartServer 启动一个简易 HTTP 服务(/metrics)
type Options ¶
type Options struct { // 指标命名 Namespace string // 如 "batchsql" Subsystem string // 可为空 ConstLabels map[string]string // 追加到所有指标的常量标签,如 {"env":"prod","region":"cn"} // 标签维度开关(保持开箱可用的最小集) IncludeTestName bool // 是否启用 test_name 维度(适合集成/压测) IncludeTable bool // 是否启用 table 维度(注意基数膨胀) // 直方图桶 EnqueueBuckets []float64 AssembleBuckets []float64 ExecuteBuckets []float64 BatchSizeBuckets []float64 }
Options 配置项(可选)
type Reporter ¶
type Reporter struct { // 绑定维度 Database string TestName string // contains filtered or unexported fields }
Reporter 实现 batchsql.MetricsReporter,写入 Prometheus 指标
func NewReporter ¶
NewReporter 创建 Reporter;database 为必须,testName 可按需要传入
func (*Reporter) ObserveBatchAssemble ¶
ObserveBatchAssemble 攒批耗时
func (*Reporter) ObserveBatchSize ¶
ObserveBatchSize 单独记录批大小
func (*Reporter) ObserveEnqueueLatency ¶
ObserveEnqueueLatency 提交到入队延迟
func (*Reporter) ObserveExecuteDuration ¶
ObserveExecuteDuration 执行耗时(含重试与退避)
Click to show internal directories.
Click to hide internal directories.