services

package
v0.0.0-...-d17e12a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusProcessing = "processing"
	StatusRunning    = "running"
	StatusStopped    = "stopped"
	StatusUnknown    = "unknown"
)

Status as untyped string constants to avoid conversions for expvar

View Source
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

View Source
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

This section is empty.

Types

type AgentService

type AgentService struct {
	*config.Connector
	// contains filtered or unexported fields
}

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()
	RegisterDemandConfigHandler(func() bool)
	RemoveDemandConfigHandler()
	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

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 GetController

func GetController() *Controller

GetController implements Singleton pattern

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

type Credentials struct {
	GwosAppName  string
	GwosAPIToken string
}

Credentials defines type of AuthCache items

type Entrypoint

type Entrypoint struct {
	URL     string
	Method  string
	Handler func(c *gin.Context)
}

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 NewStats

func NewStats() *Stats

func (Stats) MarshalJSON

func (p Stats) MarshalJSON() ([]byte, error)

type Status

type Status string

Status defines status value

type TickerFn

type TickerFn struct {
	time.Ticker
	Stop func()
	// contains filtered or unexported fields
}

TickerFn is wrapper for time.Ticker

func NewTickerFn

func NewTickerFn(d time.Duration, fn func()) *TickerFn

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

Jump to

Keyboard shortcuts

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