- where is time recorded?
- how do we unit test what values we have recorded?
- instrumentedResponseWriter does not support the http.CloseNotifier interface
- instrumentedResponseWriter should only provide interfaces that the underlying ResponseWriter supports
Currently we are liking this style of interface:
package metric
import (
"time"
"github.com/cloudfoundry/dropsonde/autowire/metrics"
)
type Counter string
func (c Counter) Increment() {
metrics.IncrementCounter(string(c))
}
func (c Counter) Add(i uint64) {
metrics.AddToCounter(string(c), i)
}
type Duration string
func (name Duration) Send(duration time.Duration) {
metrics.SendValue(string(name), float64(duration), "nanos")
}
So that in our code we can declare our metrics like thus:
const (
lrpStartIndexCounter = metric.Counter("request-lrp-start-index")
lrpStopIndexCounter = metric.Counter("request-lrp-stop-index")
lrpStopInstanceCounter = metric.Counter("request-lrp-stop-instance")
)