server

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package server provides HTTP server functionality for exposing Prometheus metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ListenAddr        string
	ReadHeaderTimeout time.Duration
	ShutdownTimeout   time.Duration
}

Config holds configuration for the Prometheus metrics server.

type Server

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

Server represents a Prometheus metrics HTTP server.

func NewServer

func NewServer(config Config) (*Server, error)

NewServer creates a new Prometheus metrics server with the given configuration.

func (*Server) GetListenAddr

func (s *Server) GetListenAddr() string

GetListenAddr returns the configured listen address.

func (*Server) IsStarted

func (s *Server) IsStarted() bool

IsStarted returns true if the server has been started.

func (*Server) Start

func (s *Server) Start(registry *prometheus.Registry, datasourceCollector *exporter.DatasourceCollector) (<-chan error, error)

Start starts the Prometheus metrics server with the provided registry. It registers the DatasourceCollector and starts serving metrics on the configured address.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop gracefully stops the Prometheus metrics server. It waits for ongoing requests to complete within the configured shutdown timeout.

Jump to

Keyboard shortcuts

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