linmetric

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RootRegistry represents root level metric Registry.
	RootRegistry = &Registry{
		series: make(map[uint64]*taggedSeries),
	}
	// BrokerRegistry represents broker level metric Registry.
	BrokerRegistry = &Registry{
		series: make(map[uint64]*taggedSeries),
	}
	// StorageRegistry represents storage level metric Registry.
	StorageRegistry = &Registry{
		series: make(map[uint64]*taggedSeries),
	}
)

Functions

This section is empty.

Types

type BoundCounter

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

BoundCounter is a counter which has been Bound to a certain metric with field-name and metrics, it does not support update method. Get will resets the underlying delta value

func (*BoundCounter) Add

func (c *BoundCounter) Add(v float64)

Add adds v to c.

func (*BoundCounter) Decr

func (c *BoundCounter) Decr()

Decr decrements g.

func (*BoundCounter) Get

func (c *BoundCounter) Get() float64

Get returns the current delta counter value

func (*BoundCounter) Incr

func (c *BoundCounter) Incr()

Incr increments c.

func (*BoundCounter) Sub

func (c *BoundCounter) Sub(v float64)

Sub subs v to c.

type BoundGauge

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

BoundGauge is a gauge which has Bound to a certain metric with field-name and tags

func (*BoundGauge) Add

func (g *BoundGauge) Add(v float64)

Add adds v to g.

func (*BoundGauge) Decr

func (g *BoundGauge) Decr()

Decr decrements g.

func (*BoundGauge) Get

func (g *BoundGauge) Get() float64

Get returns the current gauge value

func (*BoundGauge) Incr

func (g *BoundGauge) Incr()

Incr increments g.

func (*BoundGauge) SetGetValueFn

func (g *BoundGauge) SetGetValueFn(fn func(val *atomic.Float64))

SetGetValueFn sets get value callback, when Get/gather invokes this callback for getting new value.

func (*BoundGauge) Sub

func (g *BoundGauge) Sub(v float64)

Sub subs v to g.

func (*BoundGauge) Update

func (g *BoundGauge) Update(v float64)

Update updates gauge with a new value

type BoundHistogram

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

BoundHistogram is a histogram which has been Bound to a certain metric with field-name and metrics, used for non-negative values

a default created bucket will be automatically created, however, you can also specify your own buckets. Prometheus Histogram's buckets are cumulative where values in each buckets is cumulative,

func NewHistogram

func NewHistogram() *BoundHistogram

func (*BoundHistogram) Update

func (h *BoundHistogram) Update(f func())

func (*BoundHistogram) UpdateDuration

func (h *BoundHistogram) UpdateDuration(d time.Duration)

func (*BoundHistogram) UpdateMilliseconds

func (h *BoundHistogram) UpdateMilliseconds(s float64)

func (*BoundHistogram) UpdateSeconds

func (h *BoundHistogram) UpdateSeconds(s float64)

func (*BoundHistogram) UpdateSince

func (h *BoundHistogram) UpdateSince(start time.Time)

func (*BoundHistogram) WithExponentBuckets

func (h *BoundHistogram) WithExponentBuckets(lower, upper time.Duration, count int) *BoundHistogram

func (*BoundHistogram) WithLinearBuckets

func (h *BoundHistogram) WithLinearBuckets(lower, upper time.Duration, count int) *BoundHistogram

type BoundMax

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

func (*BoundMax) Get

func (m *BoundMax) Get() float64

Get returns the current max value

func (*BoundMax) Update

func (m *BoundMax) Update(newValue float64)

Update updates Max with a new value Skip updating when newValue is smaller than v

type BoundMin

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

func (*BoundMin) Get

func (m *BoundMin) Get() float64

Get returns the current Min value

func (*BoundMin) Update

func (m *BoundMin) Update(newValue float64)

Update updates Min with a new value Skip updating when newValue is biger than v

type DeltaCounterVec

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

func NewCounterVec

func NewCounterVec(r *Registry, metricName, fieldName string, tags tag.Tags, tagKey ...string) *DeltaCounterVec

func (*DeltaCounterVec) WithTagValues

func (dcv *DeltaCounterVec) WithTagValues(tagValues ...string) *BoundCounter

type DeltaHistogramVec

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

func NewHistogramVec

func NewHistogramVec(r *Registry, metricName string, tags tag.Tags, tagKey ...string) *DeltaHistogramVec

func (*DeltaHistogramVec) WithExponentBuckets

func (hv *DeltaHistogramVec) WithExponentBuckets(lower, upper time.Duration, count int) *DeltaHistogramVec

func (*DeltaHistogramVec) WithLinearBuckets

func (hv *DeltaHistogramVec) WithLinearBuckets(lower, upper time.Duration, count int) *DeltaHistogramVec

func (*DeltaHistogramVec) WithTagValues

func (hv *DeltaHistogramVec) WithTagValues(tagValues ...string) *BoundHistogram

type Gather

type Gather interface {
	// Gather gathers and returns the gathered metrics
	Gather() ([]byte, int)
}

Gather gathers native lindb dto metrics

type GatherOption

type GatherOption interface {
	ApplyConfig(g *gather)
}

func WithGlobalKeyValueOption

func WithGlobalKeyValueOption(kvs tag.Tags) GatherOption

func WithNamespaceOption

func WithNamespaceOption(namespace string) GatherOption

func WithReadRuntimeOption

func WithReadRuntimeOption(observer Observer) GatherOption

type GaugeVec

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

func (*GaugeVec) WithTagValues

func (gv *GaugeVec) WithTagValues(tagValues ...string) *BoundGauge

type MaxVec

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

func (*MaxVec) WithTagValues

func (gv *MaxVec) WithTagValues(tagValues ...string) *BoundMax

type MinVec

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

func (*MinVec) WithTagValues

func (gv *MinVec) WithTagValues(tagValues ...string) *BoundMin

type Observer

type Observer interface {
	Observe()
}

type Registry

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

Registry is a set of metrics Metrics in this Registry will be exported to LinDB's native ingestion.

func (*Registry) FindMetricList

func (r *Registry) FindMetricList(names []string, includeTags map[string]string) map[string][]*models.StateMetric

FindMetricList returns metric list by given names/tags.

func (*Registry) NewGather

func (r *Registry) NewGather(options ...GatherOption) Gather

NewGather returns a gather to gather metrics from sdk and runtime.

func (*Registry) NewScope

func (r *Registry) NewScope(metricName string, tagList ...string) Scope

type Scope

type Scope interface {
	// Scope returns a child scope
	Scope(name string, tagList ...string) Scope
	// NewGauge returns a fast gauge which bounded to the scope
	NewGauge(fieldName string) *BoundGauge
	// NewCounter returns a fast counter which bounded to the scope
	NewCounter(fieldName string) *BoundCounter
	// NewMax returns a fast max which bounded to the scope
	NewMax(fieldName string) *BoundMax
	// NewMin returns a fast min which bounded to the scope
	NewMin(fieldName string) *BoundMin
	// NewHistogram returns a histogram which bounded to the scope
	NewHistogram() *BoundHistogram
	// NewHistogramVec initializes a vec by tagKeys
	NewHistogramVec(tagKey ...string) *DeltaHistogramVec
	// NewCounterVec initializes a vec by tagKeys and fieldName
	NewCounterVec(fieldName string, tagKey ...string) *DeltaCounterVec
	// NewGaugeVec initializes a vec by tagKeys and fieldName
	NewGaugeVec(fieldName string, tagKey ...string) *GaugeVec
	// NewMaxVec initializes a vec by tagKeys and fieldName
	NewMaxVec(fieldName string, tagKey ...string) *MaxVec
	// NewMinVec initializes a vec by tagKeys and fieldName
	NewMinVec(fieldName string, tagKey ...string) *MinVec
}

Scope is a namespace wrapper for linmetric. ensure that all emitted metric have a given prefix and tags. NewsScope("lindb").Scope("runtime").Scope("mem") make a point-concated metric-name: lindb.runtime.mem

Jump to

Keyboard shortcuts

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