metrics

package
v0.1.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Collector = &collector{}
)

Functions

func Counter

func Counter(key string, value int64, tagKvs ...string)

Counter description: Store tagKvs should be formatted as "key:value" example: counter("request.count", 1, "method:user", "type:upload")

func Debug added in v0.1.16

func Debug(logID, format string, args ...interface{})

func Error added in v0.1.16

func Error(logID, format string, args ...interface{})

func Fatal added in v0.1.16

func Fatal(logID, format string, args ...interface{})

func Info added in v0.1.16

func Info(logID, format string, args ...interface{})

func Latency

func Latency(key string, begin int64, tagKvs ...string)

Latency The unit of `begin` is milliseconds example: latency("request.latency", startTime, "method:user", "type:upload") description: Store tagKvs should be formatted as "key:value"

func Meter added in v0.1.16

func Meter(key string, value int64, tagKvs ...string)

Meter description:

  • meter(xx) = counter(xx) + rateCounter(xx.rate)
  • Store tagKvs should be formatted as "key:value"

example: rateCounter("request.count", 1, "method:user", "type:upload")

func Notice added in v0.1.16

func Notice(logID, format string, args ...interface{})

func RateCounter added in v0.1.16

func RateCounter(key string, value int64, tagKvs ...string)

RateCounter description: Store tagKvs should be formatted as "key:value" example: rateCounter("request.count", 1, "method:user", "type:upload")

func Store

func Store(key string, value int64, tagKvs ...string)

Store description: Store tagKvs should be formatted as "key:value" example: store("goroutine.count", 400, "ip:127.0.0.1")

func Timer

func Timer(key string, value int64, tagKvs ...string)

Timer The unit of `value` is milliseconds example: timer("request.cost", 100, "method:user", "type:upload") description: Store tagKvs should be formatted as "key:value"

func Trace added in v0.1.16

func Trace(logID, format string, args ...interface{})

func Warn added in v0.1.16

func Warn(logID, format string, args ...interface{})

Types

type Config added in v0.1.16

type Config struct {
	// When metrics are enabled, monitoring metrics will be reported to the byteplus server during use.
	EnableMetrics bool
	// When metrics log is enabled, the log will be reported to the byteplus server during use.
	EnableMetricsLog bool
	// The address of the byteplus metrics service, will be consistent with the host maintained by hostAvailabler.
	Domain string
	// The prefix of the Metrics indicator, the default is byteplus.rec.sdk, do not modify.
	Prefix string
	// Use this httpSchema to report metrics to byteplus server, default is https.
	HTTPSchema string
	// The reporting interval, the default is 15s, if the QPS is high, the reporting interval can be reduced to prevent data loss.
	ReportInterval time.Duration
	// Timeout for request reporting.
	HTTPTimeout time.Duration
}

func NewConfig added in v0.1.16

func NewConfig() *Config

type HostReader added in v0.1.16

type HostReader interface {
	GetHost() string
}

type Option

type Option func(config *Config)

func EnableMetrics added in v0.1.16

func EnableMetrics() Option

EnableMetrics if not set, will not report metrics.

func EnableMetricsLog added in v0.1.16

func EnableMetricsLog() Option

EnableMetricsLog if not set, will not report metrics logs.

func WithMetricsDomain

func WithMetricsDomain(domain string) Option

func WithMetricsHTTPSchema added in v0.1.16

func WithMetricsHTTPSchema(schema string) Option

func WithMetricsPrefix

func WithMetricsPrefix(prefix string) Option

func WithMetricsTimeout added in v0.1.11

func WithMetricsTimeout(timeout time.Duration) Option

func WithReportInterval added in v0.1.16

func WithReportInterval(reportInterval time.Duration) Option

WithReportInterval set the interval of reporting metrics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL