metrics

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package metrics provides Config struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Transform map[string]interface{}
	Metrics   []map[string]interface{}
}

Config contains metrics and transform definitions.

type Counter

type Counter struct {
	Name     string
	ValueKey string
	Labels   []string
	Metric   *prometheus.CounterVec
}

Counter contains prometheus.CounterVec.

type Histogram

type Histogram struct {
	Name     string
	ValueKey string
	Labels   []string
	Metric   *prometheus.HistogramVec
}

Histogram contains prometheus.HistogramVec.

type Kind

type Kind int

Kind is a type of metrics.

const (
	// COUNTER is metrics.Counter.
	COUNTER Kind = iota
	// HISTOGRAM is metrics.Histogram
	HISTOGRAM
)

func (Kind) String

func (k Kind) String() string

type Store

type Store struct {
	RecordTransformer map[string]func(string) string
	ValueTransformer  map[string]func(float64) float64
	Counter           []*Counter
	Histogram         []*Histogram
}

Store is contains record and value transformer and metrics (Counter, Histogram).

func NewStore

func NewStore() *Store

NewStore creates a new Store.

func (*Store) Add

func (store *Store) Add(
	Kind Kind,
	ValueKey string,
	Name string,
	Help string,
	Buckets []float64,
	Labels []string,
)

Add specified metric to store

func (*Store) Load

func (store *Store) Load(conf string)

Load loads from metrics config file.

func (*Store) Process

func (store *Store) Process(record map[string]string)

Process record.

Jump to

Keyboard shortcuts

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