db

package
v0.1.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	From    *Bucket
	Name    string
	AInterv time.Duration
	RPeriod time.Duration
	First   bool
}

bucket parameters

type Influx

type Influx struct {
	Client         influxdb2.Client
	Org            string
	Statsb         string
	Bwb            string
	DsMemLimit     float64
	AggrCnt        int
	CardMedium     int
	CardHevy       int
	DbHasResources bool
}

influxdb parameters

func NewInflux

func NewInflux(url, token, org, sb, bw string, timeout uint) Influx

Make new Influxdb struct

func (*Influx) Cardinality

func (i *Influx) Cardinality(b *Bucket, inst string) (int, error)

Cardinality retrieves the cardinality for a given instance in a bucket.

Parameters:

b *Bucket - the bucket object
inst string - the instance name

Returns:

int - the cardinality count
error - an error, if any

func (*Influx) Downsample

func (i *Influx) Downsample(b *Bucket, inst string, col string) error

Downsample performs downsampling of measurements of the given instance in the bucket based on collection. It returns an error, if any.

func (*Influx) GetAllInstances added in v0.1.2

func (i *Influx) GetAllInstances(b *Bucket, c string) ([]string, error)

GetAllInstances retrieves instances for the given bucket based on collection type.

Parameters:

b: *Bucket - the bucket for which to retrieve instances
c: string - the collection type

Return:

[]string - a slice of instances
error - an error, if any

func (*Influx) GetDsInstances

func (i *Influx) GetDsInstances(b *Bucket, c string) (map[string][]string, error)

GetDsInstances retrieves instances for the given bucket based on collection type, and groups them by cardinality.

Parameters:

b: *Bucket - the bucket for which to retrieve instances
c: string - the collection type

Return:

map[string][]string - a map of instance groups by cardinality
error - an error, if any

func (*Influx) GetMemUsage

func (i *Influx) GetMemUsage() (*float64, error)

GetMemUsage retrieves the memory usage percentage from Influx database.

No parameters. Returns a pointer to float64 and an error.

func (*Influx) GetRunningTasks

func (i *Influx) GetRunningTasks() (*float64, error)

GetRunningTasks retrieves the count of running tasks from InfluxDB.

Returns a pointer to float64 and an error.

func (*Influx) IsBwUtilDone added in v0.1.2

func (i *Influx) IsBwUtilDone(inst string) (bool, error)

IsBwUtilDone returns true if bandwidth data for yesterday is available for a given instance.

Parameters:

inst string - the instance name

Return:

bool - true/false
error - any error that occurred during the query

func (*Influx) LastTS

func (i *Influx) LastTS(b *Bucket, inst, col string) (time.Time, error)

LastTS returns the timestamp of the latest data point for a given instance in a bucket based on collection.

Parameters:

b *Bucket - the bucket to query
inst string - the instance name
col string - the collection

Return:

time.Time - the timestamp of the latest data point
error - any error that occurred during the query

func (*Influx) StoreBwUsage added in v0.1.2

func (i *Influx) StoreBwUsage(inst string) error

StoreBwUsage performs eth port bandwidth usage calculation and storage for given instance. It returns an error, if any.

Jump to

Keyboard shortcuts

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