api

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// HostHeader contains the hostname of the payload
	HostHeader = "X-Dd-Hostname"
	// ContainerCountHeader contains the container count in the payload
	ContainerCountHeader = "X-Dd-ContainerCount"
	// ProcessVersionHeader holds the process agent version sending the payload
	ProcessVersionHeader = "X-Dd-Processagentversion"
	// ClusterIDHeader contains the orchestrator cluster ID of this agent
	ClusterIDHeader = "X-Dd-Orchestrator-ClusterID"
	// TimestampHeader contains the timestamp that the check data was created
	TimestampHeader = "X-DD-Agent-Timestamp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	APIKey   string
	Endpoint *url.URL
}

Endpoint is a single endpoint where process data will be submitted.

type WeightedItem

type WeightedItem interface {
	// Weight returns the weight of this item
	Weight() int64
	// Type returns the type of this item
	Type() string
}

WeightedItem is an item that has a type and weight that can be added to a WeightedQueue

type WeightedQueue

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

WeightedQueue is a queue of WeightedItems.

The queue is configured with a maximum size (the maximum number of elements allowed in the queue) as well as a maximum weight. If adding an item to the queue would violate either the max weight or max size, earlier items are purged from the queue until there is room for the newest item.

Items added to the queue have a weight and type. When purging existing items to make room for new, items of the same type being added will be removed first before moving on to other types.

func NewWeightedQueue

func NewWeightedQueue(maxSize int, maxWeight int64) *WeightedQueue

NewWeightedQueue returns a new WeightedQueue with the given maximum size & weight

func (*WeightedQueue) Add

func (q *WeightedQueue) Add(item WeightedItem)

Add adds the item to the queue.

func (*WeightedQueue) Len

func (q *WeightedQueue) Len() int

Len returns the number of items in the queue

func (*WeightedQueue) Poll

func (q *WeightedQueue) Poll(exit chan struct{}) (WeightedItem, bool)

Poll retrieves the head of the queue or blocks until an item is available. The provided exit channel can be closed to interrupt the blocking operation. Returns the head of the queue and true or nil, false if the poll was interrupted by the closing of the exit channel

func (*WeightedQueue) Weight

func (q *WeightedQueue) Weight() int64

Weight returns the current weight of the queue

Jump to

Keyboard shortcuts

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