timelinemanager

package module
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: MIT Imports: 8 Imported by: 0

README

Timeline Manager

This library manages multiple timeline instances to allow the use of multiple backends and provides useful shortcut functions to manipulate these timelines.

Timeline library?

Click here

Sample TOML

hashingAlgorithm = "shake128"
hashSize = 6
dataTTL = "2m"
transportBufferSize = 1024
batchSendInterval = "30s"
requestTimeout = "5s"
serializerBufferSize = 2048
debugInput = false
debugOutput = true
timeBetweenBatches = "10ms"
printStackOnError = true

[openTSDBTransport]
    readBufferSize = 64
    maxReadTimeout = "100ms"
    reconnectionTimeout = "3s"
    maxReconnectionRetries = 5
    disconnectAfterWrites = true

[httpTransport]
    serviceEndpoint = "/api/put"
    method = "POST"
    expectedResponseStatus = 204
    timestampProperty = "timestamp"
    valueProperty = "value"

[[backends]]
    addHostTag    = true
    cycleDuration = "15s"
    host          = "host1"
    port          = 8123
    storage       = "normal"
    type          = "opentsdb"
        [backends.commonTags]
        tag1 = "val1"
        tag2 = "val2"
        tag3 = "val3"

[[backends]]
    addHostTag    = true
    cycleDuration = "25s"
    host          = "host2"
    port          = 8124
    storage       = "archive"
    type          = "opentsdb"
        [backends.commonTags]
        tag4 = "val4"
        tag5 = "val5"
        tag6 = "val6"

[[backends]]
    addHostTag    = false
    cycleDuration = "35s"
    host          = "host3"
    port          = 8125
    storage       = "custom"
    type          = "http"
        [backends.commonTags]
        tag7 = "val7"
        tag8 = "val8"
        tag9 = "val9"

Documentation

Index

Constants

View Source
const (
	// Normal - normal storage backend
	Normal StorageType = "normal"

	// Archive - archive storage backend
	Archive StorageType = "archive"

	// HTTP - http transport type
	HTTP TransportType = "http"

	// OpenTSDB - opentsdb transport type
	OpenTSDB TransportType = "opentsdb"
)
View Source
const (
	// RawHTTP - defines a no flattened operation
	RawHTTP timeline.FlatOperation = 100
	// RawOpenTSDB - defines a no flattened operation
	RawOpenTSDB timeline.FlatOperation = 101
)

Variables

View Source
var ErrStorageNotFound error = fmt.Errorf("storage type not found")

ErrStorageNotFound - raised when a storage type was not found

View Source
var ErrTransportNotSupported error = fmt.Errorf("transport not supported")

ErrTransportNotSupported - raised when a transport is not supported for the specified storage

Functions

This section is empty.

Types

type BackendItem

type BackendItem struct {
	timeline.Backend
	Storage       StorageType
	Type          TransportType
	CycleDuration funks.Duration
	AddHostTag    bool
	CommonTags    map[string]string
}

BackendItem - one backend configuration

type Configuration

type Configuration struct {
	Backends         []BackendItem
	HashingAlgorithm hashing.Algorithm
	HashSize         int
	DataTTL          funks.Duration
	timeline.DefaultTransportConfiguration
	OpenTSDBTransport *timeline.OpenTSDBTransportConfig
	HTTPTransport     *timeline.HTTPTransportConfig
}

Configuration - configuration

func (*Configuration) Validate added in v1.2.1

func (c *Configuration) Validate() error

Validate - validates the configuration

type Instance added in v1.2.0

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

Instance - manages the configured number of timeline manager instances

func New

func New(configuration *Configuration) (*Instance, error)

New - creates a new instance

func (*Instance) AccumulateCustomHashN added in v1.2.0

func (tm *Instance) AccumulateCustomHashN(hash string) (bool, error)

AccumulateCustomHashN - calls the accumulate function using normal storage

func (*Instance) AccumulateHashedData added in v1.2.0

func (tm *Instance) AccumulateHashedData(stype StorageType, hash string) (bool, error)

AccumulateHashedData - accumulates a hashed data

func (*Instance) FlattenAvgN added in v1.2.0

func (tm *Instance) FlattenAvgN(caller string, value float64, metric string, tags ...interface{})

FlattenAvgN - calls the Flatten function using normal storage and average operation

func (*Instance) FlattenCountIncA added in v1.2.0

func (tm *Instance) FlattenCountIncA(caller string, metric string, tags ...interface{})

FlattenCountIncA - calls the Flatten function using archive storage and count operation (adds 1 to the value)

func (*Instance) FlattenCountIncN added in v1.2.0

func (tm *Instance) FlattenCountIncN(caller string, metric string, tags ...interface{})

FlattenCountIncN - calls the Flatten function using normal storage and count operation (adds 1 to the value)

func (*Instance) FlattenCountN added in v1.2.0

func (tm *Instance) FlattenCountN(caller string, value float64, metric string, tags ...interface{})

FlattenCountN - calls the Flatten function using normal storage and count operation

func (*Instance) FlattenMaxN added in v1.2.0

func (tm *Instance) FlattenMaxN(caller string, value float64, metric string, tags ...interface{})

FlattenMaxN - calls the Flatten function using normal storage and maximum operation

func (*Instance) FlattenMinN added in v1.2.0

func (tm *Instance) FlattenMinN(caller string, value float64, metric string, tags ...interface{})

FlattenMinN - calls the Flatten function using normal storage and minimum operation

func (*Instance) GetConfiguredDataTTL added in v1.2.0

func (tm *Instance) GetConfiguredDataTTL() time.Duration

GetConfiguredDataTTL - returns the configured data ttl

func (*Instance) Send added in v1.2.0

func (tm *Instance) Send(caller string, stype StorageType, op timeline.FlatOperation, value float64, metric string, tags ...interface{}) error

Send - send a point or do a flatten operation

func (*Instance) SendText added in v1.2.0

func (tm *Instance) SendText(caller string, stype StorageType, value, metric string, tags ...interface{}) error

SendText - send a text point

func (*Instance) Shutdown added in v1.2.0

func (tm *Instance) Shutdown()

Shutdown - shuts down the timeline manager

func (*Instance) Start added in v1.2.0

func (tm *Instance) Start() error

Start - starts the timeline manager

func (*Instance) StoreCustomHashN added in v1.2.0

func (tm *Instance) StoreCustomHashN(hash string, metric string, tags ...interface{}) error

StoreCustomHashN - calls the store hash function using normal storage

func (*Instance) StoreDefaultTTLCustomHash added in v1.2.0

func (tm *Instance) StoreDefaultTTLCustomHash(storage StorageType, hash string, metric string, tags ...interface{}) error

StoreDefaultTTLCustomHash - stores with default configured ttl

func (*Instance) StoreHashedData added in v1.2.0

func (tm *Instance) StoreHashedData(stype StorageType, hash string, ttl time.Duration, metric string, tags ...interface{}) error

StoreHashedData - stores the hashed data

func (*Instance) StoreNoTTLCustomHashN added in v1.2.0

func (tm *Instance) StoreNoTTLCustomHashN(hash string, metric string, tags ...interface{}) error

StoreNoTTLCustomHashN - calls the store hash function using normal storage with no ttl

type StorageType

type StorageType string

StorageType - the storage type constant

type TransportType added in v1.2.0

type TransportType string

TransportType - the transport type constant

Jump to

Keyboard shortcuts

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