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

Unified Diff: go/metrics2/counter.go

Issue 1722163002: Metrics2: Store a registry of Counters (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Rebase Created 4 years, 10 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
Index: go/metrics2/counter.go
diff --git a/go/metrics2/counter.go b/go/metrics2/counter.go
index 3752e2c291cb24008f70ed601e4f582c35afb377..c55b259c77a60ea2838e922770859c1cbe7cac00 100644
--- a/go/metrics2/counter.go
+++ b/go/metrics2/counter.go
@@ -12,23 +12,9 @@ type Counter struct {
mtx sync.Mutex
}
-// NewCounter creates and returns a new Counter.
-func (c *Client) NewCounter(name string, tags map[string]string) *Counter {
- // Add the name to the tags.
- t := make(map[string]string, len(tags)+1)
- for k, v := range tags {
- t[k] = v
- }
- t["name"] = name
- return &Counter{
- m: c.GetInt64Metric(MEASUREMENT_COUNTER, t),
- mtx: sync.Mutex{},
- }
-}
-
-// NewCounter creates and returns a new Counter using the default client.
-func NewCounter(name string, tags map[string]string) *Counter {
- return DefaultClient.NewCounter(name, tags)
+// GetCounter creates and returns a new Counter using the default client.
+func GetCounter(name string, tags map[string]string) *Counter {
+ return DefaultClient.GetCounter(name, tags)
}
// Inc increments the counter by the given quantity.
« no previous file with comments | « go/httputils/http.go ('k') | go/metrics2/docs.go » ('j') | go/metrics2/metrics.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698