Documentation ¶
Index ¶
- Variables
- func FormatAlerts(result []*ent.Alert) models.AddAlertsRequest
- func FormatDecisions(decisions []*ent.Decision) ([]*models.Decision, error)
- func FormatOneAlert(alert *ent.Alert) *models.Alert
- func PrometheusBouncersHasEmptyDecision(c *gin.Context)
- func PrometheusBouncersHasNonEmptyDecision(c *gin.Context)
- func PrometheusBouncersMiddleware() gin.HandlerFunc
- func PrometheusMachinesMiddleware() gin.HandlerFunc
- func PrometheusMiddleware() gin.HandlerFunc
- type Controller
- func (c *Controller) CreateAlert(gctx *gin.Context)
- func (c *Controller) CreateMachine(gctx *gin.Context)
- func (c *Controller) DeleteAlerts(gctx *gin.Context)
- func (c *Controller) DeleteDecisionById(gctx *gin.Context)
- func (c *Controller) DeleteDecisions(gctx *gin.Context)
- func (c *Controller) FindAlertByID(gctx *gin.Context)
- func (c *Controller) FindAlerts(gctx *gin.Context)
- func (c *Controller) GetDecision(gctx *gin.Context)
- func (c *Controller) HandleDBErrors(gctx *gin.Context, err error)
- func (c *Controller) StreamDecision(gctx *gin.Context)
Constants ¶
This section is empty.
Variables ¶
View Source
var LapiBouncerHits = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_lapi_bouncer_requests_total", Help: "Number of calls to each route per method grouped by bouncers.", }, []string{"bouncer", "route", "method"}, )
hits per bouncer
View Source
var LapiMachineHits = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_lapi_machine_requests_total", Help: "Number of calls to each route per method grouped by machines.", }, []string{"machine", "route", "method"}, )
hits per machine
View Source
var LapiNilDecisions = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_lapi_decisions_ko_total", Help: "Number of calls to /decisions that returned nil result.", }, []string{"bouncer"}, )
keep track of the number of calls (per bouncer) that lead to nil/non-nil responses.
while it's not exact, it's a good way to know - when you have a rutpure bouncer - what is the rate of ok/ko answers you got from lapi
View Source
var LapiNonNilDecisions = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_lapi_decisions_ok_total", Help: "Number of calls to /decisions that returned non-nil result.", }, []string{"bouncer"}, )
hits per bouncer
View Source
var LapiRouteHits = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_lapi_route_requests_total", Help: "Number of calls to each route per method.", }, []string{"route", "method"}, )
prometheus
Functions ¶
func FormatAlerts ¶
func FormatAlerts(result []*ent.Alert) models.AddAlertsRequest
FormatAlerts : Format results from the database to be swagger model compliant
func PrometheusBouncersMiddleware ¶
func PrometheusBouncersMiddleware() gin.HandlerFunc
func PrometheusMachinesMiddleware ¶
func PrometheusMachinesMiddleware() gin.HandlerFunc
func PrometheusMiddleware ¶
func PrometheusMiddleware() gin.HandlerFunc
Types ¶
type Controller ¶
type Controller struct { Ectx context.Context DBClient *database.Client APIKeyHeader string Middlewares *middlewares.Middlewares Profiles []*csconfig.ProfileCfg CAPIChan chan []*models.Alert PluginChannel chan csplugin.ProfileAlert }
func New ¶
func New(dbClient *database.Client, ctx context.Context, profiles []*csconfig.ProfileCfg, capiChan chan []*models.Alert, pluginChannel chan csplugin.ProfileAlert) (*Controller, error)
func (*Controller) CreateAlert ¶
func (c *Controller) CreateAlert(gctx *gin.Context)
CreateAlert : write received alerts in body to the database
func (*Controller) CreateMachine ¶
func (c *Controller) CreateMachine(gctx *gin.Context)
func (*Controller) DeleteAlerts ¶
func (c *Controller) DeleteAlerts(gctx *gin.Context)
DeleteAlerts : delete alerts from database based on the specified filter
func (*Controller) DeleteDecisionById ¶
func (c *Controller) DeleteDecisionById(gctx *gin.Context)
func (*Controller) DeleteDecisions ¶
func (c *Controller) DeleteDecisions(gctx *gin.Context)
func (*Controller) FindAlertByID ¶
func (c *Controller) FindAlertByID(gctx *gin.Context)
FindAlertByID return the alert assiocated to the ID
func (*Controller) FindAlerts ¶
func (c *Controller) FindAlerts(gctx *gin.Context)
FindAlerts : return alerts from database based on the specified filter
func (*Controller) GetDecision ¶
func (c *Controller) GetDecision(gctx *gin.Context)
func (*Controller) HandleDBErrors ¶
func (c *Controller) HandleDBErrors(gctx *gin.Context, err error)
func (*Controller) StreamDecision ¶
func (c *Controller) StreamDecision(gctx *gin.Context)
Click to show internal directories.
Click to hide internal directories.