Documentation
¶
Index ¶
- Variables
- func Counter(key string, value int64, tagKvs ...string)
- func Debug(logID, format string, args ...interface{})
- func Error(logID, format string, args ...interface{})
- func Fatal(logID, format string, args ...interface{})
- func Info(logID, format string, args ...interface{})
- func Latency(key string, begin int64, tagKvs ...string)
- func Meter(key string, value int64, tagKvs ...string)
- func Notice(logID, format string, args ...interface{})
- func RateCounter(key string, value int64, tagKvs ...string)
- func Store(key string, value int64, tagKvs ...string)
- func Timer(key string, value int64, tagKvs ...string)
- func Trace(logID, format string, args ...interface{})
- func Warn(logID, format string, args ...interface{})
- type Config
- type HostReader
- type Option
- func EnableMetrics() Option
- func EnableMetricsLog() Option
- func WithMetricsDomain(domain string) Option
- func WithMetricsHTTPSchema(schema string) Option
- func WithMetricsPrefix(prefix string) Option
- func WithMetricsTimeout(timeout time.Duration) Option
- func WithReportInterval(reportInterval time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
var (
Collector = &collector{}
)
Functions ¶
func Counter ¶
Counter description: Store tagKvs should be formatted as "key:value" example: counter("request.count", 1, "method:user", "type:upload")
func Latency ¶
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
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 RateCounter ¶ added in v0.1.16
RateCounter description: Store tagKvs should be formatted as "key:value" example: rateCounter("request.count", 1, "method:user", "type:upload")
func Store ¶
Store description: Store tagKvs should be formatted as "key:value" example: store("goroutine.count", 400, "ip:127.0.0.1")
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 }
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 WithMetricsHTTPSchema ¶ added in v0.1.16
func WithMetricsPrefix ¶
func WithMetricsTimeout ¶ added in v0.1.11
func WithReportInterval ¶ added in v0.1.16
WithReportInterval set the interval of reporting metrics