Add a passthrough method RegisterResourceView (#1410)

* Add a passthrough method RegisterResourceView

* gofmt

* Update metrics/exporter.go

Co-authored-by: Evan Anderson <evan.k.anderson@gmail.com>

* Address comments

Co-authored-by: Evan Anderson <evan.k.anderson@gmail.com>
This commit is contained in:
jjzeng-seattle 2020-06-16 10:58:24 -07:00 committed by GitHub
parent d289d2eef6
commit e366b8278b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -85,6 +85,26 @@ func UpdateExporterFromConfigMap(component string, logger *zap.SugaredLogger) fu
return ConfigMapWatcher(component, nil, logger)
}
// RegisterResourceView is similar to view.Register(), except that it will
// register the view across all Resources tracked by the system, rather than
// simply the default view.
// this is a placeholder for real implementation in https://github.com/knative/pkg/pull/1392.
// That PR will introduce a breaking change, as we need to convert some view.Register to RegisterResourceView in
// all callers, in serving, eventing, and eventing-contrib.
// Since that PR is huge, a better approach is to introduce the breaking change up front, by creating this
// passthrough method, and fixing all the callers before merging that PR.
func RegisterResourceView(views ...*view.View) error {
return view.Register(views...)
}
// UnregisterResourceView is similar to view.unRegister(), except that it will
// unregister the view across all Resources tracked by the system, rather than
// simply the default view.
// this is a placeholder for real implementation in https://github.com/knative/pkg/pull/1392.
func UnregisterResourceView(views ...*view.View) {
view.Unregister(views...)
}
// ConfigMapWatcher returns a helper func which updates the exporter configuration based on
// values in the supplied ConfigMap. This method captures a corev1.SecretLister which is used
// to configure mTLS with the opencensus agent.