handler

package
v0.0.0-...-44638ef Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitCheckManager

func InitCheckManager()

InitCheckManager ...

Types

type CheckAPI

CheckAPI contains all the operations that can be done by an Agent Check. This acts as a proxy to forward data where it needs to go.

type CheckHandler

type CheckHandler interface {
	CheckIdentifier
	CheckAPI
	Name() string
	GetConfig() (config, initConfig integration.Data)
}

CheckHandler represents a wrapper around an Agent Check that allows us track data produced by an agent check, as well as handle transactions for it.

func MakeNonTransactionalCheckHandler

func MakeNonTransactionalCheckHandler(check CheckIdentifier, config, initConfig integration.Data) CheckHandler

MakeNonTransactionalCheckHandler returns an instance of CheckHandler which functions as a fallback.

func NewTransactionalCheckHandler

func NewTransactionalCheckHandler(check CheckIdentifier, config, initConfig integration.Data) CheckHandler

NewTransactionalCheckHandler creates a new check handler for a given check, check loader and configuration

type CheckHandlerBase

type CheckHandlerBase struct {
	CheckIdentifier
	// contains filtered or unexported fields
}

CheckHandlerBase forms the base of the transactional and non-transactional check handler

func (*CheckHandlerBase) GetConfig

func (ch *CheckHandlerBase) GetConfig() (integration.Data, integration.Data)

GetConfig returns the config and the init config of the check

type CheckHealthAPI

type CheckHealthAPI interface {
	SubmitHealthCheckData(stream health.Stream, data health.CheckData)
	SubmitHealthStartSnapshot(stream health.Stream, intervalSeconds int, expirySeconds int)
	SubmitHealthStopSnapshot(stream health.Stream)
}

CheckHealthAPI contains all the health state operations for a check

type CheckIdentifier

type CheckIdentifier interface {
	String() string       // provide a printable version of the check name
	ID() check.ID         // provide a unique identifier for every check instance
	ConfigSource() string // return the configuration source of the check
}

CheckIdentifier encapsulates all the functionality needed to describe and configure an agent check.

func NewCheckIdentifier

func NewCheckIdentifier(checkID check.ID) CheckIdentifier

NewCheckIdentifier returns a IDOnlyCheckIdentifier that implements the CheckIdentifier interface for a given check ID.

type CheckLifecycleAPI

type CheckLifecycleAPI interface {
	SubmitComplete()
}

CheckLifecycleAPI contains all the lifecylce operations for a check

type CheckManager

type CheckManager struct {
	// contains filtered or unexported fields
}

CheckManager acts as the grouping of check handlers and deals with the "lifecycle" of check handlers.

func GetCheckManager

func GetCheckManager() *CheckManager

GetCheckManager returns a handle on the global check checkmanager Instance

func (*CheckManager) GetCheckHandler

func (cm *CheckManager) GetCheckHandler(checkID check.ID) CheckHandler

GetCheckHandler returns a check handler (if found) for a given check ID

func (*CheckManager) MakeCheckHandlerTransactional

func (cm *CheckManager) MakeCheckHandlerTransactional(checkID check.ID) CheckHandler

MakeCheckHandlerTransactional converts a non-transactional check handler to a transactional check handler

func (*CheckManager) RegisterCheckHandler

func (cm *CheckManager) RegisterCheckHandler(check CheckIdentifier, config, initConfig integration.Data) CheckHandler

RegisterCheckHandler registers a check handler for the given check using a transactionbatcher for this instance

func (*CheckManager) Stop

func (cm *CheckManager) Stop()

Stop clears the check handlers and re-initializes the singleton init

func (*CheckManager) UnsubscribeCheckHandler

func (cm *CheckManager) UnsubscribeCheckHandler(checkID check.ID)

UnsubscribeCheckHandler removes a check handler for the given check

type CheckStateAPI

type CheckStateAPI interface {
	SetState(key, state string)
	GetState(key string) string
}

CheckStateAPI contains all the state operations for a check

type CheckTelemetryAPI

type CheckTelemetryAPI interface {
	SubmitRawMetricsData(data telemetry.RawMetrics)
	SubmitEvent(event metrics.Event)
}

CheckTelemetryAPI contains all the telemetry operations for a check

type CheckTopologyAPI

type CheckTopologyAPI interface {
	SubmitComponent(instance topology.Instance, component topology.Component)
	SubmitRelation(instance topology.Instance, relation topology.Relation)
	SubmitStartSnapshot(instance topology.Instance)
	SubmitStopSnapshot(instance topology.Instance)
	SubmitDelete(instance topology.Instance, topologyElementID string)
}

CheckTopologyAPI contains all the topology operations for a check

type CheckTransactionalAPI

type CheckTransactionalAPI interface {
	StartTransaction() string
	StopTransaction()
	DiscardTransaction(reason string)
	SetTransactionState(key, state string)
}

CheckTransactionalAPI contains all the transactionality operations for a check

type Config

type Config struct {
	CheckTransactionalityEnabled bool
}

Config contains all the configuration values for the check manager

func GetCheckManagerConfig

func GetCheckManagerConfig() Config

GetCheckManagerConfig returns the configuration for the checkmanager

type DiscardTransaction

type DiscardTransaction struct {
	Reason string
}

DiscardTransaction is used to cancel the current transaction, and reload the check

type IDOnlyCheckIdentifier

type IDOnlyCheckIdentifier struct {
	// contains filtered or unexported fields
}

IDOnlyCheckIdentifier is used to create a CheckIdentifier when only the checkID is present

func (*IDOnlyCheckIdentifier) ConfigSource

func (*IDOnlyCheckIdentifier) ConfigSource() string

ConfigSource returns an empty string for the IDOnlyCheckIdentifier

func (*IDOnlyCheckIdentifier) ID

func (idCI *IDOnlyCheckIdentifier) ID() check.ID

ID returns the IDOnlyCheckIdentifier checkID

func (*IDOnlyCheckIdentifier) String

func (idCI *IDOnlyCheckIdentifier) String() string

String returns the IDOnlyCheckIdentifier checkID as a string

type NonTransactionalCheckHandler

type NonTransactionalCheckHandler struct {
	CheckHandlerBase
}

NonTransactionalCheckHandler is a wrapper for check that have no register handler.

func (*NonTransactionalCheckHandler) DiscardTransaction

func (ch *NonTransactionalCheckHandler) DiscardTransaction(string)

DiscardTransaction logs a warning for the non-transactional check handler. This should never be called.

func (*NonTransactionalCheckHandler) GetState

func (ch *NonTransactionalCheckHandler) GetState(key string) string

GetState returns a CheckState for a given key

func (*NonTransactionalCheckHandler) Name

Name returns NonTransactionalCheckHandler for the non-transactional check handler

func (*NonTransactionalCheckHandler) SetState

func (ch *NonTransactionalCheckHandler) SetState(key string, state string)

SetState is used to commit state for a given state key and CheckState

func (*NonTransactionalCheckHandler) SetTransactionState

func (ch *NonTransactionalCheckHandler) SetTransactionState(string, string)

SetTransactionState logs a warning for the non-transactional check handler. This should never be called.

func (*NonTransactionalCheckHandler) StartTransaction

func (ch *NonTransactionalCheckHandler) StartTransaction() string

StartTransaction "upgrades" the non-transactional check handler to a transactional check handler, registers it in the check manager and calls StartTransaction on the newly created transactional check handler.

func (*NonTransactionalCheckHandler) StopTransaction

func (ch *NonTransactionalCheckHandler) StopTransaction()

StopTransaction logs a warning for the non-transactional check handler. This should never be called.

func (*NonTransactionalCheckHandler) SubmitComplete

func (ch *NonTransactionalCheckHandler) SubmitComplete()

SubmitComplete submits a complete to the Global Batcher.

func (*NonTransactionalCheckHandler) SubmitComponent

func (ch *NonTransactionalCheckHandler) SubmitComponent(instance topology.Instance, component topology.Component)

SubmitComponent submits a component to the Global Batcher to be batched.

func (*NonTransactionalCheckHandler) SubmitDelete

func (ch *NonTransactionalCheckHandler) SubmitDelete(instance topology.Instance, topologyElementID string)

SubmitDelete submits a topology element delete to the Global Batcher to be batched.

func (*NonTransactionalCheckHandler) SubmitEvent

func (ch *NonTransactionalCheckHandler) SubmitEvent(event metrics.Event)

SubmitEvent submits an event to the forwarder.

func (*NonTransactionalCheckHandler) SubmitHealthCheckData

func (ch *NonTransactionalCheckHandler) SubmitHealthCheckData(stream health.Stream, data health.CheckData)

SubmitHealthCheckData submits health check data to the Global Batcher to be batched.

func (*NonTransactionalCheckHandler) SubmitHealthStartSnapshot

func (ch *NonTransactionalCheckHandler) SubmitHealthStartSnapshot(stream health.Stream, intervalSeconds int, expirySeconds int)

SubmitHealthStartSnapshot submits a health start snapshot to the Global Batcher to be batched.

func (*NonTransactionalCheckHandler) SubmitHealthStopSnapshot

func (ch *NonTransactionalCheckHandler) SubmitHealthStopSnapshot(stream health.Stream)

SubmitHealthStopSnapshot submits a health stop snapshot to the Global Batcher to be batched.

func (*NonTransactionalCheckHandler) SubmitRawMetricsData

func (ch *NonTransactionalCheckHandler) SubmitRawMetricsData(data telemetry.RawMetrics)

SubmitRawMetricsData submits a raw metric value to the Global Batcher to be batched.

func (*NonTransactionalCheckHandler) SubmitRelation

func (ch *NonTransactionalCheckHandler) SubmitRelation(instance topology.Instance, relation topology.Relation)

SubmitRelation submits a relation to the Global Batcher to be batched.

func (*NonTransactionalCheckHandler) SubmitStartSnapshot

func (ch *NonTransactionalCheckHandler) SubmitStartSnapshot(instance topology.Instance)

SubmitStartSnapshot submits a start snapshot to the Global Batcher to be batched.

func (*NonTransactionalCheckHandler) SubmitStopSnapshot

func (ch *NonTransactionalCheckHandler) SubmitStopSnapshot(instance topology.Instance)

SubmitStopSnapshot submits a stop snapshot to the Global Batcher to be batched.

type StartTransaction

type StartTransaction struct {
	CheckID       check.ID
	TransactionID string
}

StartTransaction is used to start a transaction to the input channel

type StopTransaction

type StopTransaction struct{}

StopTransaction is used to stop the current transaction

type SubmitComplete

type SubmitComplete struct{}

SubmitComplete is used to submit a check complete for the current transaction

type SubmitComponent

type SubmitComponent struct {
	Instance  topology.Instance
	Component topology.Component
}

SubmitComponent is used to submit a topology component for the current transaction

type SubmitDelete

type SubmitDelete struct {
	Instance          topology.Instance
	TopologyElementID string
}

SubmitDelete is used to submit a topology delete for the current transaction

type SubmitEvent

type SubmitEvent struct {
	Event metrics.Event
}

SubmitEvent is used to submit an event for the current transaction

type SubmitHealthCheckData

type SubmitHealthCheckData struct {
	Stream health.Stream
	Data   health.CheckData
}

SubmitHealthCheckData is used to submit a health check data for the current transaction

type SubmitHealthStartSnapshot

type SubmitHealthStartSnapshot struct {
	Stream                         health.Stream
	IntervalSeconds, ExpirySeconds int
}

SubmitHealthStartSnapshot is used to submit a health start snapshot for the current transaction

type SubmitHealthStopSnapshot

type SubmitHealthStopSnapshot struct {
	Stream health.Stream
}

SubmitHealthStopSnapshot is used to submit a health stop snapshot for the current transaction

type SubmitRawMetric

type SubmitRawMetric struct {
	Value telemetry.RawMetrics
}

SubmitRawMetric is used to submit a raw metric value for the current transaction

type SubmitRelation

type SubmitRelation struct {
	Instance topology.Instance
	Relation topology.Relation
}

SubmitRelation is used to submit a topology relation for the current transaction

type SubmitSetTransactionState

type SubmitSetTransactionState struct {
	Key, State string
}

SubmitSetTransactionState is used to submit a set state transactional for the current transaction

type SubmitStartSnapshot

type SubmitStartSnapshot struct {
	Instance topology.Instance
}

SubmitStartSnapshot is used to submit a topology start snapshot for the current transaction

type SubmitStopSnapshot

type SubmitStopSnapshot struct {
	Instance topology.Instance
}

SubmitStopSnapshot is used to submit a topology stop snapshot for the current transaction

type TransactionalCheckHandler

type TransactionalCheckHandler struct {
	CheckHandlerBase
	// contains filtered or unexported fields
}

TransactionalCheckHandler provides an interface between the Agent Check and the transactional components.

func (*TransactionalCheckHandler) DiscardTransaction

func (ch *TransactionalCheckHandler) DiscardTransaction(reason string)

DiscardTransaction triggers a transaction failure and reloads the check

func (*TransactionalCheckHandler) GetCurrentTransaction

func (ch *TransactionalCheckHandler) GetCurrentTransaction() string

GetCurrentTransaction returns ch.currentTransaction with a mutex read lock

func (*TransactionalCheckHandler) GetState

func (ch *TransactionalCheckHandler) GetState(key string) string

GetState returns a CheckState for a given key

func (*TransactionalCheckHandler) Name

func (ch *TransactionalCheckHandler) Name() string

Name returns TransactionalCheckHandler for the transactional check handler

func (*TransactionalCheckHandler) SetState

func (ch *TransactionalCheckHandler) SetState(key string, state string)

SetState is used to commit state for a given state key and CheckState

func (*TransactionalCheckHandler) SetTransactionState

func (ch *TransactionalCheckHandler) SetTransactionState(key string, state string)

SetTransactionState is used to set state transactionaly. This state is only committed once a transaction has been completed successfully.

func (*TransactionalCheckHandler) Start

func (ch *TransactionalCheckHandler) Start()

Start starts the check handler to "listen" and handle check transactions or shutdown

func (*TransactionalCheckHandler) StartTransaction

func (ch *TransactionalCheckHandler) StartTransaction() string

StartTransaction submits a start transaction for the check handler. This blocks any future transactions until this one completes, fails or is timed out.

func (*TransactionalCheckHandler) Stop

func (ch *TransactionalCheckHandler) Stop()

Stop stops the check handler txReceiverHandler

func (*TransactionalCheckHandler) StopTransaction

func (ch *TransactionalCheckHandler) StopTransaction()

StopTransaction submits a complete to the Transactional Batcher, to send the final payload of the transaction and mark the current transaction as complete.

func (*TransactionalCheckHandler) SubmitComplete

func (ch *TransactionalCheckHandler) SubmitComplete()

SubmitComplete submits a complete to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitComponent

func (ch *TransactionalCheckHandler) SubmitComponent(instance topology.Instance, component topology.Component)

SubmitComponent submits a component to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitDelete

func (ch *TransactionalCheckHandler) SubmitDelete(instance topology.Instance, topologyElementID string)

SubmitDelete submits a topology element delete to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitEvent

func (ch *TransactionalCheckHandler) SubmitEvent(event metrics.Event)

SubmitEvent submits an event to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitHealthCheckData

func (ch *TransactionalCheckHandler) SubmitHealthCheckData(stream health.Stream, data health.CheckData)

SubmitHealthCheckData submits health check data to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitHealthStartSnapshot

func (ch *TransactionalCheckHandler) SubmitHealthStartSnapshot(stream health.Stream, intervalSeconds int, expirySeconds int)

SubmitHealthStartSnapshot submits a health start snapshot to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitHealthStopSnapshot

func (ch *TransactionalCheckHandler) SubmitHealthStopSnapshot(stream health.Stream)

SubmitHealthStopSnapshot submits a health stop snapshot to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitRawMetricsData

func (ch *TransactionalCheckHandler) SubmitRawMetricsData(data telemetry.RawMetrics)

SubmitRawMetricsData submits a raw metric value to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitRelation

func (ch *TransactionalCheckHandler) SubmitRelation(instance topology.Instance, relation topology.Relation)

SubmitRelation submits a relation to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitStartSnapshot

func (ch *TransactionalCheckHandler) SubmitStartSnapshot(instance topology.Instance)

SubmitStartSnapshot submits a start snapshot to the current transaction channel to be forwarded.

func (*TransactionalCheckHandler) SubmitStopSnapshot

func (ch *TransactionalCheckHandler) SubmitStopSnapshot(instance topology.Instance)

SubmitStopSnapshot submits a stop snapshot to the current transaction channel to be forwarded.

Jump to

Keyboard shortcuts

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