exporter

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package exporter provides the ability for one to instantiate a web server that on requests to it, provides prometheus metrics in the http response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

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

Exporter is responsible for bringing up a web server that collects metrics that have been globally registered via prometheus collectors (e.g., see `pkg/collector`).

func New

func New(opts ...Option) (*Exporter, error)

New instantiates a new exporter with defaults, unless options are passed.

func (*Exporter) Close

func (e *Exporter) Close() (err error)

Close gracefully closes the tcp listener associated with it.

func (*Exporter) Run

func (e *Exporter) Run(ctx context.Context) error

Run initiates the HTTP server to serve the metrics.

ps.: this is a BLOCKING method - make sure you either make use of goroutines to not block if needed.

type Option

type Option func(e *Exporter)

Option allows overriding the exporter's defaults

func WithBindAddress

func WithBindAddress(v string) Option

WithBindAddress overrides the default address at which the prometheus metrics HTTP server would bind to.

Examples:

  • :8080
  • 127.0.0.2:1313

func WithTelemetryPath

func WithTelemetryPath(v string) Option

WithTelemetryPath overrides the default path under which the prometheus metrics are reported.

For instance:

  • /
  • /metrics
  • /telemetry

Jump to

Keyboard shortcuts

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