As a Sensu Backend, I would like to be able to know key metrics about the cluster I am a member of.
This includes:
The spike should include analysis of the etcd and postgres event stores.
The result of the spike should be a Go interface that specifies how a user would query the store for information about these things.
I've created three interfaces and structured datatypes for getting metrics information for the Event, Entity, and Keepalive resource types.
package store
import "context"
// EventGauges are gauge metrics about the events stored in Sensu.
type EventGauges struct {
Total int64
Passing int64
Warning int64
Critical int64
Other int64
}
// EntityGauges are gauge metrics about the entities stored in Sensu.
type EntityGauges struct {
Total int64
Agent int64
Proxy int64
}
// KeepaliveGauges are gauge metrics about the keepalives stored in Sensu.
type KeepaliveGauges struct {
Total int64
Passing int64
Failing int64
}
// EventMetrics provides a way to get metrics about Sensu events.
type EventMetrics interface {
// GetEventGauges gets gauge metrics about events.
GetEventGauges(context.Context) (EventGauges, error)
}
// EntityMetrics provides a way to get metrics about Sensu entities.
type EntityMetrics interface {
// GetEntityGauges gets gauge metrics about entities.
GetEntityGauges(context.Context) (EntityGauges, error)
}
// KeepaliveMetrics provides a way to get metrics about Sensu keepalives.
type KeepaliveMetrics interface {
// GetKeepaliveGauges gets gauge metrics about keepalives.
GetKeepaliveGauges(context.Context) (KeepaliveGauges, error)
}
Using three interfaces instead of one will help with separation of concerns, and will also keep the disparity between postgres and etcd out of our way.
The Gauge data types can be extended later without affecting compatibility.
Does this interface account for per namespace scopes?
@portertech you've been waiting patiently for 29 days, and now you've got your answer: Yes!
Most helpful comment
@portertech you've been waiting patiently for 29 days, and now you've got your answer: Yes!