open_pusher
pub fn open_pusher(endpoint string, job string) Pusher用途
打开pusher。
参数
endpointstring- endpoint(string)
jobstring- job(string)
返回
Pusher — 该类型的值
API
#github.com/xulang-org/packages/prometheus扩展包 `prometheus #github.com/xulang-org/packages/prometheus`,由模块 github.com/xulang-org/packages 提供。
github.com/xulang-org/packages · 0.1.1 · 安装与使用
open_pusherpub fn open_pusher(endpoint string, job string) Pusher打开pusher。
endpoint stringjob stringPusher — 该类型的值
struct Labelpub struct Label {
pub name string
pub value string
}公开结构体 `Label`。
name stringvalue stringstruct MetricSamplepub struct MetricSample {
pub label_str string
pub value string
}公开结构体 `MetricSample`。
label_str stringvalue stringstruct Counterpub struct Counter {
pub name string
pub help string
pub samples []MetricSample
}公开结构体 `Counter`。
name stringhelp stringsamples []MetricSamplestruct Gaugepub struct Gauge {
pub name string
pub help string
pub samples []MetricSample
}公开结构体 `Gauge`。
name stringhelp stringsamples []MetricSamplenew_counterpub fn new_counter(name string, help string) Counter构造 counter。
name stringhelp stringCounter — 该类型的值
new_gaugepub fn new_gauge(name string, help string) Gauge构造 gauge。
name stringhelp stringGauge — 该类型的值
(&mut Counter) incpub fn (c &mut Counter) inc()在 `&mut Counter` 上调用 `inc`。
c &mut Counter(&mut Counter) inc_bypub fn (c &mut Counter) inc_by(delta int)`&mut Counter` 上的方法:inc按。
c &mut Counterdelta int(&mut Counter) inc_labelspub fn (c &mut Counter) inc_labels(labels []Label, delta int)`&mut Counter` 上的方法:inclabels。
c &mut Counterlabels []Labeldelta int(&mut Gauge) setpub fn (g &mut Gauge) set(val string)在 `&mut Gauge` 上调用 `set`。
g &mut Gaugeval string(&mut Gauge) set_labelspub fn (g &mut Gauge) set_labels(labels []Label, val string)`&mut Gauge` 上的方法:设置 labels。
g &mut Gaugelabels []Labelval string(Counter) formatpub fn (c Counter) format() string`Counter` 上的方法:格式化为字符串。
c Counterstring — 结果字符串
(Gauge) formatpub fn (g Gauge) format() string`Gauge` 上的方法:格式化为字符串。
g Gaugestring — 结果字符串
struct Poolpub struct Pool {
pub host string
pub port int
pub state chan pool.State
pub max_idle int
}公开结构体 `Pool`。
host stringport intstate chan pool.Statemax_idle intnew_poolpub fn new_pool(endpoint string, max_idle int) Pool构造 pool。
endpoint stringmax_idle intPool — 该类型的值
open_poolpub fn open_pool(endpoint string, max_idle int) Pool打开pool。
endpoint stringmax_idle intPool — 该类型的值
(&Pool) duppub fn (p &Pool) dup() Pool在 `&Pool` 上调用 `dup`。
p &PoolPool — 该类型的值
(&Pool) get_connpub fn (p &Pool) get_conn() int`&Pool` 上的方法:读取 conn。
p &Poolint — 该类型的值
(&Pool) put_connpub fn (p &Pool) put_conn(fd int)`&Pool` 上的方法:put连接。
p &Poolfd int(&Pool) discard_connpub fn (p &Pool) discard_conn(fd int)`&Pool` 上的方法:丢弃连接。
p &Poolfd int(&Pool) push_metricspub fn (p &Pool) push_metrics(job string, metrics_text string) bool`&Pool` 上的方法:压入metrics。
p &Pooljob stringmetrics_text stringbool — 是否成立
(&Pool) closepub fn (p &Pool) close()`&Pool` 上的方法:关闭资源。
p &Poolstruct Pusherpub struct Pusher {
pub host string
pub port int
pub job string
}公开结构体 `Pusher`。
host stringport intjob stringnew_pusherpub fn new_pusher(endpoint string, job string) Pusher构造 pusher。
endpoint stringjob stringPusher — 该类型的值
(&Pusher) pushpub fn (p &Pusher) push(metrics_text string) bool`&Pusher` 上的方法:压入。
p &Pushermetrics_text stringbool — 是否成立
struct Registrypub struct Registry {
pub counters []Counter
pub gauges []Gauge
}公开结构体 `Registry`。
counters []Countergauges []Gaugenew_registrypub fn new_registry() Registry构造 registry。
无
Registry — 该类型的值
(&mut Registry) register_counterpub fn (r &mut Registry) register_counter(c Counter)`&mut Registry` 上的方法:registercounter。
r &mut Registryc Counter(&mut Registry) register_gaugepub fn (r &mut Registry) register_gauge(g Gauge)`&mut Registry` 上的方法:registergauge。
r &mut Registryg Gauge(&Registry) gatherpub fn (r &Registry) gather() string在 `&Registry` 上调用 `gather`。
r &Registrystring — 结果字符串