eagle

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 7 Imported by: 4

README

eagle

Package eagle provides a functionality to export Prometheus metrics aggregated over configured time interval. This can be useful when you want to use Prometheus library to instrument your code but still want to periodically export metrics to non Prometheus monitoring systems.

At moment only Counters, Gauges and Summaries are supported.

Godoc

Documentation

Overview

Package eagle provides a functionality to export Prometheus metrics aggregated over configured time interval. This can be useful when you want to use Prometheus library to instrument your code but still want to periodically export metrics to non Prometheus monitoring systems.

Index

Constants

View Source
const (
	MetricTypeCounter = "counter"
	MetricTypeGauge   = "gauge"
	MetricTypeSummary = "summary"
)

Various metric types eagle supports.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Gatherer    prometheus.Gatherer
	Interval    time.Duration
	Sink        chan<- Metrics
	QuantileSep string
}

Config of Eagle instance.

type Eagle

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

Eagle allows to periodically export Prometheus metrics aggregated over configured time interval.

func New

func New(c Config) *Eagle

New creates new Eagle.

func (*Eagle) Close

func (e *Eagle) Close() error

Close closes Eagle.

func (*Eagle) Export

func (e *Eagle) Export() (Metrics, error)

Export actual Metrics once.

type Metric

type Metric struct {
	Type      MetricType    `json:"type"`
	Namespace string        `json:"namespace"`
	Subsystem string        `json:"subsystem"`
	Name      string        `json:"name"`
	Help      string        `json:"help,omitempty"`
	Values    []MetricValue `json:"values,omitempty"`
}

Metric is a single Prometheus metric that can have many MetricValue.

type MetricType

type MetricType string

MetricType is a type for different supported metric types.

type MetricValue

type MetricValue struct {
	Name   string   `json:"name"`
	Labels []string `json:"labels,omitempty"`
	Value  float64  `json:"value"`
}

MetricValue is a concrete value of certain metric.

type Metrics

type Metrics struct {
	Items []Metric `json:"items,omitempty"`
}

Metrics represent collection of aggregated Prometheus metrics.

func (Metrics) Flatten

func (m Metrics) Flatten(sep string) map[string]float64

Flatten is a helper method to flatten metrics into map[string]float64.

Jump to

Keyboard shortcuts

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