Documentation ¶
Overview ¶
Package diagnosis provide support to register probe func that can get some infos to do diagnosis.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterProbeFunc ¶ added in v0.1.0
RegisterProbeFunc is a wrap function to execute Service.RegisterProbeFunc.
Types ¶
type ProbeFunc ¶
type ProbeFunc func() interface{}
ProbeFunc is used to get probe data, it is usually a data dump func.
func WrapAsProbeFunc ¶
func WrapAsProbeFunc(data interface{}) ProbeFunc
WrapAsProbeFunc is to wrap probe data as ProbeFunc, the data is some infos that you want to diagnosis, like config info.
type ProbeName ¶
type ProbeName string
ProbeName is the name of probe.
const ( // Common ChangeEventsKey ProbeName = "events" ServiceInfoKey ProbeName = "service_info" OptionsKey ProbeName = "options" // Client DestServiceKey ProbeName = "dest_service" ConnPoolKey ProbeName = "conn_pool" RetryPolicyKey ProbeName = "retry_policy" )
Keys below are probe info that has been registered by default. If you want to register other info, please use RegisterProbeFunc(ProbeName, ProbeFunc) to do that.
type Service ¶
type Service interface { // RegisterProbeFunc is used to register ProbeFunc with probe name // ProbeFunc is usually a dump func that to dump info to do problem diagnosis, // eg: CBSuite.Dump(), s.RegisterProbeFunc(CircuitInfoKey, cbs.Dump) RegisterProbeFunc(ProbeName, ProbeFunc) }
Service is the interface for debug service.
var NoopService Service = &noopService{}
NoopService is an empty implementation of Service. If you need diagnosis feature, specify Service through the option WithDiagnosisService of client and server.