本文整理匯總了Golang中github.com/elastic/beats/metricbeat/mb.BaseMetricSet.HostData方法的典型用法代碼示例。如果您正苦於以下問題:Golang BaseMetricSet.HostData方法的具體用法?Golang BaseMetricSet.HostData怎麽用?Golang BaseMetricSet.HostData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/elastic/beats/metricbeat/mb.BaseMetricSet
的用法示例。
在下文中一共展示了BaseMetricSet.HostData方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: New
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
dialInfo, err := mgo.ParseURL(base.HostData().URI)
if err != nil {
return nil, err
}
dialInfo.Timeout = base.Module().Config().Timeout
return &MetricSet{
BaseMetricSet: base,
dialInfo: dialInfo,
}, nil
}
示例2: New
// New create a new instance of the docker info MetricSet.
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
logp.Warn("EXPERIMENTAL: The docker info metricset is experimental")
config := docker.Config{}
if err := base.Module().UnpackConfig(&config); err != nil {
return nil, err
}
client, err := docker.NewDockerClient(base.HostData().URI, config)
if err != nil {
return nil, err
}
return &MetricSet{
BaseMetricSet: base,
dockerClient: client,
}, nil
}
示例3: New
// New creates a new instance of the docker network MetricSet.
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
logp.Warn("EXPERIMENTAL: The docker network metricset is experimental")
config := docker.Config{}
if err := base.Module().UnpackConfig(&config); err != nil {
return nil, err
}
client, err := docker.NewDockerClient(base.HostData().URI, config)
if err != nil {
return nil, err
}
return &MetricSet{
BaseMetricSet: base,
dockerClient: client,
netService: &NetService{
NetworkStatPerContainer: make(map[string]map[string]NetRaw),
},
}, nil
}
示例4: NewMetricSet
func NewMetricSet(base mb.BaseMetricSet) (mb.MetricSet, error) {
fmt.Println("someapp-status url=", base.HostData().SanitizedURI)
return &MetricSet{BaseMetricSet: base}, nil
}