metrics

package
v0.0.0-...-5b77a83 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GAUGE metricType = iota
	COUNTER
	HISTOGRAM
	SUMMARY
)

Variables

This section is empty.

Functions

func ConvertLabelsToMap

func ConvertLabelsToMap(labels []prompb.Label) map[string]string

func ConvertNumeric

func ConvertNumeric(val interface{}) float64

func ExtractLabelsFromSpan

func ExtractLabelsFromSpan(span *types.Span, labelToKeyMap map[string][]string) map[string]string

Types

type Metrics

type Metrics interface {
	// Register declares a metric; metricType should be one of counter, gauge, histogram
	Register(name, metricType string)
	Increment(name string)
	Gauge(name string, val interface{})
	Count(name string, n interface{})
	Histogram(name string, obs interface{})
	RegisterWithDescriptionLabels(name, metricType, desc string, labels []string)
	RegisterGauge(name string, labels []string, desc string)
	RegisterCounter(name string, labels []string, desc string)
	RegisterHistogram(name string, labels []string, desc string, buckets []float64)

	GaugeWithLabels(name string, labels map[string]string, value float64)
	IncrementWithLabels(name string, labels map[string]string)
	AddWithLabels(name string, labels map[string]string, value float64)
	HistogramWithLabels(name string, labels map[string]string, obs interface{})
}

func GetMetricsImplementation

func GetMetricsImplementation(prefix string) Metrics

type MockMetrics

type MockMetrics struct {
	Registrations     map[string]string
	CounterIncrements map[string]int
	GaugeRecords      map[string]float64
	Histograms        map[string][]float64
	// contains filtered or unexported fields
}

MockMetrics collects metrics that were registered and changed to allow tests to verify expected behavior

func (*MockMetrics) AddWithLabels

func (m *MockMetrics) AddWithLabels(name string, labels map[string]string, value float64)

func (*MockMetrics) Count

func (m *MockMetrics) Count(name string, val interface{})

func (*MockMetrics) Gauge

func (m *MockMetrics) Gauge(name string, val interface{})

func (*MockMetrics) GaugeWithLabels

func (m *MockMetrics) GaugeWithLabels(name string, labels map[string]string, value float64)

func (*MockMetrics) Histogram

func (m *MockMetrics) Histogram(name string, val interface{})

func (*MockMetrics) HistogramWithLabels

func (m *MockMetrics) HistogramWithLabels(name string, labels map[string]string, obs interface{})

func (*MockMetrics) Increment

func (m *MockMetrics) Increment(name string)

func (*MockMetrics) IncrementWithLabels

func (m *MockMetrics) IncrementWithLabels(name string, labels map[string]string)

func (*MockMetrics) Register

func (m *MockMetrics) Register(name, metricType string)

func (*MockMetrics) RegisterCounter

func (m *MockMetrics) RegisterCounter(name string, labels []string, desc string)

func (*MockMetrics) RegisterGauge

func (m *MockMetrics) RegisterGauge(name string, labels []string, desc string)

func (*MockMetrics) RegisterHistogram

func (m *MockMetrics) RegisterHistogram(name string, labels []string, desc string, buckets []float64)

func (*MockMetrics) RegisterWithDescriptionLabels

func (m *MockMetrics) RegisterWithDescriptionLabels(name, metricType, desc string, labels []string)

func (*MockMetrics) Start

func (m *MockMetrics) Start()

Start initializes all metrics or resets all metrics to zero

type NullMetrics

type NullMetrics struct{}

NullMetrics discards all metrics

func (*NullMetrics) AddWithLabels

func (n *NullMetrics) AddWithLabels(name string, labels map[string]string, value float64)

func (*NullMetrics) Count

func (n *NullMetrics) Count(name string, val interface{})

func (*NullMetrics) Gauge

func (n *NullMetrics) Gauge(name string, val interface{})

func (*NullMetrics) GaugeWithLabels

func (n *NullMetrics) GaugeWithLabels(name string, labels map[string]string, value float64)

func (*NullMetrics) Histogram

func (n *NullMetrics) Histogram(name string, obs interface{})

func (*NullMetrics) HistogramWithLabels

func (n *NullMetrics) HistogramWithLabels(name string, labels map[string]string, obs interface{})

func (*NullMetrics) Increment

func (n *NullMetrics) Increment(name string)

func (*NullMetrics) IncrementWithLabels

func (n *NullMetrics) IncrementWithLabels(name string, labels map[string]string)

func (*NullMetrics) Register

func (n *NullMetrics) Register(name, metricType string)

func (*NullMetrics) RegisterCounter

func (n *NullMetrics) RegisterCounter(name string, labels []string, desc string)

func (*NullMetrics) RegisterGauge

func (n *NullMetrics) RegisterGauge(name string, labels []string, desc string)

func (*NullMetrics) RegisterHistogram

func (n *NullMetrics) RegisterHistogram(name string, labels []string, desc string, buckets []float64)

func (*NullMetrics) RegisterWithDescriptionLabels

func (n *NullMetrics) RegisterWithDescriptionLabels(name, metricType, desc string, labels []string)

func (*NullMetrics) Start

func (n *NullMetrics) Start()

Start initializes all metrics or resets all metrics to zero

type OpsRampAuthTokenResponse

type OpsRampAuthTokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
	Scope       string `json:"scope"`
}

type OpsRampMetrics

type OpsRampMetrics struct {
	Config config.Config `inject:""`
	Logger logger.Logger `inject:""`

	Client *http.Client
	Proxy  *proxy.Proxy `inject:"proxyConfig"`
	// contains filtered or unexported fields
}

func (*OpsRampMetrics) AddWithLabels

func (p *OpsRampMetrics) AddWithLabels(name string, labels map[string]string, value float64)

func (*OpsRampMetrics) Count

func (p *OpsRampMetrics) Count(name string, n interface{})

func (*OpsRampMetrics) Gauge

func (p *OpsRampMetrics) Gauge(name string, val interface{})

func (*OpsRampMetrics) GaugeWithLabels

func (p *OpsRampMetrics) GaugeWithLabels(name string, labels map[string]string, value float64)

func (*OpsRampMetrics) Histogram

func (p *OpsRampMetrics) Histogram(name string, obs interface{})

func (*OpsRampMetrics) HistogramWithLabels

func (p *OpsRampMetrics) HistogramWithLabels(name string, labels map[string]string, obs interface{})

func (*OpsRampMetrics) Increment

func (p *OpsRampMetrics) Increment(name string)

func (*OpsRampMetrics) IncrementWithLabels

func (p *OpsRampMetrics) IncrementWithLabels(name string, labels map[string]string)

func (*OpsRampMetrics) Populate

func (p *OpsRampMetrics) Populate()

func (*OpsRampMetrics) Push

func (p *OpsRampMetrics) Push() (int, error)

func (*OpsRampMetrics) Register

func (p *OpsRampMetrics) Register(name, metricType string)

Register takes a name and a metric type. The type should be one of "counter", "gauge", or "histogram"

func (*OpsRampMetrics) RegisterCounter

func (p *OpsRampMetrics) RegisterCounter(name string, labels []string, desc string)

func (*OpsRampMetrics) RegisterGauge

func (p *OpsRampMetrics) RegisterGauge(name string, labels []string, desc string)

func (*OpsRampMetrics) RegisterHistogram

func (p *OpsRampMetrics) RegisterHistogram(name string, labels []string, desc string, buckets []float64)

func (*OpsRampMetrics) RegisterWithDescriptionLabels

func (p *OpsRampMetrics) RegisterWithDescriptionLabels(name, metricType, desc string, labels []string)

RegisterWithDescriptionLabels takes a name, a metric type, description, labels. The type should be one of "counter", "gauge", or "histogram"

func (*OpsRampMetrics) RenewClient

func (p *OpsRampMetrics) RenewClient()

func (*OpsRampMetrics) RenewOAuthToken

func (p *OpsRampMetrics) RenewOAuthToken() error

func (*OpsRampMetrics) Send

func (p *OpsRampMetrics) Send(request *http.Request) (*http.Response, error)

func (*OpsRampMetrics) Start

func (p *OpsRampMetrics) Start() error

Jump to

Keyboard shortcuts

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