Documentation ¶
Index ¶
- Constants
- Variables
- func Put2Nats(ctx context.Context, subj string, payload []byte, headers ...string) error
- type AgentService
- func (service *AgentService) DemandConfig() error
- func (service *AgentService) Exit() error
- func (service *AgentService) ExitAsync() (*taskqueue.Task, error)
- func (service *AgentService) MakeTracerContext() *transit.TracerContext
- func (service *AgentService) Quit() <-chan struct{}
- func (service *AgentService) RegisterConfigHandler(fn func([]byte))
- func (service *AgentService) RegisterExitHandler(fn func())
- func (service *AgentService) RemoveConfigHandler()
- func (service *AgentService) RemoveExitHandler()
- func (service *AgentService) ResetNats() error
- func (service *AgentService) ResetNatsAsync() (*taskqueue.Task, error)
- func (service *AgentService) StartController() error
- func (service *AgentService) StartControllerAsync() (*taskqueue.Task, error)
- func (service *AgentService) StartNats() error
- func (service *AgentService) StartNatsAsync() (*taskqueue.Task, error)
- func (service *AgentService) StartTransport() error
- func (service *AgentService) StartTransportAsync() (*taskqueue.Task, error)
- func (service *AgentService) Stats() AgentStatsExt
- func (service *AgentService) Status() AgentStatus
- func (service *AgentService) StopController() error
- func (service *AgentService) StopControllerAsync() (*taskqueue.Task, error)
- func (service *AgentService) StopNats() error
- func (service *AgentService) StopNatsAsync() (*taskqueue.Task, error)
- func (service *AgentService) StopTransport() error
- func (service *AgentService) StopTransportAsync() (*taskqueue.Task, error)
- type AgentServices
- type AgentStatsExt
- type AgentStatus
- type ConnectorStatusDTO
- type Controller
- type Controllers
- type Credentials
- type Entrypoint
- type Stats
- type Status
- type TickerFn
- type TransitService
- func (service *TransitService) ClearInDowntime(ctx context.Context, payload []byte) error
- func (service *TransitService) ListMetrics() ([]byte, error)
- func (service *TransitService) RegisterListMetricsHandler(handler func() ([]byte, error))
- func (service *TransitService) RemoveListMetricsHandler()
- func (service *TransitService) SendEvents(ctx context.Context, payload []byte) error
- func (service *TransitService) SendEventsAck(ctx context.Context, payload []byte) error
- func (service *TransitService) SendEventsUnack(ctx context.Context, payload []byte) error
- func (service *TransitService) SendResourceWithMetrics(ctx context.Context, payload []byte) error
- func (service *TransitService) SetInDowntime(ctx context.Context, payload []byte) error
- func (service *TransitService) SynchronizeInventory(ctx context.Context, payload []byte) error
- type TransitServices
Constants ¶
const ( StatusProcessing = "processing" StatusRunning = "running" StatusStopped = "stopped" StatusUnknown = "unknown" )
Status as untyped string constants to avoid conversions for expvar
const ( EnvSuppressDowntimes = "TCG_SUPPRESS_DOWNTIMES" EnvSuppressEvents = "TCG_SUPPRESS_EVENTS" EnvSuppressInventory = "TCG_SUPPRESS_INVENTORY" EnvSuppressMetrics = "TCG_SUPPRESS_METRICS" )
EnvSuppressX provides ability to globally suppress the submission of all data. Not for any production use-case, but strictly troubleshooting: this would be useful in troubleshooting to isolate synch issues to malformed perf data (which is a really common problem)
Variables ¶
var AllowSignalHandlers = true
AllowSignalHandlers defines setting the signal handlers true by default, handle signals: os.Interrupt, syscall.SIGTERM false on init of C-shared library libtransit
Functions ¶
Types ¶
type AgentService ¶
AgentService implements AgentServices interface
func GetAgentService ¶
func GetAgentService() *AgentService
GetAgentService implements Singleton pattern
func (*AgentService) DemandConfig ¶
func (service *AgentService) DemandConfig() error
DemandConfig implements AgentServices.DemandConfig interface
func (*AgentService) Exit ¶
func (service *AgentService) Exit() error
Exit implements AgentServices.Exit interface
func (*AgentService) ExitAsync ¶
func (service *AgentService) ExitAsync() (*taskqueue.Task, error)
ExitAsync implements AgentServices.ExitAsync interface
func (*AgentService) MakeTracerContext ¶
func (service *AgentService) MakeTracerContext() *transit.TracerContext
MakeTracerContext implements AgentServices.MakeTracerContext interface
func (*AgentService) Quit ¶
func (service *AgentService) Quit() <-chan struct{}
Quit returns channel useful for main loop
func (*AgentService) RegisterConfigHandler ¶
func (service *AgentService) RegisterConfigHandler(fn func([]byte))
RegisterConfigHandler sets callback useful for process extensions
func (*AgentService) RegisterExitHandler ¶
func (service *AgentService) RegisterExitHandler(fn func())
RegisterExitHandler sets callback
func (*AgentService) RemoveConfigHandler ¶
func (service *AgentService) RemoveConfigHandler()
RemoveConfigHandler removes callback
func (*AgentService) RemoveExitHandler ¶
func (service *AgentService) RemoveExitHandler()
RemoveExitHandler removes callback
func (*AgentService) ResetNats ¶
func (service *AgentService) ResetNats() error
ResetNats implements AgentServices.ResetNats interface
func (*AgentService) ResetNatsAsync ¶
func (service *AgentService) ResetNatsAsync() (*taskqueue.Task, error)
ResetNatsAsync implements AgentServices.ResetNatsAsync interface
func (*AgentService) StartController ¶
func (service *AgentService) StartController() error
StartController implements AgentServices.StartController interface
func (*AgentService) StartControllerAsync ¶
func (service *AgentService) StartControllerAsync() (*taskqueue.Task, error)
StartControllerAsync implements AgentServices.StartControllerAsync interface
func (*AgentService) StartNats ¶
func (service *AgentService) StartNats() error
StartNats implements AgentServices.StartNats interface
func (*AgentService) StartNatsAsync ¶
func (service *AgentService) StartNatsAsync() (*taskqueue.Task, error)
StartNatsAsync implements AgentServices.StartNatsAsync interface
func (*AgentService) StartTransport ¶
func (service *AgentService) StartTransport() error
StartTransport implements AgentServices.StartTransport interface.
func (*AgentService) StartTransportAsync ¶
func (service *AgentService) StartTransportAsync() (*taskqueue.Task, error)
StartTransportAsync implements AgentServices.StartTransportAsync interface.
func (*AgentService) Stats ¶
func (service *AgentService) Stats() AgentStatsExt
Stats implements AgentServices.Stats interface
func (*AgentService) Status ¶
func (service *AgentService) Status() AgentStatus
Status implements AgentServices.Status interface
func (*AgentService) StopController ¶
func (service *AgentService) StopController() error
StopController implements AgentServices.StopController interface
func (*AgentService) StopControllerAsync ¶
func (service *AgentService) StopControllerAsync() (*taskqueue.Task, error)
StopControllerAsync implements AgentServices.StopControllerAsync interface
func (*AgentService) StopNats ¶
func (service *AgentService) StopNats() error
StopNats implements AgentServices.StopNats interface
func (*AgentService) StopNatsAsync ¶
func (service *AgentService) StopNatsAsync() (*taskqueue.Task, error)
StopNatsAsync implements AgentServices.StopNatsAsync interface
func (*AgentService) StopTransport ¶
func (service *AgentService) StopTransport() error
StopTransport implements AgentServices.StopTransport interface
func (*AgentService) StopTransportAsync ¶
func (service *AgentService) StopTransportAsync() (*taskqueue.Task, error)
StopTransportAsync implements AgentServices.StopTransportAsync interface
type AgentServices ¶
type AgentServices interface { DemandConfig() error Quit() <-chan struct{} MakeTracerContext() *transit.TracerContext RegisterConfigHandler(func([]byte)) RemoveConfigHandler() RegisterExitHandler(func()) RemoveExitHandler() Stats() Stats Status() AgentStatus ExitAsync() (*taskqueue.Task, error) ResetNatsAsync() (*taskqueue.Task, error) StartControllerAsync() (*taskqueue.Task, error) StopControllerAsync() (*taskqueue.Task, error) StartNatsAsync() (*taskqueue.Task, error) StopNatsAsync() (*taskqueue.Task, error) StartTransportAsync() (*taskqueue.Task, error) StopTransportAsync() (*taskqueue.Task, error) Exit() error ResetNats() error StartController() error StopController() error StartNats() error StopNats() error StartTransport() error StopTransport() error }
AgentServices defines TCG Agent services interface
type AgentStatsExt ¶
type AgentStatsExt struct { transit.AgentIdentity Stats LastErrors []logzer.LogRecord `json:"lastErrors"` }
AgentStatsExt defines complex type
func (AgentStatsExt) MarshalJSON ¶
func (p AgentStatsExt) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface handles nested structures
type AgentStatus ¶
type AgentStatus struct { Controller *expvar.String Transport *expvar.String Nats *expvar.String // contains filtered or unexported fields }
AgentStatus defines TCG Agent status exports debug info
func NewAgentStatus ¶
func NewAgentStatus() *AgentStatus
func (AgentStatus) String ¶
func (p AgentStatus) String() string
type ConnectorStatusDTO ¶
type ConnectorStatusDTO struct { Status Status `json:"connectorStatus"` JobID uint8 `json:"jobId,omitempty"` }
ConnectorStatusDTO describes status
type Controller ¶
type Controller struct { *TransitService // contains filtered or unexported fields }
Controller implements AgentServices, Controllers interface
func (*Controller) RegisterEntrypoints ¶
func (controller *Controller) RegisterEntrypoints(entrypoints []Entrypoint)
RegisterEntrypoints sets addition API
func (*Controller) RemoveEntrypoints ¶
func (controller *Controller) RemoveEntrypoints()
RemoveEntrypoints removes addition API
type Controllers ¶
type Controllers interface { RegisterEntrypoints([]Entrypoint) RemoveEntrypoints() }
Controllers defines TCG Agent controllers interface
type Credentials ¶
Credentials defines type of AuthCache items
type Entrypoint ¶
Entrypoint describes controller API
type Stats ¶
type Stats struct { BytesSent *expvar.Int MetricsSent *expvar.Int MessagesSent *expvar.Int ExecutionTimeInventory *expvar.Int ExecutionTimeMetrics *expvar.Int LastEventsRun *expvar.Int LastInventoryRun *expvar.Int LastMetricsRun *expvar.Int UpSince *expvar.Int // contains filtered or unexported fields }
Stats defines TCG statistics exports debug info
func (Stats) MarshalJSON ¶
type TransitService ¶
type TransitService struct { *AgentService // contains filtered or unexported fields }
TransitService implements AgentServices, TransitServices interfaces
func GetTransitService ¶
func GetTransitService() *TransitService
GetTransitService implements Singleton pattern
func (*TransitService) ClearInDowntime ¶
func (service *TransitService) ClearInDowntime(ctx context.Context, payload []byte) error
ClearInDowntime implements TransitServices.ClearInDowntime interface
func (*TransitService) ListMetrics ¶
func (service *TransitService) ListMetrics() ([]byte, error)
ListMetrics implements TransitServices.ListMetrics interface
func (*TransitService) RegisterListMetricsHandler ¶
func (service *TransitService) RegisterListMetricsHandler(handler func() ([]byte, error))
RegisterListMetricsHandler implements TransitServices.RegisterListMetricsHandler interface
func (*TransitService) RemoveListMetricsHandler ¶
func (service *TransitService) RemoveListMetricsHandler()
RemoveListMetricsHandler implements TransitServices.RemoveListMetricsHandler interface
func (*TransitService) SendEvents ¶
func (service *TransitService) SendEvents(ctx context.Context, payload []byte) error
SendEvents implements TransitServices.SendEvents interface
func (*TransitService) SendEventsAck ¶
func (service *TransitService) SendEventsAck(ctx context.Context, payload []byte) error
SendEventsAck implements TransitServices.SendEventsAck interface
func (*TransitService) SendEventsUnack ¶
func (service *TransitService) SendEventsUnack(ctx context.Context, payload []byte) error
SendEventsUnack implements TransitServices.SendEventsUnack interface
func (*TransitService) SendResourceWithMetrics ¶
func (service *TransitService) SendResourceWithMetrics(ctx context.Context, payload []byte) error
SendResourceWithMetrics implements TransitServices.SendResourceWithMetrics interface
func (*TransitService) SetInDowntime ¶
func (service *TransitService) SetInDowntime(ctx context.Context, payload []byte) error
SetInDowntime implements TransitServices.SetInDowntime interface
func (*TransitService) SynchronizeInventory ¶
func (service *TransitService) SynchronizeInventory(ctx context.Context, payload []byte) error
SynchronizeInventory implements TransitServices.SynchronizeInventory interface
type TransitServices ¶
type TransitServices interface { ListMetrics() ([]byte, error) RegisterListMetricsHandler(func() ([]byte, error)) RemoveListMetricsHandler() ClearInDowntime(context.Context, []byte) error SetInDowntime(context.Context, []byte) error SendEvents(context.Context, []byte) error SendEventsAck(context.Context, []byte) error SendEventsUnack(context.Context, []byte) error SendResourceWithMetrics(context.Context, []byte) error SynchronizeInventory(context.Context, []byte) error }
TransitServices defines TCG Agent services interface