Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: common/tsmon/metric/standard_metrics.go

Issue 2290993002: Always set presence/up from go tsmon apps. (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/tsmon/metric/metric_test.go ('k') | common/tsmon/metric/standard_metrics_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/tsmon/metric/standard_metrics.go
diff --git a/common/tsmon/metric/standard_metrics.go b/common/tsmon/metric/standard_metrics.go
index b98c3d3b8b68a7561c7d840603c0eb9c8b822a26..5dd2b3bc740816bf3ebf43e54948138379d99b75 100644
--- a/common/tsmon/metric/standard_metrics.go
+++ b/common/tsmon/metric/standard_metrics.go
@@ -10,6 +10,7 @@ import (
"golang.org/x/net/context"
+ "github.com/luci/luci-go/common/tsmon"
"github.com/luci/luci-go/common/tsmon/distribution"
"github.com/luci/luci-go/common/tsmon/field"
"github.com/luci/luci-go/common/tsmon/types"
@@ -101,9 +102,14 @@ var (
)
-// UpdatePresenceMetrics sets the presence/up metric.
-func UpdatePresenceMetrics(ctx context.Context) {
- presenceMetric.Set(ctx, true)
+func init() {
+ registerCallbacks(context.Background())
+}
+
+func registerCallbacks(ctx context.Context) {
+ tsmon.RegisterCallbackIn(ctx, func(ctx context.Context) {
+ presenceMetric.Set(ctx, true)
+ })
}
const (
« no previous file with comments | « common/tsmon/metric/metric_test.go ('k') | common/tsmon/metric/standard_metrics_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698