transactionbatcher

package
v0.0.0-...-c4caace Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTransactionalBatcher

func InitTransactionalBatcher(hostname, agentName string, maxCapacity int)

InitTransactionalBatcher initializes the global transactional transactionbatcher Instance

Types

type BatchTransaction

type BatchTransaction struct {
	TransactionID        string
	CompletedTransaction bool
}

BatchTransaction keeps state of the transaction for a given check

type MockTransactionalBatcher

type MockTransactionalBatcher struct {
	CollectedTopology TransactionBatchBuilder
	// contains filtered or unexported fields
}

MockTransactionalBatcher mocks implementation of a transactionbatcher

func NewMockTransactionalBatcher

func NewMockTransactionalBatcher() *MockTransactionalBatcher

NewMockTransactionalBatcher initializes the global transactionbatcher with a mock version, intended for testing

func (*MockTransactionalBatcher) GetCheckState

GetCheckState returns the TransactionCheckInstanceBatchState for a given check ID

func (*MockTransactionalBatcher) StartTransaction

func (mtb *MockTransactionalBatcher) StartTransaction(checkID check.ID, transactionID string)

StartTransaction starts a transaction for the given check ID

func (*MockTransactionalBatcher) Stop

func (mtb *MockTransactionalBatcher) Stop()

Stop shuts down the transactionbatcher and resets the singleton init

func (*MockTransactionalBatcher) SubmitClearState

func (mtb *MockTransactionalBatcher) SubmitClearState(checkID check.ID)

SubmitClearState clears the batch state for a given checkID

func (*MockTransactionalBatcher) SubmitCompleteTransaction

func (mtb *MockTransactionalBatcher) SubmitCompleteTransaction(checkID check.ID, transactionID string)

SubmitCompleteTransaction marks a transaction as complete

func (*MockTransactionalBatcher) SubmitComponent

func (mtb *MockTransactionalBatcher) SubmitComponent(checkID check.ID, transactionID string, instance topology.Instance, component topology.Component)

SubmitComponent submits a component to the batch

func (*MockTransactionalBatcher) SubmitDelete

func (mtb *MockTransactionalBatcher) SubmitDelete(checkID check.ID, transactionID string, instance topology.Instance, topologyElementID string)

SubmitDelete submits a deletion of topology element.

func (*MockTransactionalBatcher) SubmitEvent

func (mtb *MockTransactionalBatcher) SubmitEvent(checkID check.ID, transactionID string, event metrics.Event)

SubmitEvent submits an event to the batch

func (*MockTransactionalBatcher) SubmitHealthCheckData

func (mtb *MockTransactionalBatcher) SubmitHealthCheckData(checkID check.ID, transactionID string, stream health.Stream, data health.CheckData)

SubmitHealthCheckData submits a Health check data record to the batch

func (*MockTransactionalBatcher) SubmitHealthStartSnapshot

func (mtb *MockTransactionalBatcher) SubmitHealthStartSnapshot(checkID check.ID, transactionID string, stream health.Stream, intervalSeconds int, expirySeconds int)

SubmitHealthStartSnapshot submits start of a Health snapshot

func (*MockTransactionalBatcher) SubmitHealthStopSnapshot

func (mtb *MockTransactionalBatcher) SubmitHealthStopSnapshot(checkID check.ID, transactionID string, stream health.Stream)

SubmitHealthStopSnapshot submits a stop of a Health snapshot. This always causes a flush of the data downstream

func (*MockTransactionalBatcher) SubmitRawMetricsData

func (mtb *MockTransactionalBatcher) SubmitRawMetricsData(checkID check.ID, transactionID string, rawMetric telemetry.RawMetrics)

SubmitRawMetricsData submits a raw metrics data record to the batch

func (*MockTransactionalBatcher) SubmitRelation

func (mtb *MockTransactionalBatcher) SubmitRelation(checkID check.ID, transactionID string, instance topology.Instance, relation topology.Relation)

SubmitRelation submits a relation to the batch

func (*MockTransactionalBatcher) SubmitStartSnapshot

func (mtb *MockTransactionalBatcher) SubmitStartSnapshot(checkID check.ID, transactionID string, instance topology.Instance)

SubmitStartSnapshot submits start of a snapshot

func (*MockTransactionalBatcher) SubmitStopSnapshot

func (mtb *MockTransactionalBatcher) SubmitStopSnapshot(checkID check.ID, transactionID string, instance topology.Instance)

SubmitStopSnapshot submits a stop of a snapshot. This always causes a flush of the data downstream

type StartTransaction

type StartTransaction struct {
	CheckID       check.ID
	TransactionID string
}

StartTransaction is used to submit a start transaction to the input channel

type SubmitClearState

type SubmitClearState struct {
	CheckID check.ID
}

SubmitClearState is used to clear batcher state for a given CheckID

type SubmitCompleteTransaction

type SubmitCompleteTransaction struct {
	CheckID       check.ID
	TransactionID string
}

SubmitCompleteTransaction is used to submit a transaction complete to the input channel

type SubmitComponent

type SubmitComponent struct {
	CheckID       check.ID
	TransactionID string
	Instance      topology.Instance
	Component     topology.Component
}

SubmitComponent is used to submit a component to the input channel

type SubmitDelete

type SubmitDelete struct {
	CheckID       check.ID
	TransactionID string
	Instance      topology.Instance
	DeleteID      string
}

SubmitDelete is used to submit a topology delete to the input channel

type SubmitEvent

type SubmitEvent struct {
	CheckID       check.ID
	TransactionID string
	Event         metrics.Event
}

SubmitEvent is used to submit a event to the input channel

type SubmitHealthCheckData

type SubmitHealthCheckData struct {
	CheckID       check.ID
	TransactionID string
	Stream        health.Stream
	Data          health.CheckData
}

SubmitHealthCheckData is used to submit health check data to the input channel

type SubmitHealthStartSnapshot

type SubmitHealthStartSnapshot struct {
	CheckID         check.ID
	TransactionID   string
	Stream          health.Stream
	IntervalSeconds int
	ExpirySeconds   int
}

SubmitHealthStartSnapshot is used to submit health check start snapshot to the input channel

type SubmitHealthStopSnapshot

type SubmitHealthStopSnapshot struct {
	CheckID       check.ID
	TransactionID string
	Stream        health.Stream
}

SubmitHealthStopSnapshot is used to submit health check stop snapshot to the input channel

type SubmitRawMetricsData

type SubmitRawMetricsData struct {
	CheckID       check.ID
	TransactionID string
	RawMetric     telemetry.RawMetrics
}

SubmitRawMetricsData is used to submit a raw metric value to the input channel

type SubmitRelation

type SubmitRelation struct {
	CheckID       check.ID
	TransactionID string
	Instance      topology.Instance
	Relation      topology.Relation
}

SubmitRelation is used to submit a relation to the input channel

type SubmitShutdown

type SubmitShutdown struct{}

SubmitShutdown is used to submit a shutdown of the transactionbatcher to the input channel

type SubmitStartSnapshot

type SubmitStartSnapshot struct {
	CheckID       check.ID
	TransactionID string
	Instance      topology.Instance
}

SubmitStartSnapshot is used to submit a start of a snapshot to the input channel

type SubmitStopSnapshot

type SubmitStopSnapshot struct {
	CheckID       check.ID
	TransactionID string
	Instance      topology.Instance
}

SubmitStopSnapshot is used to submit a stop of a snapshot to the input channel

type TransactionBatchBuilder

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

TransactionBatchBuilder is a helper class to build Topology based on submitted data, this data structure is not thread safe

func NewTransactionalBatchBuilder

func NewTransactionalBatchBuilder(maxCapacity int) TransactionBatchBuilder

NewTransactionalBatchBuilder constructs a TransactionBatchBuilder

func (*TransactionBatchBuilder) AddComponent

func (builder *TransactionBatchBuilder) AddComponent(checkID check.ID, transactionID string, instance topology.Instance, component topology.Component) TransactionCheckInstanceBatchStates

AddComponent adds a component

func (*TransactionBatchBuilder) AddEvent

func (builder *TransactionBatchBuilder) AddEvent(checkID check.ID, transactionID string, event metrics.Event) TransactionCheckInstanceBatchStates

AddEvent adds a event

func (*TransactionBatchBuilder) AddHealthCheckData

func (builder *TransactionBatchBuilder) AddHealthCheckData(checkID check.ID, transactionID string, stream health.Stream, data health.CheckData) TransactionCheckInstanceBatchStates

AddHealthCheckData adds a component

func (*TransactionBatchBuilder) AddRawMetricsData

func (builder *TransactionBatchBuilder) AddRawMetricsData(checkID check.ID, transactionID string, rawMetric telemetry.RawMetrics) TransactionCheckInstanceBatchStates

AddRawMetricsData adds raw metric data

func (*TransactionBatchBuilder) AddRelation

func (builder *TransactionBatchBuilder) AddRelation(checkID check.ID, transactionID string, instance topology.Instance, relation topology.Relation) TransactionCheckInstanceBatchStates

AddRelation adds a relation

func (*TransactionBatchBuilder) ClearState

ClearState removes the batch state for a given checkID

func (*TransactionBatchBuilder) Delete

func (builder *TransactionBatchBuilder) Delete(checkID check.ID, transactionID string, instance topology.Instance, deleteID string) TransactionCheckInstanceBatchStates

Delete deletes a topology element

func (*TransactionBatchBuilder) Flush

Flush the collected data. Returning the data and wiping the current build up Topology

func (*TransactionBatchBuilder) HealthStartSnapshot

func (builder *TransactionBatchBuilder) HealthStartSnapshot(checkID check.ID, transactionID string, stream health.Stream, repeatIntervalSeconds int, expirySeconds int) TransactionCheckInstanceBatchStates

HealthStartSnapshot starts a Health snapshot

func (*TransactionBatchBuilder) HealthStopSnapshot

func (builder *TransactionBatchBuilder) HealthStopSnapshot(checkID check.ID, transactionID string, stream health.Stream) TransactionCheckInstanceBatchStates

HealthStopSnapshot stops a Health snapshot. This will always flush

func (*TransactionBatchBuilder) MarkTransactionComplete

func (builder *TransactionBatchBuilder) MarkTransactionComplete(checkID check.ID, transactionID string) TransactionCheckInstanceBatchStates

MarkTransactionComplete marks a transaction as complete and flushes the data if produced

func (*TransactionBatchBuilder) StartTransaction

func (builder *TransactionBatchBuilder) StartTransaction(checkID check.ID, transactionID string) TransactionCheckInstanceBatchStates

StartTransaction creates a batch transaction for the given check ID

func (*TransactionBatchBuilder) TopologyStartSnapshot

func (builder *TransactionBatchBuilder) TopologyStartSnapshot(checkID check.ID, transactionID string, instance topology.Instance) TransactionCheckInstanceBatchStates

TopologyStartSnapshot starts a snapshot

func (*TransactionBatchBuilder) TopologyStopSnapshot

func (builder *TransactionBatchBuilder) TopologyStopSnapshot(checkID check.ID, transactionID string, instance topology.Instance) TransactionCheckInstanceBatchStates

TopologyStopSnapshot stops a snapshot. This will always flush

type TransactionCheckInstanceBatchState

type TransactionCheckInstanceBatchState struct {
	Transaction *BatchTransaction
	Topology    *topology.Topology
	Metrics     *telemetry.Metrics
	Health      map[string]health.Health
	Events      *metrics.IntakeEvents
}

TransactionCheckInstanceBatchState is the type representing batched data per check Instance

func (TransactionCheckInstanceBatchState) JSONString

JSONString returns a JSON string representation of a TransactionCheckInstanceBatchState

type TransactionCheckInstanceBatchStates

type TransactionCheckInstanceBatchStates map[check.ID]TransactionCheckInstanceBatchState

TransactionCheckInstanceBatchStates is the type representing batched data for all check instances

type TransactionalBatcher

type TransactionalBatcher interface {
	// Topology
	SubmitComponent(checkID check.ID, transactionID string, instance topology.Instance, component topology.Component)
	SubmitRelation(checkID check.ID, transactionID string, instance topology.Instance, relation topology.Relation)
	SubmitStartSnapshot(checkID check.ID, transactionID string, instance topology.Instance)
	SubmitStopSnapshot(checkID check.ID, transactionID string, instance topology.Instance)
	SubmitDelete(checkID check.ID, transactionID string, instance topology.Instance, topologyElementID string)

	// Health
	SubmitHealthCheckData(checkID check.ID, transactionID string, stream health.Stream, data health.CheckData)
	SubmitHealthStartSnapshot(checkID check.ID, transactionID string, stream health.Stream, intervalSeconds int, expirySeconds int)
	SubmitHealthStopSnapshot(checkID check.ID, transactionID string, stream health.Stream)

	// Raw Metrics
	SubmitRawMetricsData(checkID check.ID, transactionID string, data telemetry.RawMetrics)

	// Events
	SubmitEvent(checkID check.ID, transactionID string, event metrics.Event)

	// Transactional
	StartTransaction(checkID check.ID, transactionID string)
	SubmitCompleteTransaction(checkID check.ID, transactionID string)

	// lifecycle
	SubmitClearState(checkID check.ID)
	Stop()
}

TransactionalBatcher interface can receive data for sending to the intake and will accumulate the data in batches. This does not work on a fixed schedule like the aggregator but flushes either when data exceeds a threshold, when data is complete.

func GetTransactionalBatcher

func GetTransactionalBatcher() TransactionalBatcher

GetTransactionalBatcher returns a handle on the global transactionbatcher Instance

Jump to

Keyboard shortcuts

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