Documentation ¶
Index ¶
- Constants
- func AppName(name string) utils.OptionFunc[useOption]
- func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func()
- func HttpHandler(path, name string, opts ...utils.OptionExtender) http.Handler
- func Labels(labels []Label) utils.OptionFunc[option]
- func NewDI(name, job string, opts ...utils.OptionExtender) func() Sink
- func Precision() utils.OptionFunc[option]
- func PrometheusBuckets(buckets []float64) utils.OptionFunc[option]
- func Timeout(timeout time.Duration) utils.OptionFunc[option]
- func WithoutTimeout() utils.OptionFunc[option]
- type Conf
- type Label
- type Sink
Constants ¶
View Source
const (
ErrDuplicatedName utils.Error = "duplicated metrics name"
)
Variables ¶
This section is empty.
Functions ¶
func AppName ¶
func AppName(name string) utils.OptionFunc[useOption]
func HttpHandler ¶
func HttpHandler(path, name string, opts ...utils.OptionExtender) http.Handler
func Labels ¶
func Labels(labels []Label) utils.OptionFunc[option]
func Precision ¶
func Precision() utils.OptionFunc[option]
func PrometheusBuckets ¶
func PrometheusBuckets(buckets []float64) utils.OptionFunc[option]
func WithoutTimeout ¶
func WithoutTimeout() utils.OptionFunc[option]
Types ¶
type Conf ¶
type Conf struct { Type metricsType `yaml:"type" json:"type" toml:"type"` Mode mode `yaml:"mode" json:"mode" toml:"mode"` Interval string `yaml:"interval" json:"interval" toml:"interval"` Endpoint *endpointConf `yaml:"endpoint" json:"endpoint" toml:"endpoint"` Labels map[string]string `yaml:"labels" json:"labels" toml:"labels"` EnableServiceLabel bool `yaml:"enable_service_label" json:"enable_service_label" toml:"enable_service_label"` EnableInternalMetrics bool `yaml:"enable_internal_metrics" json:"enable_internal_metrics" toml:"enable_internal_metrics"` QueueLimit int `yaml:"queue_limit" json:"queue_limit" toml:"queue_limit" default:"16384"` QueueConcurrency int `yaml:"queue_concurrency" json:"queue_concurrency" toml:"queue_concurrency"` Logger string `yaml:"logger" json:"logger" toml:"logger" default:"github.com/wfusion/gofusion/log/customlogger.metricsLogger"` LogInstance string `yaml:"log_instance" json:"log_instance" toml:"log_instance" default:"default"` EnableLogger bool `yaml:"enable_logger" json:"enable_logger" toml:"enable_logger" default:"false"` }
Conf metrics conf nolint: revive // struct tag too long issue
type Sink ¶
type Sink interface { // SetGauge A Gauge should retain the last value it is set to SetGauge(ctx context.Context, key []string, val float64, opts ...utils.OptionExtender) // IncrCounter Counters should accumulate values IncrCounter(ctx context.Context, key []string, val float64, opts ...utils.OptionExtender) // AddSample Samples are for timing information, where quantiles are used AddSample(ctx context.Context, key []string, val float64, opts ...utils.OptionExtender) // MeasureSince A better way to add timer samples MeasureSince(ctx context.Context, key []string, start time.Time, opts ...utils.OptionExtender) // IsEnableServiceLabel check if enable service label IsEnableServiceLabel() bool // contains filtered or unexported methods }
The Sink interface is used to transmit metrics information to an external system
func Internal ¶
func Internal(opts ...utils.OptionExtender) (sinks []Sink)
Click to show internal directories.
Click to hide internal directories.