store more payload
This commit is contained in:
parent
33778ca87f
commit
0be7cc3cfc
|
@ -10,12 +10,11 @@ import (
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/models"
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/database/ent"
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent"
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/database/ent/metric"
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent/metric"
|
||||||
|
"github.com/crowdsecurity/crowdsec/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// updateBaseMetrics updates the base metrics for a machine or bouncer
|
// updateBaseMetrics updates the base metrics for a machine or bouncer
|
||||||
func (c *Controller) updateBaseMetrics(machineID string, bouncer *ent.Bouncer, baseMetrics *models.BaseMetrics, hubItems *models.HubItems) error {
|
func (c *Controller) updateBaseMetrics(machineID string, bouncer *ent.Bouncer, baseMetrics *models.BaseMetrics, hubItems *models.HubItems) error {
|
||||||
switch {
|
switch {
|
||||||
|
@ -30,7 +29,6 @@ func (c *Controller) updateBaseMetrics(machineID string, bouncer *ent.Bouncer, b
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// UsageMetrics receives metrics from log processors and remediation components
|
// UsageMetrics receives metrics from log processors and remediation components
|
||||||
func (c *Controller) UsageMetrics(gctx *gin.Context) {
|
func (c *Controller) UsageMetrics(gctx *gin.Context) {
|
||||||
var input models.AllMetrics
|
var input models.AllMetrics
|
||||||
|
@ -89,6 +87,8 @@ func (c *Controller) UsageMetrics(gctx *gin.Context) {
|
||||||
payload = map[string]any{
|
payload = map[string]any{
|
||||||
"console_options": item0.ConsoleOptions,
|
"console_options": item0.ConsoleOptions,
|
||||||
"datasources": item0.Datasources,
|
"datasources": item0.Datasources,
|
||||||
|
"metrics": item0.Metrics,
|
||||||
|
"meta": item0.Meta,
|
||||||
}
|
}
|
||||||
baseMetrics = item0.BaseMetrics
|
baseMetrics = item0.BaseMetrics
|
||||||
hubItems = item0.HubItems
|
hubItems = item0.HubItems
|
||||||
|
@ -106,6 +106,8 @@ func (c *Controller) UsageMetrics(gctx *gin.Context) {
|
||||||
item0 := input.RemediationComponents[0][0]
|
item0 := input.RemediationComponents[0][0]
|
||||||
payload = map[string]any{
|
payload = map[string]any{
|
||||||
"type": item0.Type,
|
"type": item0.Type,
|
||||||
|
"metrics": item0.Metrics,
|
||||||
|
"meta": item0.Meta,
|
||||||
// TODO: RC stuff like traffic stats
|
// TODO: RC stuff like traffic stats
|
||||||
}
|
}
|
||||||
baseMetrics = item0.BaseMetrics
|
baseMetrics = item0.BaseMetrics
|
||||||
|
|
Loading…
Reference in a new issue