client

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefault

func SetDefault(client Client)

SetDefault 设置默认 client。

Types

type Client

type Client interface {
	// Interval 返回发送的间隔时间。
	Interval() time.Duration

	// 将统计信息同步的发送给平台。
	Send(ctx context.Context, stats *Stats) error
}

Client 代表一个 metrics 统计客户端的通用接口。

func Default

func Default() Client

Default 返回一个已经初始化的 client。

type Metric

type Metric struct {
	Name  string // 统计项名字。
	Tag   string // 额外标签名,比如统计 api_proctime 时候的 api 名字。
	Value int64  // 统计值。
}

Metric 是一个统计维度。

type Stats

type Stats struct {
	Time    time.Time // 统计发生的时间。
	Metrics []Metric  // 所有统计数据。
}

Stats 代表当前需要发送的所有统计信息。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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