Commit Graph

2 Commits

Author SHA1 Message Date
Matt Moore e7f80de1ce Avoid registering webhook metrics with init() (#826)
With this change folks will need to call `webhook.RegisterMetrics()` to register the opencensus view with the metrics for the webhook's StatsReporter.  This is needed to avoid having `sharedmain` crashloop the activator due to linking multiple on-`init()` views that register metrics named `request_latencies`.

In general, I believe that we should move away from registering these views via `init()` and more towards the broader K8s MetricsProvider pattern.
2019-10-28 22:02:11 -07:00
Annie Fu 84d3910c56 Add metrics to webhook package (#503)
* Add metrics to webhook package

Add metricstest package for shared helper functions for testing metrics

* Address PR

* Cleanup

* Fix import paths to fix build issues

* Fix import package path for test file

* Remove unnecessary formatting from error message

* Remove helper function only used once

* Add metric name to all error messages, make checkRowTags testing helper function

* Add common histogram bucket generator function to metrics package

* Fix CheckStatsNotReported check

* Reset metrics before each test so the tests are idempotent

* Make CheckStatsNotReported conditional clearer
2019-07-08 16:00:44 -07:00