metering

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// SamplingIntervalInSeconds - interval is 30 seconds
	// it is important that Prometheus scraping must be set to 30 seconds the same as this samping interval
	SamplingIntervalInSeconds = 30

	// DefaultUsageByteLimit is set to 100GB
	DefaultUsageByteLimit = 100000000000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TenantsUsage

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

TenantsUsage manages the tenant usage metering

func NewTenantsUsage

func NewTenantsUsage(url, pulsarToken, clusterName string, tenantByteOutLimit uint64) *TenantsUsage

NewTenantsUsage creates a TenantsUsage

func (*TenantsUsage) PromGauge

func (t *TenantsUsage) PromGauge(gaugeType, tenant string, num uint64)

PromGauge registers gauge reading

func (*TenantsUsage) ReportHighUsageTenant

func (t *TenantsUsage) ReportHighUsageTenant() (errStr string)

ReportHighUsageTenant reports high usage tenant as error return type

func (*TenantsUsage) UpdateUsages

func (t *TenantsUsage) UpdateUsages()

UpdateUsages computes the usage by comparing with the last use

type Usage

type Usage struct {
	Name             string    `json:"name"`
	TotalMessagesIn  uint64    `json:"totalMessagesIn"`
	TotalBytesIn     uint64    `json:"totalBytesIn"`
	TotalMessagesOut uint64    `json:"totalMessagesOut"`
	TotalBytesOut    uint64    `json:"totalBytesOut"`
	MsgInBacklog     uint64    `json:"msgInBacklog"`
	UpdatedAt        time.Time `json:"updatedAt"`
}

Usage is the data usage per single tenant

type Usages

type Usages []Usage

Usages the array usage that returns from the burnell usage query

Jump to

Keyboard shortcuts

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