server

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 9 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 CollectionProvider added in v0.11.0

type CollectionProvider interface {
	MarshalCollections() ([]byte, error)
}

CollectionProvider exposes collected crash artifact data.

type Config

type Config struct {
	ListenAddr          string
	DiagnosisListenAddr 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) GetDiagnosisListenAddr added in v0.11.0

func (s *Server) GetDiagnosisListenAddr() string

GetDiagnosisListenAddr returns the configured diagnosis endpoint listen address.

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,
	collectionProvider CollectionProvider,
) (<-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