Documentation
¶
Index ¶
- func API_GetMetrics(w http.ResponseWriter, req *http.Request)
- func API_ListEvents(w http.ResponseWriter, req *http.Request)
- func API_ResetMetrics(w http.ResponseWriter, req *http.Request)
- func AggloAndCommitMetrics()
- func AlertsIdRoute(w http.ResponseWriter, req *http.Request)
- func AlertsRoute(w http.ResponseWriter, req *http.Request)
- func CheckAlerts(TrackingMetric string, Period string, metric utils.AlertMetricTrack, Value int)
- func CommitAggl(metrics []DataDefDB)
- func ExecuteAction(alert utils.Alert, action utils.AlertAction, metric utils.AlertMetricTrack)
- func ExecuteAllActions(alert utils.Alert, actions []utils.AlertAction, metric utils.AlertMetricTrack)
- func GetDataBuffer() map[string]DataPush
- func GetSystemMetrics()
- func Init()
- func InitAggl()
- func ListMetrics(w http.ResponseWriter, req *http.Request)
- func MergeMetric(SetOperation string, currentValue int, newValue int, avgIndex int) int
- func ModuloTime(start time.Time, modulo time.Duration) time.Time
- func PushRequestMetrics(route utils.ProxyRouteConfig, statusCode int, TimeStarted time.Time, ...) error
- func PushSetMetric(key string, value int, def DataDef)
- func PushShieldMetrics(reason string)
- func Run()
- func SaveMetrics()
- type DataDef
- type DataDefDB
- type DataDefDBEntry
- type DataPush
- type Event
- type MetricList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func API_GetMetrics ¶
func API_GetMetrics(w http.ResponseWriter, req *http.Request)
API_GetMetrics godoc @Summary Get aggregated metrics data @Tags Metrics @Produce json @Param metrics query string false "Comma-separated list of metric keys to retrieve" @Security BearerAuth @Success 200 {object} map[string]interface{} @Failure 403 {object} utils.HTTPErrorResult @Router /api/metrics [get]
func API_ListEvents ¶
func API_ListEvents(w http.ResponseWriter, req *http.Request)
API_ListEvents godoc @Summary List events with filtering and pagination @Tags Metrics @Produce json @Param from query string false "Start date in RFC3339 format (2006-01-02T15:04:05Z)" @Param to query string false "End date in RFC3339 format (2006-01-02T15:04:05Z)" @Param logLevel query string false "Minimum log level (debug, info, success, warning, important, error)" default(info) @Param search query string false "Full-text search term" @Param query query string false "BSON query as JSON string" @Param page query string false "Pagination cursor (ObjectID hex string)" @Security BearerAuth @Success 200 {object} map[string]interface{} @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/events [get]
func API_ResetMetrics ¶
func API_ResetMetrics(w http.ResponseWriter, req *http.Request)
API_ResetMetrics godoc @Summary Reset all metrics and events data @Tags Metrics @Produce json @Security BearerAuth @Success 200 {object} map[string]interface{} @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/reset-metrics [get]
func AggloAndCommitMetrics ¶
func AggloAndCommitMetrics()
func AlertsIdRoute ¶ added in v0.22.0
func AlertsIdRoute(w http.ResponseWriter, req *http.Request)
AlertsIdRoute godoc @Summary Get, update, or delete a monitoring alert by name @Tags Metrics @Accept json @Produce json @Param name path string true "Alert name" @Param body body utils.Alert false "Updated alert config (PUT only)" @Security BearerAuth @Success 200 {object} map[string]interface{} @Failure 400 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 404 {object} utils.HTTPErrorResult @Router /api/alerts/{name} [get] @Router /api/alerts/{name} [put] @Router /api/alerts/{name} [delete]
func AlertsRoute ¶ added in v0.22.0
func AlertsRoute(w http.ResponseWriter, req *http.Request)
AlertsRoute godoc @Summary List or create monitoring alerts @Tags Metrics @Accept json @Produce json @Param body body utils.Alert false "Alert config (POST only)" @Security BearerAuth @Success 200 {object} map[string]interface{} @Failure 400 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 409 {object} utils.HTTPErrorResult @Router /api/alerts [get] @Router /api/alerts [post]
func CheckAlerts ¶
func CheckAlerts(TrackingMetric string, Period string, metric utils.AlertMetricTrack, Value int)
func CommitAggl ¶
func CommitAggl(metrics []DataDefDB)
func ExecuteAction ¶
func ExecuteAction(alert utils.Alert, action utils.AlertAction, metric utils.AlertMetricTrack)
func ExecuteAllActions ¶
func ExecuteAllActions(alert utils.Alert, actions []utils.AlertAction, metric utils.AlertMetricTrack)
func GetDataBuffer ¶ added in v0.15.0
func GetSystemMetrics ¶
func GetSystemMetrics()
func ListMetrics ¶
func ListMetrics(w http.ResponseWriter, req *http.Request)
ListMetrics godoc @Summary List all available metric keys and their labels @Tags Metrics @Produce json @Security BearerAuth @Success 200 {object} map[string]interface{} @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/list-metrics [get]
func MergeMetric ¶
func PushRequestMetrics ¶
func PushSetMetric ¶
func PushShieldMetrics ¶
func PushShieldMetrics(reason string)
func SaveMetrics ¶
func SaveMetrics()
Types ¶
type DataDefDB ¶
type DataDefDB struct {
Values []DataDefDBEntry
ValuesAggl map[string]DataDefDBEntry
LastUpdate time.Time
TimeScale float64
Max uint64
Label string
Key string
AggloType string
Scale int
Unit string
Object string
}
func AggloMetrics ¶
type DataDefDBEntry ¶
type Event ¶
type Event struct {
Id primitive.ObjectID `json:"id" bson:"_id"`
Label string `json:"label" bson:"label"`
Application string `json:"application" bson:"application"`
EventId string `json:"eventId" bson:"eventId"`
Date time.Time `json:"date" bson:"date"`
Level string `json:"level" bson:"level"`
Data map[string]interface{} `json:"data" bson:"data"`
Object string `json:"object" bson:"object"`
}