Commit Graph

23 Commits

Author SHA1 Message Date
Dave Protasowski 3d24b8416b
fix lint warnings (#2589)
* resolve deprecation warnings

* drop use of ioutil

* fix license

* run hack/update-codegen.sh
2022-09-12 18:15:45 +00:00
Dave Protasowski aff7376aba
drop stackdriver metrics and tracing exporters (#2183)
* drop stack driver as a tracing backend

* drop stackdriver as a metrics backend

* update deps - dropping stackdriver

* fix linting issues

* drop further references to stack driver

* drop serving & eventing metric key constants
these have been moved to their respective repos
see: https://github.com/knative/pkg/issues/608

* move source metrickeys to pkg/source

We're going to move the StatsReporter downstream eventually

related:
https://github.com/knative/eventing/pull/5587
https://github.com/knative/eventing/pull/5586

* fix linter
2021-07-14 11:45:31 -07:00
Stavros Kontopoulos 6c2f94a4d6
Unregister views to avoid slow oom issue during meter cleanup (#2005)
* unregister views

* add a test

* fix string issue

* fix

* fixes

* fixe races in tests

* fix exporter issue

* stop meter in cleanup

* fixes

* typo

* revert timeout change

* fixes

* change msg
2021-02-17 02:17:02 -08:00
Evan Anderson e41409af6c
Refactor and fix metrics export tests. (#1957)
* Copy resource_view_test to e2e_test

* Restore metrics/resource_view_test.go

* Refactor metrics tests, fix e2e_test

* Address yanweiguo feedback

* Cleanup per vagababov

* Switch to zap.Error but avoid the bug the code previously had.
2020-12-18 10:57:03 -08:00
Markus Thömmes ba2137c16f
Fix excessive allocation in the resource metrics (#1964)
* Fix excessive allocation in the resource metrics

* Optimize further

* Fix lint

* Prettify

* Add comment to lambda

* Even prettier
2020-12-15 09:37:58 -08:00
Markus Thömmes 565516e224
Add errorlint and fix all existing issues (#1855) 2020-10-29 01:14:35 -07:00
Markus Thömmes 03dd7b7c48
Skip flaky OpenCensus exporter test until fixed (#1870) 2020-10-28 04:58:41 -07:00
Victor Agababov ee0539ddff
Get rid of the interface (#1817)
and other nits.
2020-10-19 10:58:58 -07:00
Markus Thömmes 95e9532f04
Wait for prometheus server to start serving before fetching metrics (#1819) 2020-10-19 04:42:58 -07:00
Montgomery Carter 21cb070a8b
Introduce pkg/metrics allMeter cache (#1741)
We currently keep all metrics exporters created since start.
For a busy, long running server, this will be a problem.  Clean
these up when they get old so we don't dedicate memory to non-existent
2020-10-05 10:51:34 -07:00
Victor Agababov a371418524
v2 (#1754) 2020-09-29 13:18:29 -07:00
Evan Anderson 8c2ebdb0e0
Speed up & deflake tests by disabling bundling (#1689)
* Speed up & deflake tests by disabling bundling

* Fix `go vet` and races detected

* Address @vagababov comments, add nil check
2020-09-18 16:34:45 -07:00
Zbynek Roubalik 2d4efecc6b
bump to k8s 1.18 (#1428)
* bump to k8s 1.18.8

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* plumbing ctx through

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* add more ctx plumbing

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* ctx WithCancel()

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-09-11 07:54:00 -07:00
Victor Agababov a291f58a60
Skip flaky tests (#1673) 2020-08-31 14:35:15 -07:00
Evan Anderson e487a47312
Use real synchronization to make sure we get four exports in the OpenCensus test (#1591)
* Use real synchronization to make sure we get four exports in the OpenCensus test.

* Fix a few bugs in the metrics implementation:

1. We could create two OpenCensus exporters for the empty resource, which would cause double-reporting
2. Add a mechanism to clear out background Meter threads to to prevent them exporting in subsequent tests.
2020-08-07 11:51:29 -07:00
Victor Agababov 7ea21a17b9
Make sure metrics tests are re-entrant (#1566)
* Make sure metrics tests are re-entrant
Currently they are not. 'go test -count=2' will miserably fail.
So ensure they are. Also add a helper to return current value.

* review
2020-07-28 14:52:59 -07:00
Evan Anderson deb6b33d2a
Make EnsureRecorded part of metricstest (#1554)
* Make EnsureRecorded part of metricstest; call it automatically in the "Assert" methods.

Increase test coverage.

* Address yanweiguo comments

* Add a barrier to ensure all metrics are recorded before scraping prometheus.
2020-07-27 08:45:58 -07:00
Evan Anderson c36f46cc8c
Wait longer for metrics collection to settle for OpenCensus (#1555) 2020-07-23 22:55:57 -07:00
Victor Agababov 6757bb169b
Some nits in the tests in effort to fix race (#1553)
which panics in a strange place (sync.waitgroup that disables race detection)
and other nits
2020-07-23 15:17:57 -07:00
jjzeng-seattle 03151bfc84
Add component name as the metric prefix for opencensus exporter (#1493)
* Add component name as the metric prefix for opencensus exporter

Read from all meters instead of just he default one

Add component name as the metric prefix for opencensus exporter

* Update codegen

* Add domain as metric prefix

* Use path.Join to simply the code
2020-07-20 14:10:36 -07:00
Markus Thömmes cb729b8ae6
Assorted linting fixes. (#1507)
- Remove unused code.
- Remove unnecessary conversion.
- Prevent copies of structs that contain sync.Mutex.
2020-07-16 05:59:33 -07:00
Evan Anderson 723b71fa47
Update Stackdriver custom exporter to support RecordBatch where some records are special and others are not. (#1495) 2020-07-15 10:05:33 -07:00
Evan Anderson e7bd895fbd
Introduce `pkg/metrics` support for multiple Resources (#1392)
* Update OpenCensus to include #1196.

* Extend OpenCensus to track per-Resource stats.

* Add generic ResourceView mechanics, part 1. TODO: wire newFactory, tests

* Move factory creation to where it can be customized per-backend

* Integrate opencensus export with Resource-based exporters

* Add stackdriver support for resource views

* address feedbacks

* add test cases

* make KnativeRevision a map

* Update go modules to point to latest opencensus which includes `view.Meter`.

* Add support for Resources to Prometheus Exporter.

This involved copying/improving much of the contrib prometheus exporter.

* add resource_view tests and fix minor issues

* add recorder tests for meter

* Update resource_view_test with an e2e export test.

* Fix prometheus e2e resource_view_test.

Found a fun circular lock.

Found a fun double-registration in metricproducer/Meter.

Found some unnecessary extra code.

Fixed prometheus string sanitization.

Removed a layer of Prometheus wrapping which made debugging more challenging.

* Add test for standard view exports and non-resourced views to e2e test.

* Add UnregisterResourceView to fix tests

* Add OpenCensus e2e resource export test.

Still a little flaky, so work around that with "<=".

* Fix tests for OpenCensus export.

* Fix flakiness / timing issues in OpenCensus exporter e2e test.

* Update to latest ocagent to fix `Resources` bug.

* Don't swallow errors from stackdriver init.

* Get Stackdriver export mostly working in e2e tests

Tests still fail because stackdriver converts custom metrics to a namespaced format and seems to lose Resource information.

* Add support for Stackdriver resource export.

* ./hack/update-codegen.sh

* Fix data race with graceful shutdown.

* Fix issues noticed by @vagababov

* Address mattmoor-bot comments.

* Remove MonitoredResource and apply suggestions from yanweiguo

* More cleanup to stackdriver_exporter_test.go

* Update tests (particularly config_test.go) for Stackdriver recorder changes which sometimes record with additional resources.

* Avoid setting two `view.WithRecorder` options on record

* Add stackdriver tests

* Address comments

* Switch Prometheus port due to possible conflict in test env

* Fix missing :=

* FIx data races around *view.Data shared across Meters.

Cleanup resource_view_test.

* Remove unneeded monitored_resources.go

* Use sync.WaitGroup to avoid data races on closing channel.

* Sort the map for ResourceAsString

* Apply lint and vagababov changes.

* Fix typos

* refactor ResourceAsString

* Update stackdriver exporter version

* Update metrics/resource_view_test.go

Remove accidental paste

* Fix go.sum

* Address yanweiguo comments on comments

* Fix autogen/go mod

* Handling resource extraction when custom metrics are allowed

* Add tests for AllowCustomMetrics set to true

* Address vagababov and yanweiguo comments.

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* address comments

* Renaming

* Reduce some condition nesting

* go fmt

* Sleep for 1ms to allow metrics being sent (#9)

* Address yanweiguo comments

Co-authored-by: JJ Zeng <jjzeng@google.com>
Co-authored-by: jjzeng-seattle <56568376+jjzeng-seattle@users.noreply.github.com>
2020-07-14 10:46:19 -07:00