service

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package server hosts the daemon's gRPC + REST API on a single TLS port (ALPN-dispatch like the broker) and its own /metrics surface on a separate TLS port.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	APIPort     int
	MetricsPort int
	Cert        *tls.Certificate
	Service     pb.DaemonServiceServer
	Registry    *prometheus.Registry
	Logger      *zap.SugaredLogger
}

Config carries the inputs needed to build the daemon's servers.

type Querier

type Querier interface {
	GetMetrics(name string, lookbackSeconds int64) (*rater.WindowedResult, error)
}

Querier is the subset of *rater.Rater that the service needs. It exists so unit tests can stub responses without spinning up a real rater.

type Servers

type Servers struct {
	APIServer     *http.Server
	MetricsServer *http.Server
	// contains filtered or unexported fields
}

Servers bundles the two HTTP servers the daemon runs so callers can shut both down together.

func New

func New(ctx context.Context, cfg Config) (*Servers, error)

New constructs the daemon's two servers but does not start them. Callers invoke ListenAndServeTLS on each, typically in goroutines.

func (*Servers) GracefulStop

func (s *Servers) GracefulStop(ctx context.Context)

GracefulStop stops the gRPC server cleanly and shuts down both HTTP servers within the deadline implied by ctx.

type Service

type Service struct {
	pb.UnimplementedDaemonServiceServer
	// contains filtered or unexported fields
}

Service implements pb.DaemonServiceServer over a Querier.

func NewService

func NewService(q Querier) *Service

func (*Service) GetAgentDeployMetrics

GetAgentDeployMetrics translates a Querier result into the protobuf response shape:

  • NotFound when the AgentDeploy is unknown.
  • Unavailable when no samples have accumulated yet.
  • OK with a populated AgentDeployMetrics otherwise. Empty per- window maps inside the response mean "data exists but we couldn't compute that specific window."

Jump to

Keyboard shortcuts

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