diagnosis

package
v0.11.3-generic-streaming Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 0 Imported by: 3

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

func RegisterProbeFunc(svc Service, name ProbeName, pf ProbeFunc)

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"
	ServiceInfosKey    ProbeName = "service_infos"
	FallbackServiceKey ProbeName = "fallback_service"
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL