prometheus

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyPrefix       = "cassini_"
	KeyQueueSize    = "queue_size"
	KeyQueue        = "queue"
	KeyAdaptors     = "adaptors"
	KeyTxsWait      = "txs_wait"
	KeyTxCost       = "tx_cost"
	KeyTxsPerSecond = "txs_per_second"
	KeyErrors       = "errors"
)

nolint

View Source
const (
	// KeyMetricType config key
	KeyMetricType = "metricType"
)

Variables

This section is empty.

Functions

func Collector

func Collector(errChannel chan<- error) prometheus.Collector

Collector returns a collector which exports metrics about status code of network service response

func Set

func Set(key string, value float64,
	labelValues ...string)

Set the value to the collector mapper

func StartMetrics

func StartMetrics(errChannel chan<- error)

StartMetrics prometheus exporter("/metrics") service

Types

type CounterMetric

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

CounterMetric stores a counter value

func (*CounterMetric) GetLabelValues

func (m *CounterMetric) GetLabelValues() []string

GetLabelValues returns label values

func (*CounterMetric) GetValue

func (m *CounterMetric) GetValue() float64

GetValue returns value

func (*CounterMetric) GetValueType

func (m *CounterMetric) GetValueType() prometheus.ValueType

GetValueType returns value type

func (*CounterMetric) SetLabelValues

func (m *CounterMetric) SetLabelValues(values []string)

SetLabelValues sets label values

func (*CounterMetric) SetValue

func (m *CounterMetric) SetValue(v float64)

SetValue sets value

func (*CounterMetric) SetValueType

func (m *CounterMetric) SetValueType(prometheus.ValueType)

SetValueType sets nothing

type ExportMetric

type ExportMetric interface {
	GetValue() float64
	SetValue(float64)
	GetValueType() prometheus.ValueType
	SetValueType(prometheus.ValueType)
	GetLabelValues() []string
	SetLabelValues([]string)
}

ExportMetric defined an interface about prometheus exporter metric

type GaugeMetric

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

GaugeMetric wraps prometheus export data

func (*GaugeMetric) GetLabelValues

func (m *GaugeMetric) GetLabelValues() []string

GetLabelValues returns label values

func (*GaugeMetric) GetValue

func (m *GaugeMetric) GetValue() float64

GetValue returns value

func (*GaugeMetric) GetValueType

func (m *GaugeMetric) GetValueType() prometheus.ValueType

GetValueType returns value type

func (*GaugeMetric) SetLabelValues

func (m *GaugeMetric) SetLabelValues(values []string)

SetLabelValues sets label values

func (*GaugeMetric) SetValue

func (m *GaugeMetric) SetValue(v float64)

SetValue sets value

func (*GaugeMetric) SetValueType

func (m *GaugeMetric) SetValueType(prometheus.ValueType)

SetValueType sets nothing

type ImmutableGaugeMetric

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

ImmutableGaugeMetric stores an immutable value

func (*ImmutableGaugeMetric) GetLabelValues

func (m *ImmutableGaugeMetric) GetLabelValues() []string

GetLabelValues returns label values

func (*ImmutableGaugeMetric) GetValue

func (m *ImmutableGaugeMetric) GetValue() float64

GetValue returns value

func (*ImmutableGaugeMetric) GetValueType

func (m *ImmutableGaugeMetric) GetValueType() prometheus.ValueType

GetValueType returns value type

func (*ImmutableGaugeMetric) SetLabelValues

func (m *ImmutableGaugeMetric) SetLabelValues(values []string)

SetLabelValues sets label values

func (*ImmutableGaugeMetric) SetValue

func (m *ImmutableGaugeMetric) SetValue(v float64)

SetValue sets value

func (*ImmutableGaugeMetric) SetValueType

func (m *ImmutableGaugeMetric) SetValueType(prometheus.ValueType)

SetValueType sets nothing

type MetricConfig

type MetricConfig struct {
	Key  string
	Type string
}

MetricConfig defined config about metric type

type TickerGaugeMetric

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

TickerGaugeMetric wraps prometheus export data with ticker job

func (*TickerGaugeMetric) GetLabelValues

func (m *TickerGaugeMetric) GetLabelValues() []string

GetLabelValues returns label values

func (*TickerGaugeMetric) GetValue

func (m *TickerGaugeMetric) GetValue() float64

GetValue returns value

func (*TickerGaugeMetric) GetValueType

func (m *TickerGaugeMetric) GetValueType() prometheus.ValueType

GetValueType returns value type

func (*TickerGaugeMetric) Init

func (m *TickerGaugeMetric) Init()

Init starts ticker goroutine

func (*TickerGaugeMetric) SetLabelValues

func (m *TickerGaugeMetric) SetLabelValues(values []string)

SetLabelValues sets label values

func (*TickerGaugeMetric) SetValue

func (m *TickerGaugeMetric) SetValue(v float64)

SetValue sets value

func (*TickerGaugeMetric) SetValueType

func (m *TickerGaugeMetric) SetValueType(prometheus.ValueType)

SetValueType sets nothing

Jump to

Keyboard shortcuts

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