Documentation
¶
Index ¶
- func NewServer(logger clog.CLog, registry Registry, healthCheck *HealthChecker) *server
- type HealthChecker
- type Registry
- type Series
- func (s Series) Duration(d time.Duration, msg string) (string, prometheus.Labels, float64)
- func (s Series) Error(message string) (string, prometheus.Labels)
- func (s Series) Info(message string) (string, prometheus.Labels)
- func (s Series) Success() (string, prometheus.Labels)
- func (s Series) ToContext(ctx context.Context) context.Context
- func (s Series) WithLabels(labels prometheus.Labels) Series
- func (s Series) WithOperation(ctx context.Context, operation string) (context.Context, Series)
- type SeriesType
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HealthChecker ¶
type HealthChecker struct {
// contains filtered or unexported fields
}
func NewHealthChecker ¶
func NewHealthChecker(logger clog.CLog) *HealthChecker
func (*HealthChecker) LivenessHandler ¶
func (hc *HealthChecker) LivenessHandler(w http.ResponseWriter, r *http.Request)
func (*HealthChecker) ReadinessHandler ¶
func (hc *HealthChecker) ReadinessHandler(w http.ResponseWriter, r *http.Request)
func (*HealthChecker) SetHealthy ¶
func (hc *HealthChecker) SetHealthy(healthy bool)
func (*HealthChecker) SetReady ¶
func (hc *HealthChecker) SetReady(ready bool)
type Registry ¶
type Registry interface { Inc(string, prometheus.Labels) RecordDuration(string, prometheus.Labels, float64) PrometheusRegistry() *prometheus.Registry }
Registry defines the interface for managing metrics.
func NewRegistry ¶
NewRegistry creates a new metrics registry with the specified subsystem and namespace.
func NewRegistryStub ¶
func NewRegistryStub() Registry
NewRegistryStub creates a new instance of a no-op registry.
type Series ¶
type Series struct {
// contains filtered or unexported fields
}
func FromContext ¶
FromContext retrieves the Series from the context.
func NewSeries ¶
func NewSeries(st SeriesType, subType string) Series
NewSeries creates a new Series instance with the given type and subType.
func (Series) Duration ¶
Duration returns the metric name and labels for recording a duration, where msg carries any additional information
func (Series) Error ¶
func (s Series) Error(message string) (string, prometheus.Labels)
Error returns the metric name and labels for an error event.
func (Series) Info ¶
func (s Series) Info(message string) (string, prometheus.Labels)
Info returns the metric name and labels for an informational event.
func (Series) Success ¶
func (s Series) Success() (string, prometheus.Labels)
Success returns the metric name and labels for a success event.
func (Series) WithLabels ¶ added in v0.0.35
func (s Series) WithLabels(labels prometheus.Labels) Series
WithLabels adds custom labels to the Series.
type SeriesType ¶
type SeriesType string
const ( SeriesTypeRPCHandler SeriesType = "rpc_handler" SeriesTypeApiHandler SeriesType = "api_handler" SeriesTypeUseCase SeriesType = "use_case" SeriesTypeClient SeriesType = "client" SeriesTypeDB SeriesType = "postgres" SeriesTypeDatabusConsumer SeriesType = "databus_consumer" )
func (SeriesType) String ¶
func (st SeriesType) String() string