top

Package metric is the API for defining metrics and updating their values.

When you define a metric you must also define the names and types of any fields on that metric. It is an error to define two metrics with the same name (this will cause a panic).

Example:

var (
  Requests = metric.NewCounter("myapp/requests", field.String("status"))
)
...
func handleRequest() {
  if success {
    Requests.Add(1, "success")
  } else {
    Requests.Add(1, "failure")
  }
}

Imports 5 package(s)

  1. github.com/luci/luci-go/common/tsmon
  2. github.com/luci/luci-go/common/tsmon/distribution
  3. github.com/luci/luci-go/common/tsmon/field
  4. github.com/luci/luci-go/common/tsmon/types
  5. golang.org/x/net/context

Test imports 1 package(s)

  1. github.com/smartystreets/goconvey/convey