promexp

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 6 Imported by: 1

README

PromExp

A lightweight implementation of metrics exporter for Prometheus. It does not have all the features and functions, but it is intended as a very lightweight and fast replacement. The og library becomes very slow with a high number of metrics which limits how frequently it can be scraped.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultExpiration is a time that it takes metric without any updates to expire and be removed from exporter
	DefaultExpiration = time.Duration(5) * time.Minute
	// DefaultInterval is time interval between expiration evaluations
	DefaultInterval = time.Duration(1) * time.Minute
)

Functions

This section is empty.

Types

type Exporter

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

Exporter is an abstraction for exporter it does not actually implement any of HTTP functions, but it does group the metrics, handles their expiration and renders them into a text. Should be instantiated using NewExporter() method.

func NewExporter

func NewExporter() *Exporter

NewExporter creates an instance of Exporter

func (*Exporter) Render

func (e *Exporter) Render() string

Render renders all active metrics into a text output that can be then plugged into HTTP handler.

func (*Exporter) SetCounter

func (e *Exporter) SetCounter(name string, value float64, help string, labels map[string]string)

SetCounter creates new or updates existing counter metric, the timestamp is considered that when the metric is being set using this method

func (*Exporter) SetGauge

func (e *Exporter) SetGauge(name string, value float64, help string, labels map[string]string)

SetGauge creates new or updates existing gauge metric, the timestamp is considered that when the metric is being set using this method

func (*Exporter) SetHistogram

func (e *Exporter) SetHistogram(name string, value float64, help string, labels map[string]string)

SetHistogram creates new or updates existing histogram metric, the timestamp is considered that when the metric is being set using this method

func (*Exporter) SetSummary

func (e *Exporter) SetSummary(name string, value float64, help string, labels map[string]string)

SetSummary creates new or updates existing summary metric, the timestamp is considered that when the metric is being set using this method

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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