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 ¶
New constructs the daemon's two servers but does not start them. Callers invoke ListenAndServeTLS on each, typically in goroutines.
func (*Servers) GracefulStop ¶
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 (*Service) GetAgentDeployMetrics ¶
func (s *Service) GetAgentDeployMetrics(_ context.Context, req *pb.GetAgentDeployMetricsRequest) (*pb.GetAgentDeployMetricsResponse, error)
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."