exporters

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Assiciated with the Status of the exporter
	ReadyStatus       = "ready"
	InitializedStatus = "initialized"
	RunningStatus     = "running"
	ClosedStatus      = "closed"
)
View Source
var (

	// TODO: Just hardcoded, move to config
	ExposedPort string = "9080"
	EndpointUrl string = "metrics"

	MetricLoopInterval time.Duration = 15 * time.Second
)
View Source
var (
	NewExporterCheckInterval = 2 * time.Minute
	ModuleName               = "EXPORTER"
)

Functions

This section is empty.

Types

type Exporter

type Exporter interface {
	Name() string
	Init()
	Run()
	Close()
	Status() string
	Details() string
}

Basic unit of metrics export

type ExporterService

type ExporterService struct {
	PrometheusRunner PrometheusRunner

	ExporterRoutines map[string]Exporter
	// contains filtered or unexported fields
}

func NewExporterService

func NewExporterService(ctx context.Context) *ExporterService

Creates and initialized the exporter service where any module can create a dedicated exporter

func (*ExporterService) AddNewExporter

func (s *ExporterService) AddNewExporter(exptr Exporter)

add new exporter to the list of exporters

func (*ExporterService) Close

func (s *ExporterService) Close()

Close all the running metrics exposers

func (*ExporterService) Run

func (s *ExporterService) Run()

type MetricsExporter

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

func NewMetricsExporter

func NewMetricsExporter(ctx context.Context,
	name string,
	details string,
	initf func(),
	runf func(),
	closef func(),
	interval time.Duration) (*MetricsExporter, error)

func (*MetricsExporter) Close

func (e *MetricsExporter) Close()

func (MetricsExporter) Details

func (e MetricsExporter) Details() string

func (*MetricsExporter) Init

func (e *MetricsExporter) Init()

func (MetricsExporter) Name

func (e MetricsExporter) Name() string

func (*MetricsExporter) Run

func (e *MetricsExporter) Run()

func (MetricsExporter) Status

func (e MetricsExporter) Status() string

type PrometheusRunner

type PrometheusRunner struct {
	ExposePort      string
	EndpointUrl     string
	RefreshInterval time.Duration
}

func NewPrometheusRunner

func NewPrometheusRunner() PrometheusRunner

func (*PrometheusRunner) Start

func (c *PrometheusRunner) Start() error

Jump to

Keyboard shortcuts

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