mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-14 13:24:34 +02:00
34 lines
876 B
Go
34 lines
876 B
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// Metric is actually a set of metrics collected by a device
|
|
// (logprocessor, bouncer, etc) at a given time.
|
|
type Metric struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (Metric) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Enum("generated_type").
|
|
Values("LP", "RC").
|
|
Immutable().
|
|
Comment("Type of the metrics source: LP=logprocessor, RC=remediation"),
|
|
field.String("generated_by").
|
|
Immutable().
|
|
Comment("Source of the metrics: machine id, bouncer name...\nIt must come from the auth middleware."),
|
|
field.Time("received_at").
|
|
Immutable().
|
|
Comment("When the metrics are received by LAPI"),
|
|
field.Time("pushed_at").
|
|
Nillable().
|
|
Optional().
|
|
Comment("When the metrics are sent to the console"),
|
|
field.Text("payload").
|
|
Immutable().
|
|
Comment("The actual metrics (item0)"),
|
|
}
|
|
}
|