v1

package
v1.3.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

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 FormatDecisions

func FormatDecisions(decisions []*ent.Decision) ([]*models.Decision, error)

func FormatOneAlert

func FormatOneAlert(alert *ent.Alert) *models.Alert

func PrometheusBouncersHasEmptyDecision

func PrometheusBouncersHasEmptyDecision(c *gin.Context)

func PrometheusBouncersHasNonEmptyDecision

func PrometheusBouncersHasNonEmptyDecision(c *gin.Context)

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
	ConsoleConfig csconfig.ConsoleConfig
}

func New

func New(dbClient *database.Client, ctx context.Context, profiles []*csconfig.ProfileCfg, capiChan chan []*models.Alert, pluginChannel chan csplugin.ProfileAlert, consoleConfig csconfig.ConsoleConfig) (*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)

Jump to

Keyboard shortcuts

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