metrics

package
v0.0.0-...-a2ebef2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterClientMetrics

func RegisterClientMetrics(r prometheus.Registerer)

RegisterClientMetrics sets up the client latency and result metrics from client-go.

Types

type CounterMetric

type CounterMetric interface {
	Add(v float64, labels map[string]string)
	Inc(labels map[string]string)
	Delete(labels map[string]string)
	DeletePartialMatch(labels map[string]string)
	Reset()
}

func NewEMFCounter

func NewEMFCounter(writer io.Writer, namespace, name string, dimensions [][]string, additionalProperties ...map[string]string) CounterMetric

func NewMultiCounter

func NewMultiCounter(counters ...CounterMetric) CounterMetric

func NewPrometheusCounter

func NewPrometheusCounter(registry prometheus.Registerer, opts prometheus.CounterOpts, labelNames []string) CounterMetric

type EMF

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

func NewEMF

func NewEMF(writer io.Writer, namespace, name string, dimensions [][]string, additionalProperties ...map[string]string) *EMF

func (*EMF) Reset

func (e *EMF) Reset()

type EMFCounter

type EMFCounter struct {
	*EMF
}

func (*EMFCounter) Add

func (e *EMFCounter) Add(v float64, labels map[string]string)

func (*EMFCounter) Delete

func (e *EMFCounter) Delete(_ map[string]string)

func (*EMFCounter) DeletePartialMatch

func (e *EMFCounter) DeletePartialMatch(_ map[string]string)

func (*EMFCounter) Inc

func (e *EMFCounter) Inc(labels map[string]string)

type EMFGauge

type EMFGauge struct {
	*EMF
}

func (*EMFGauge) Delete

func (e *EMFGauge) Delete(_ map[string]string)

func (*EMFGauge) DeletePartialMatch

func (e *EMFGauge) DeletePartialMatch(_ map[string]string)

func (*EMFGauge) Reset

func (e *EMFGauge) Reset()

func (*EMFGauge) Set

func (e *EMFGauge) Set(v float64, labels map[string]string)

type EMFObservation

type EMFObservation struct {
	*EMF
}

func (*EMFObservation) Delete

func (e *EMFObservation) Delete(_ map[string]string)

func (*EMFObservation) DeletePartialMatch

func (e *EMFObservation) DeletePartialMatch(_ map[string]string)

func (*EMFObservation) Observe

func (e *EMFObservation) Observe(v float64, labels map[string]string)

func (*EMFObservation) Reset

func (e *EMFObservation) Reset()

type Entry

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

Entry represents a log entry in the EMF format.

func NewEntry

func NewEntry(namespace string) Entry

NewEntry creates a new Entry with the specified namespace and serializer.

func (*Entry) AddDimensions

func (e *Entry) AddDimensions(dimensions ...[]string)

AddDimensions adds a CW Dimension to the EMF entry.

func (*Entry) AddMetric

func (e *Entry) AddMetric(key string, value float64)

AddMetric adds a CW Metric to the EMF entry.

func (*Entry) AddProperty

func (e *Entry) AddProperty(key string, value interface{})

AddProperty adds a CW Property to the EMF entry. Properties are not published as metrics, but they are available in logs and in CW insights.

func (*Entry) Build

func (e *Entry) Build() (string, error)

Build constructs the EMF log entry as a JSON string.

type GaugeMetric

type GaugeMetric interface {
	Set(v float64, labels map[string]string)
	Delete(labels map[string]string)
	DeletePartialMatch(labels map[string]string)
	Reset()
}

func NewEMFGauge

func NewEMFGauge(writer io.Writer, namespace, name string, dimensions [][]string, additionalProperties ...map[string]string) GaugeMetric

func NewMultiGauge

func NewMultiGauge(gauges ...GaugeMetric) GaugeMetric

func NewPrometheusGauge

func NewPrometheusGauge(registry prometheus.Registerer, opts prometheus.GaugeOpts, labelNames []string) GaugeMetric

type LatencyAdapter

type LatencyAdapter struct {
	Metric ObservationMetric
}

LatencyAdapter implements LatencyMetric.

func (*LatencyAdapter) Observe

func (l *LatencyAdapter) Observe(_ context.Context, verb string, u url.URL, latency time.Duration)

Observe increments the request latency metric for the given verb/group/version/kind/subresource.

type MultiCounter

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

func (*MultiCounter) Add

func (mc *MultiCounter) Add(v float64, labels map[string]string)

func (*MultiCounter) Delete

func (mc *MultiCounter) Delete(labels map[string]string)

func (*MultiCounter) DeletePartialMatch

func (mc *MultiCounter) DeletePartialMatch(labels map[string]string)

func (*MultiCounter) Inc

func (mc *MultiCounter) Inc(labels map[string]string)

func (*MultiCounter) Reset

func (mc *MultiCounter) Reset()

type MultiGauge

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

func (*MultiGauge) Delete

func (mg *MultiGauge) Delete(labels map[string]string)

func (*MultiGauge) DeletePartialMatch

func (mg *MultiGauge) DeletePartialMatch(labels map[string]string)

func (*MultiGauge) Reset

func (mg *MultiGauge) Reset()

func (*MultiGauge) Set

func (mg *MultiGauge) Set(v float64, labels map[string]string)

type MultiObservation

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

func (*MultiObservation) Delete

func (mo *MultiObservation) Delete(labels map[string]string)

func (*MultiObservation) DeletePartialMatch

func (mo *MultiObservation) DeletePartialMatch(labels map[string]string)

func (*MultiObservation) Observe

func (mo *MultiObservation) Observe(v float64, labels map[string]string)

func (*MultiObservation) Reset

func (mo *MultiObservation) Reset()

type ObservationMetric

type ObservationMetric interface {
	Observe(v float64, labels map[string]string)
	Delete(labels map[string]string)
	DeletePartialMatch(labels map[string]string)
	Reset()
}

func NewEMFObservation

func NewEMFObservation(writer io.Writer, namespace, name string, dimensions [][]string, additionalProperties ...map[string]string) ObservationMetric

func NewMultiObservation

func NewMultiObservation(observations ...ObservationMetric) ObservationMetric

func NewPrometheusHistogram

func NewPrometheusHistogram(registry prometheus.Registerer, opts prometheus.HistogramOpts, labelNames []string) ObservationMetric

func NewPrometheusSummary

func NewPrometheusSummary(registry prometheus.Registerer, opts prometheus.SummaryOpts, labelNames []string) ObservationMetric

type PrometheusCounter

type PrometheusCounter struct {
	*prometheus.CounterVec
}

func (*PrometheusCounter) Add

func (pc *PrometheusCounter) Add(v float64, labels map[string]string)

func (*PrometheusCounter) Delete

func (pc *PrometheusCounter) Delete(labels map[string]string)

func (*PrometheusCounter) DeletePartialMatch

func (pc *PrometheusCounter) DeletePartialMatch(labels map[string]string)

func (*PrometheusCounter) Inc

func (pc *PrometheusCounter) Inc(labels map[string]string)

func (*PrometheusCounter) Reset

func (pc *PrometheusCounter) Reset()

type PrometheusGauge

type PrometheusGauge struct {
	*prometheus.GaugeVec
}

func (*PrometheusGauge) Delete

func (pg *PrometheusGauge) Delete(labels map[string]string)

func (*PrometheusGauge) DeletePartialMatch

func (pg *PrometheusGauge) DeletePartialMatch(labels map[string]string)

func (*PrometheusGauge) Reset

func (pg *PrometheusGauge) Reset()

func (*PrometheusGauge) Set

func (pg *PrometheusGauge) Set(v float64, labels map[string]string)

type PrometheusHistogram

type PrometheusHistogram struct {
	*prometheus.HistogramVec
}

func (*PrometheusHistogram) Delete

func (ph *PrometheusHistogram) Delete(labels map[string]string)

func (*PrometheusHistogram) DeletePartialMatch

func (ph *PrometheusHistogram) DeletePartialMatch(labels map[string]string)

func (*PrometheusHistogram) Observe

func (ph *PrometheusHistogram) Observe(v float64, labels map[string]string)

func (*PrometheusHistogram) Reset

func (ph *PrometheusHistogram) Reset()

type PrometheusSummary

type PrometheusSummary struct {
	*prometheus.SummaryVec
}

func (*PrometheusSummary) Delete

func (ps *PrometheusSummary) Delete(labels map[string]string)

func (*PrometheusSummary) DeletePartialMatch

func (ps *PrometheusSummary) DeletePartialMatch(labels map[string]string)

func (*PrometheusSummary) Observe

func (ps *PrometheusSummary) Observe(v float64, labels map[string]string)

func (*PrometheusSummary) Reset

func (ps *PrometheusSummary) Reset()

type ResultAdapter

type ResultAdapter struct {
	Metric CounterMetric
}

func (*ResultAdapter) Increment

func (r *ResultAdapter) Increment(_ context.Context, code, method, _ string)

Jump to

Keyboard shortcuts

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