baudtime

package
v0.0.0-...-927e444 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2018 The JIMDB Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const Instance = "instance"
View Source
const Name = "baudtime"

Variables

This section is empty.

Functions

func New

func New() monitoring.Monitor

func Range

func Range(f func(string, Metric) bool)

func Register

func Register(m Metric)

Types

type Collector

type Collector interface {
	CreateMetricIfMissing(lvs []string) (Metric, bool)
}

type Counter

type Counter struct {
	Meta
	metrics.Counter
}

func NewCounter

func NewCounter(metadata Meta) *Counter

func (*Counter) Inc

func (c *Counter) Inc()

func (*Counter) MetaC

func (c *Counter) MetaC() Meta

func (*Counter) Name

func (c *Counter) Name() string

func (*Counter) ToMetric

func (c *Counter) ToMetric() []*msg.Series

type CounterVec

type CounterVec struct {
	Collector
}

func NewCounterVec

func NewCounterVec(metadata Meta) *CounterVec

func (*CounterVec) Name

func (cv *CounterVec) Name() string

func (*CounterVec) ToMetric

func (cv *CounterVec) ToMetric() []*msg.Series

func (*CounterVec) WithLabelValues

func (cv *CounterVec) WithLabelValues(lvs ...string) *Counter

type Gauge

type Gauge struct {
	Meta
	// contains filtered or unexported fields
}

func NewGauge

func NewGauge(m Meta) *Gauge

func (*Gauge) Add

func (g *Gauge) Add(f float64)

func (*Gauge) Dec

func (g *Gauge) Dec()

func (*Gauge) Inc

func (g *Gauge) Inc()

func (*Gauge) MetaC

func (g *Gauge) MetaC() Meta

func (*Gauge) Name

func (g *Gauge) Name() string

func (*Gauge) Set

func (g *Gauge) Set(f float64)

func (*Gauge) Sub

func (g *Gauge) Sub(f float64)

func (*Gauge) ToMetric

func (g *Gauge) ToMetric() []*msg.Series

type GaugeVec

type GaugeVec struct {
	Collector
}

func NewGaugeVec

func NewGaugeVec(metadata Meta) *GaugeVec

func (*GaugeVec) Name

func (gv *GaugeVec) Name() string

func (*GaugeVec) ToMetric

func (gv *GaugeVec) ToMetric() []*msg.Series

func (*GaugeVec) WithLabelValues

func (gv *GaugeVec) WithLabelValues(lvs ...string) *Gauge

type Label

type Label struct {
	Name  string
	Value string
}

type MKey

type MKey struct {
	Namespace string
	Subsystem string
	Name      string
}

type Meta

type Meta struct {
	NameSpace   string
	SubSystem   string
	Name        string
	InnerLabels []Label
	Labels      []Label
}

func NewMeta

func NewMeta(nameSpace, subSystem, name string) *Meta

func NewMetaWithLabels

func NewMetaWithLabels(nameSpace, subSystem, name string, labels []string) *Meta

func (*Meta) AddLabel

func (m *Meta) AddLabel(name string)

func (*Meta) Clone

func (m *Meta) Clone() Meta

deep clone

func (*Meta) MetricLabels

func (m *Meta) MetricLabels() []msg.Label

func (*Meta) MetricName

func (m *Meta) MetricName() string

func (*Meta) SetLabel

func (m *Meta) SetLabel(l Label)

type Metric

type Metric interface {
	Name() string
	ToMetric() []*msg.Series
}

func GetMetric

func GetMetric(name string) (Metric, bool)

func GetMetricWithLvs

func GetMetricWithLvs(name string, lvs []string) (Metric, bool)

type MetricMap

type MetricMap struct {
	Meta
	// contains filtered or unexported fields
}

func (*MetricMap) CreateMetricIfMissing

func (mm *MetricMap) CreateMetricIfMissing(lvs []string) (Metric, bool)

func (*MetricMap) Name

func (mm *MetricMap) Name() string

func (*MetricMap) ToMetric

func (mm *MetricMap) ToMetric() []*msg.Series

func (*MetricMap) ValidLabels

func (mm *MetricMap) ValidLabels(lvs []string) bool

type Monitor

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

func (*Monitor) GetCluster

func (m *Monitor) GetCluster() string

func (*Monitor) GetCounter

func (m *Monitor) GetCounter(nameSpace, subSystem, name string, lvs ...string) monitoring.Counter

func (*Monitor) GetGauge

func (m *Monitor) GetGauge(nameSpace, subSystem, name string, lvs ...string) monitoring.Gauge

func (*Monitor) GetInstance

func (m *Monitor) GetInstance() string

func (*Monitor) GetPushGatewayUrl

func (m *Monitor) GetPushGatewayUrl() string

func (*Monitor) Init

func (m *Monitor) Init(cluster, instance string, pushGateway string, pushInterval time.Duration)

func (*Monitor) Push

func (m *Monitor) Push()

func (*Monitor) RegisterCounter

func (m *Monitor) RegisterCounter(nameSpace, subSystem, name string, labelNames []string)

register must call before Start()

func (*Monitor) RegisterGauge

func (m *Monitor) RegisterGauge(nameSpace, subSystem, name string, labelNames []string)

func (*Monitor) Start

func (m *Monitor) Start()

after start(), call register will panic

func (*Monitor) Stop

func (m *Monitor) Stop()

type Pusher

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

func NewPusher

func NewPusher(url string) *Pusher

func (*Pusher) Push

func (p *Pusher) Push() error

Jump to

Keyboard shortcuts

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