forked from mirror/client_golang
606b8f85e5
- 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. |
||
---|---|---|
.. | ||
graphite | ||
promhttp | ||
push | ||
.gitignore | ||
README.md | ||
benchmark_test.go | ||
collector.go | ||
counter.go | ||
counter_test.go | ||
desc.go | ||
doc.go | ||
example_clustermanager_test.go | ||
examples_test.go | ||
expvar_collector.go | ||
expvar_collector_test.go | ||
fnv.go | ||
gauge.go | ||
gauge_test.go | ||
go_collector.go | ||
go_collector_test.go | ||
histogram.go | ||
histogram_test.go | ||
http.go | ||
http_test.go | ||
metric.go | ||
metric_test.go | ||
process_collector.go | ||
process_collector_test.go | ||
registry.go | ||
registry_test.go | ||
summary.go | ||
summary_test.go | ||
untyped.go | ||
value.go | ||
vec.go | ||
vec_test.go |