* Add RecordN method to permit recording of N measurements simultaneously.
In serving we have many places where we try to record several metrics at the same time.
Besides very repetetive code, this also brings inefficiences, since metrics code has to do _some_ work
for every call, which is completely avoidable.
This way we can record N measurements with one hit.
* tests and nits
* review items per discussion with Evan:
- remove ros
- make measurements ...
* review
* Add support for OpenCensus Agent as a destination for Knative metrics.
* Update with comments from @mattmoor and @anniefu
* Remember to register exporter.
Fix tests.
* Fix naming per discussion with @anniefu
* Document the plan for metrics
* Update with issue links
* Update with other @mattmoor comments.
* Address feedback from @anniefu
* Update export address since `localhost` won't work for a DaemonSet.
* Add an explicit action item to migrate Prometheus
* Fix possible (ambiguous) link vs checkbox.
Working to introduce structured logging to our tests. See #907
This work allows these test functions to be called by objects other
than *testing.T. The t.Error() calls are made compatible with
structured logging (wrapping Zap sugared logger calls) or code using
testing.T.
the observability config is used in other packages including
the sample controller. This commit pulls observability config
into knative.dev/pkg similar to logging config for better reusability.
* marking the metrics as internal as we need to pre-process them to include
pod_name and container_name...
* removing eventSource
* updates
* rollbacking changes to source
* updating changes to source
* minimizing change
* minimizing change
* Restrict Stackdriver Secret to controlled name & namespace
* Address PR comments
* Lock when reading secret name & namespace
* Export StackdriverClientConfig struct so consumers don't have to
redefine it
* Ensure metrics pkg consumers call SetStackdriverSecretLocation to set
Secret name and namespace
* Export StackdriverClientConfig consts & helper function
* Add TODO for secret watcher
* Add field to metrics config for configuring Stackdriver exporter client
options
* Fix test setting global state and interfering with other tests
* Use correct GCP metadata values & cleanup
* Some code cleanup
* Remove as much test-specific function stubbing as possible
* Remove more stubbed out test code
* Make more descriptive error when getting secret
* Use former locking pattern to avoid deadlock
There is a cyclical dependency between the metrics pkg and client-go
kubeclient where the kubeclient will attempt to read the metricsConfig
to record metrics about kubeclient requests. This prevents using a kubeclient within the metricsMux lock.
* Remove race condition between reading updates to config-observability
and updating stackdriver exporter
* Simply isNewExporterRequired if statement
* Remove unused thread-safe versions of functions
* Use a reader-writer lock & add function comment
* Make internal unlocked function names consistent
This exposes metrics for the properties available through [here](https://godoc.org/runtime#MemStats) so that we can get some better visibility into things like GC pressure.
This adds logic to hook into two other metric systems:
1. `cache.SetReflectorMetricsProvider`, which doesn't seem hooked up in Kubernetes yet, but would theoretically give us metrics about the mechanisms underpinning informers.
2. `metrics.Register`, which hooks us into the rest client infrastructure to give us metrics about low-level API server calls.
Fixes: https://github.com/knative/pkg/issues/679
Fixes: https://github.com/knative/pkg/issues/680
* renaming source_name and source_resource_group to name and resource_group,
as they will be used in other resources
* updating
* updates based on code review
* update
* fix
* source stats reporter... should be used by well-behaved sources
* public fields
* moving serialization/deserialization of metrics and logging maps to pkg
* nits
* adding UT
* same order
* updates
* sock-puppet
* unregistration problem?
* removing base64 encoding
* removing TODO
* removing config changes... done in another PR
* to properly address the comment
* changing importer to source
* moving stats_reporter to new source folder
* source stats reporter... should be used by well-behaved sources
* public fields
* moving serialization/deserialization of metrics and logging maps to pkg
* nits
* adding UT
* same order
* updates
* sock-puppet
* unregistration problem?
* removing base64 encoding
* removing TODO
* removing config changes... done in another PR
* to properly address the comment
* changing importer to source
* source stats reporter... should be used by well-behaved sources
* public fields
* moving serialization/deserialization of metrics and logging maps to pkg
* nits
* adding UT
* same order
* updates
* sock-puppet
* unregistration problem?
* removing base64 encoding
* removing TODO
* removing config changes... done in another PR
* to properly address the comment
* source stats reporter... should be used by well-behaved sources
* public fields
* moving serialization/deserialization of metrics and logging maps to pkg
* nits
* adding UT
* same order
* updates
* sock-puppet
* unregistration problem?
* removing base64 encoding
* removing TODO
* comments after review
* removing the other constants
* 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