Initial open source release
This commit is contained in:
commit
74992e893f
377 changed files with 118084 additions and 0 deletions
25
internal/rpc/metrics.go
Normal file
25
internal/rpc/metrics.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package rpc
|
||||
|
||||
import "time"
|
||||
|
||||
// Metrics 接收 RPC 业务层指标。默认 NopMetrics,后续可对接 Prometheus。
|
||||
type Metrics interface {
|
||||
MessageSend(d time.Duration, duplicate bool, err error)
|
||||
MessageRateLimited(retryAfterSeconds int)
|
||||
OutboxClaimed(count int)
|
||||
OutboxDelivered(d time.Duration)
|
||||
OutboxFailed(err error)
|
||||
}
|
||||
|
||||
// NopMetrics 是 Metrics 的空实现。
|
||||
type NopMetrics struct{}
|
||||
|
||||
func (NopMetrics) MessageSend(time.Duration, bool, error) {}
|
||||
|
||||
func (NopMetrics) MessageRateLimited(int) {}
|
||||
|
||||
func (NopMetrics) OutboxClaimed(int) {}
|
||||
|
||||
func (NopMetrics) OutboxDelivered(time.Duration) {}
|
||||
|
||||
func (NopMetrics) OutboxFailed(error) {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue