Help us shape the future of Go! Take the 2026 Go Developer Survey

prometheusserver

package
v0.0.59 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 25 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
	TargetManager targetruntimeview.TargetManager
}

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, rt runtimeview.TargetRuntimeView, 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) MetricName added in v0.0.54

func (r *PrometheusServer) MetricName(name, valueName string) string

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