本文整理汇总了Golang中github.com/juju/juju/api/metricsmanager.MetricsManagerClient类的典型用法代码示例。如果您正苦于以下问题:Golang MetricsManagerClient类的具体用法?Golang MetricsManagerClient怎么用?Golang MetricsManagerClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MetricsManagerClient类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewSender
// NewSender creates a new periodic worker that sends metrics
// to a collection service.
func NewSender(client metricsmanager.MetricsManagerClient) worker.Worker {
f := func(stopCh <-chan struct{}) error {
err := client.SendMetrics()
if err != nil {
senderLogger.Warningf("failed to send metrics %v - will retry later", err)
return nil
}
select {
case notify <- "senderCalled":
default:
}
return nil
}
return worker.NewPeriodicWorker(f, senderPeriod, worker.NewTimer)
}
示例2: newCleanup
// NewCleanup creates a new periodic worker that calls the CleanupOldMetrics api.
func newCleanup(client metricsmanager.MetricsManagerClient, notify chan string) worker.Worker {
f := func(stopCh <-chan struct{}) error {
err := client.CleanupOldMetrics()
if err != nil {
cleanupLogger.Warningf("failed to cleanup %v - will retry later", err)
return nil
}
select {
case notify <- "cleanupCalled":
default:
}
return nil
}
return worker.NewPeriodicWorker(f, cleanupPeriod, worker.NewTimer)
}