Documentation
¶
Index ¶
- Variables
- func EchoHandler() echo.HandlerFunc
- func EchoMiddleware() echo.MiddlewareFunc
- func Handler() http.Handler
- func StartCollector(ctx *appContext.Context, provider AgentMetricsProvider, interval time.Duration)
- func StartServer(ctx *appContext.Context, listen string) *http.Server
- type AgentCount
- type AgentMetricsProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // AgentErrorsGauge tracks the number of agents in error status per namespace/project AgentErrorsGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "flecto_agent_errors_total", Help: "Number of agents in error status (excluding offline agents)", }, []string{"namespace", "project"}, ) // AgentOnlineGauge tracks the number of online agents per namespace/project AgentOnlineGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "flecto_agent_online_total", Help: "Number of online agents", }, []string{"namespace", "project"}, ) // HTTPRequestsTotal counts HTTP requests HTTPRequestsTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "flecto_http_requests_total", Help: "Total number of HTTP requests", }, []string{"method", "path", "status"}, ) // HTTPRequestDuration tracks HTTP request duration HTTPRequestDuration = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "flecto_http_request_duration_seconds", Help: "HTTP request duration in seconds", Buckets: prometheus.DefBuckets, }, []string{"method", "path"}, ) )
Functions ¶
func EchoHandler ¶
func EchoHandler() echo.HandlerFunc
EchoHandler returns an Echo handler for Prometheus metrics
func EchoMiddleware ¶
func EchoMiddleware() echo.MiddlewareFunc
EchoMiddleware returns an Echo middleware that records HTTP metrics
func StartCollector ¶
func StartCollector(ctx *appContext.Context, provider AgentMetricsProvider, interval time.Duration)
StartCollector starts a background goroutine that periodically updates agent metrics
func StartServer ¶
func StartServer(ctx *appContext.Context, listen string) *http.Server
StartServer starts a dedicated metrics server on the specified address
Types ¶
type AgentCount ¶
type AgentCount struct {
NamespaceCode string
ProjectCode string
Status commonTypes.AgentStatus
Count int64
}
AgentCount represents agent count for a namespace/project/status combination
type AgentMetricsProvider ¶
type AgentMetricsProvider interface {
GetAgentCounts(ctx context.Context, onlineThreshold time.Time) ([]AgentCount, error)
}
AgentMetricsProvider provides agent metrics data
func NewAgentMetricsProvider ¶
func NewAgentMetricsProvider(agentService service.AgentService) AgentMetricsProvider
NewAgentMetricsProvider creates a new AgentMetricsProvider
Click to show internal directories.
Click to hide internal directories.