expvarom

package
v0.0.0-...-720f34a Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package expvarom implements an OpenMetrics HTTP exporter for the variables from the expvar package.

This is useful for small servers that want to support both packages with simple enough variables, without introducing any dependencies beyond the standard library.

Some functions to add descriptions and map labels are exported for convenience, but their usage is optional.

For more complex usage (like histograms, counters vs. gauges, etc.), use the OpenMetrics libraries directly.

The exporter uses the text-based format, as documented in: https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format https://github.com/OpenObservability/OpenMetrics/blob/master/specification/OpenMetrics.md

Note the adoption of that format as OpenMetrics' one isn't finalized yet, and it is possible that it will change in the future.

Backwards compatibility is NOT guaranteed, until the format is fully standarized.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetricsHandler

func MetricsHandler(w http.ResponseWriter, r *http.Request)

MetricsHandler implements an http.HandlerFunc which serves the registered metrics, using the OpenMetrics text-based format.

func NewFloat

func NewFloat(name, desc string) *expvar.Float

NewFloat registers a new expvar.Float variable, with the given description.

func NewInt

func NewInt(name, desc string) *expvar.Int

NewInt registers a new expvar.Int variable, with the given description.

func NewMap

func NewMap(name, labelName, desc string) *expvar.Map

NewMap registers a new expvar.Map variable, with the given label name and description.

Types

This section is empty.

Jump to

Keyboard shortcuts

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