Documentation ¶
Index ¶
- func EmitCounter(name string, value float32, labels ...Label)
- func EmitKey(name string, value float32, labels ...Label)
- func EmitTimer(name string, value time.Duration, labels ...Label)
- func RecordAPIRequest(req APIRequest)
- func RecordDBOperation(op DBOperation)
- func RecordLogicOperation(op LogicOperation)
- type APIRequest
- type DBOperation
- type Label
- type LogicOperation
- type MetricsBackendType
- type MetricsHub
- type MetricsHubConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitCounter ¶
func RecordAPIRequest ¶
func RecordAPIRequest(req APIRequest)
func RecordDBOperation ¶
func RecordDBOperation(op DBOperation)
func RecordLogicOperation ¶
func RecordLogicOperation(op LogicOperation)
Types ¶
type APIRequest ¶
type APIRequest struct { Method string Path string StatusCode int Success bool Duration time.Duration BusinessCategory string }
func (APIRequest) ToLabels ¶
func (r APIRequest) ToLabels() []Label
type DBOperation ¶
type DBOperation struct { Database string Table string OperationType string BusinessCategory string Success bool Duration time.Duration }
func (DBOperation) ToLabels ¶
func (op DBOperation) ToLabels() []Label
type Label ¶
func MapToLabel ¶
func StructFieldToLabel ¶
func StructFieldToLabel(s interface{}) []Label
type LogicOperation ¶
type LogicOperation struct { PrimaryCategory string SecondaryCategory string TertiaryCategory string Success bool Duration time.Duration }
func (LogicOperation) ToLabels ¶
func (op LogicOperation) ToLabels() []Label
type MetricsBackendType ¶
type MetricsBackendType string
const ( PrometheusBackendType MetricsBackendType = "prometheus" InmemBackendType MetricsBackendType = "inmem" )
type MetricsHub ¶
type MetricsHub struct {
// contains filtered or unexported fields
}
func NewMetricsHub ¶
func NewMetricsHub(ctx context.Context, args *MetricsHubConfig) (*MetricsHub, error)
type MetricsHubConfig ¶
type MetricsHubConfig struct { ServiceName string BackendType MetricsBackendType ExpirationSec int64 }
Click to show internal directories.
Click to hide internal directories.