v0.5.0
Add the appmetrics
package (#182)
The appmetrics
package provides utilities to define and create metrics struct. A metrics struct contains all the metric instances (counters, gauges, histograms, etc.) for a package or application and defines how those metrics appear in a registry. For example:
type Metrics struct {
Requests metrics.Counter `metric:"requests"`
FailedRequests metrics.Counter `metric:"requests.error"`
}
Applications usually define a single global instance of their metrics struct, which they reference in all other packages that report metrics. See the package documentation for more details and examples.
Add ability to ignore requests in logs and metrics (#185)
Calling baseapp.Ignore(*http.Request, baseapp.IgnoreRule)
from a request handler can disable logging or metrics for a particular request. This may be useful if there are certain common requests, like health checks, that are uninteresting or distracting. Custom middleware can check for ignored requests using the baseapp.IsIgnored(*http.Request, baseapp.IgnoreRule) bool
function.
Other Changes
- Report request rates and latencies by status code in the default metrics (#181)
- Add the ability to change
metrics.Timer
units when exporting metrics to Datadog (#184) - Move the
baseapp/datadog
package toappmetrics/emitter/datadog
and deprecate the old package (#183) - Minor dependency and build tool upgrades