代码拉取完成,页面将自动刷新
package monitoring
// Option type for passing additional options to NewRegistry.
type Option func(options) options
type options struct {
publishExpvar bool
mode Mode
}
var defaultOptions = options{
publishExpvar: false,
mode: Full,
}
// PublishExpvar enables publishing all registered variables via expvar interface.
// Note: expvar does not allow removal of any stats.
func PublishExpvar(o options) options {
o.publishExpvar = true
return o
}
// IgnorePublishExpvar disables publishing expvar variables in a sub-registry.
func IgnorePublishExpvar(o options) options {
o.publishExpvar = false
return o
}
func Report(o options) options {
o.mode = Reported
return o
}
func DoNotReport(o options) options {
o.mode = Full
return o
}
func varOpts(regOpts *options, opts []Option) *options {
if regOpts != nil && len(opts) == 0 {
return regOpts
}
O := defaultOptions
if regOpts != nil {
O = *regOpts
}
for _, opt := range opts {
O = opt(O)
}
return &O
}
func applyOpts(in *options, opts []Option) *options {
if len(opts) == 0 {
return ensureOptions(in)
}
tmp := *ensureOptions(in)
for _, opt := range opts {
tmp = opt(tmp)
}
return &tmp
}
func ensureOptions(in *options) *options {
if in != nil {
return in
}
tmp := defaultOptions
return &tmp
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。