-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring Gauges and Counters in line with client library guidelines
- Point from Inc and Dec to Add and Sub in doc comments. - Deprecate Untyped for direct instrumentation. - Add a SetToCurrentTime method to Gauge Note that adding the SetToCurrentTime method is not really following Go's principle of lean interfaces. However, the Gauge interface is already quite fat. (The only methods really required are Set and Add. Everything else could be expressed in terms of those two.) So we have already quite a few "convenience" methods traditionally, so I think we should stay consistent here. The alternatives would be: - Not support SetToCurrentTime at all (it's only a SHOULD in the guidelines). - A top level function `SetToCurrentTime(Gauge)`. - Just a helper `CurrentTime()` that returns the curent unix time in seconds as a float (which is pretty verbose using the standard library, see code in this commit). This would allow `myGauge.Set(CurrentTime)`. Weighing all circumstances, I believe the way in this commit is the least evil. Issue #223 could be used to rework interfaces more fundamentally in a breaking change if feasible.
- Loading branch information
beorn7
committed
Nov 18, 2016
1 parent
f9f18f5
commit d32b70d
Showing
5 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters