Documentation ¶
Index ¶
- Constants
- func DefaultRPCServer() rpc.TerwayTracingServer
- func RPCServer(tracer *Tracer) rpc.TerwayTracingServer
- func RecordNodeEvent(eventType, reason, message string) error
- func RecordPodEvent(podName, podNamespace, eventType, reason, message string) error
- func Register(typ, resourceName string, handler TraceHandler) error
- func RegisterEventRecorder(node NodeEventRecorder, pod PodEventRecorder)
- func RegisterResourceMapping(handler ResMapping)
- func Unregister(typ, resourceName string)
- type FakeResourcePoolStats
- type MapKeyValueEntry
- type NodeEventRecorder
- type PodEventRecorder
- type ResMapping
- type ResourceMappingHandler
- type ResourcePoolStats
- type TraceHandler
- type Tracer
- func (t *Tracer) Execute(typ, resourceName, cmd string, args []string) (<-chan string, error)
- func (t *Tracer) GetConfig(typ, resourceName string) ([]MapKeyValueEntry, error)
- func (t *Tracer) GetResourceMapping() ([]*rpc.ResourceMapping, error)
- func (t *Tracer) GetResourceNames(typ string) []string
- func (t *Tracer) GetTrace(typ, resourceName string) ([]MapKeyValueEntry, error)
- func (t *Tracer) GetTypes() []string
- func (t *Tracer) RecordNodeEvent(eventType, reason, message string) error
- func (t *Tracer) RecordPodEvent(podName, podNamespace, eventType, reason, message string) error
- func (t *Tracer) Register(typ, resourceName string, handler TraceHandler) error
- func (t *Tracer) RegisterEventRecorder(node NodeEventRecorder, pod PodEventRecorder)
- func (t *Tracer) RegisterResourceMapping(mapping ResMapping)
- func (t *Tracer) Unregister(typ, resourceName string)
Constants ¶
const ( // ResourceTypeNetworkService represents resource of a network service ResourceTypeNetworkService = "network_service" // ResourceTypeResourcePool represents resource of a resource pool(object pool) ResourceTypeResourcePool = "resource_pool" // ResourceTypeFactory represents resource of a factory(eniip/eni) ResourceTypeFactory = "factory" // DisposeResourceFailed DisposeResourceFailed DisposeResourceFailed = "DisposeResourceFailed" // AllocResourceFailed AllocResourceFailed AllocResourceFailed = "AllocResourceFailed" )
Variables ¶
This section is empty.
Functions ¶
func DefaultRPCServer ¶
func DefaultRPCServer() rpc.TerwayTracingServer
DefaultRPCServer returns the RPC server for default tracer
func RPCServer ¶
func RPCServer(tracer *Tracer) rpc.TerwayTracingServer
RPCServer returns RPC server for the given tracer
func RecordNodeEvent ¶
RecordNodeEvent records node event via PodEventRecorder
func RecordPodEvent ¶
RecordPodEvent records pod event via PodEventRecorder
func Register ¶
func Register(typ, resourceName string, handler TraceHandler) error
Register registers a TraceHandler to the default tracer
func RegisterEventRecorder ¶
func RegisterEventRecorder(node NodeEventRecorder, pod PodEventRecorder)
RegisterEventRecorder registers pod & node event recorder to a tracer
func RegisterResourceMapping ¶
func RegisterResourceMapping(handler ResMapping)
RegisterResourceMapping register resource mapping handler to the default tracer
func Unregister ¶
func Unregister(typ, resourceName string)
Unregister removes TraceHandler from tracer. do nothing if not found
Types ¶
type FakeResourcePoolStats ¶
FakeResourcePoolStats for test
type MapKeyValueEntry ¶
MapKeyValueEntry uses for a in-order key-value store
type NodeEventRecorder ¶
type NodeEventRecorder func(eventType, reason, message string)
NodeEventRecorder records event on node
type PodEventRecorder ¶
PodEventRecorder records event on pod
type ResMapping ¶
type ResMapping interface {
GetResourceMapping() ([]*rpc.ResourceMapping, error)
}
ResMapping ResMapping
type ResourceMappingHandler ¶
type ResourceMappingHandler interface {
GetResourceMapping() (ResourcePoolStats, error)
}
ResourceMappingHandler get resource mapping
type ResourcePoolStats ¶
type ResourcePoolStats interface { GetLocal() map[string]daemon.Res GetRemote() map[string]daemon.Res }
ResourcePoolStats define two pool lo and remote
type TraceHandler ¶
type TraceHandler interface { // Config() returns the static resource config (like min_idle, max_idle, etc) as []MapKeyValueEntry Config() []MapKeyValueEntry // Trace() returns the trace info (like ENIs count, MAC address) as []MapKeyValueEntry Trace() []MapKeyValueEntry // Execute(string, []string) execute command in the registered resource, and returns a string channel as stream // if the execution has done, the channel should be closed Execute(cmd string, args []string, message chan<- string) }
TraceHandler declares functions should be implemented in a tracing component
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer manages tracing handlers registered from the system
func (*Tracer) Execute ¶
Execute invokes Execute() function of the given type & resource name with command and arguments
func (*Tracer) GetConfig ¶
func (t *Tracer) GetConfig(typ, resourceName string) ([]MapKeyValueEntry, error)
GetConfig invokes Config() function of the given type & resource name
func (*Tracer) GetResourceMapping ¶
func (t *Tracer) GetResourceMapping() ([]*rpc.ResourceMapping, error)
GetResourceMapping gives the resource mapping from the handler if the handler has not been registered, there will be error
func (*Tracer) GetResourceNames ¶
GetResourceNames lists resource names of a certain type
func (*Tracer) GetTrace ¶
func (t *Tracer) GetTrace(typ, resourceName string) ([]MapKeyValueEntry, error)
GetTrace invokes Trace() function of the given type & resource name
func (*Tracer) RecordNodeEvent ¶
RecordNodeEvent records node event via PodEventRecorder
func (*Tracer) RecordPodEvent ¶
RecordPodEvent records pod event via PodEventRecorder
func (*Tracer) Register ¶
func (t *Tracer) Register(typ, resourceName string, handler TraceHandler) error
Register registers a TraceHandler to the tracer
func (*Tracer) RegisterEventRecorder ¶
func (t *Tracer) RegisterEventRecorder(node NodeEventRecorder, pod PodEventRecorder)
RegisterEventRecorder registers pod & node event recorder to a tracer
func (*Tracer) RegisterResourceMapping ¶
func (t *Tracer) RegisterResourceMapping(mapping ResMapping)
RegisterResourceMapping registers handler to the tracer
func (*Tracer) Unregister ¶
Unregister remove TraceHandler from tracer. do nothing if not found