prometheusserver

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetricNameRegex = regexp.MustCompile(metricNameRegex)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Address     string
	TargetStore storebackend.Storer[*target.Context]
}

type PromMetric

type PromMetric struct {
	Name string
	Time *time.Time
	// AddedAt is used to expire metrics if the time field is not initialized
	// this happens when ExportTimestamp == false
	AddedAt time.Time
	// contains filtered or unexported fields
}

func NewPromMetric

func NewPromMetric(subName string, tctx *target.Context, update *gnmi.Update) (*PromMetric, error)

TODO get user input

func (*PromMetric) CalculateKey

func (p *PromMetric) CalculateKey() uint64

Metric

func (*PromMetric) Desc

func (p *PromMetric) Desc() *prometheus.Desc

Desc implements prometheus.Metric

func (*PromMetric) String

func (p *PromMetric) String() string

func (*PromMetric) Write

func (p *PromMetric) Write(out *dto.Metric) error

Write implements prometheus.Metric

type PrometheusServer

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

func NewServer

func NewServer(c *Config) *PrometheusServer

func (*PrometheusServer) Collect

func (r *PrometheusServer) Collect(ch chan<- prometheus.Metric)

func (*PrometheusServer) Describe

func (r *PrometheusServer) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*PrometheusServer) Start

func (r *PrometheusServer) Start(ctx context.Context) error

func (*PrometheusServer) Stop

func (r *PrometheusServer) Stop()

Jump to

Keyboard shortcuts

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