Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions cmd/broker/filter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ var (
)

const (
component = "broker_filter"
defaultMetricsPort = 9092
component = "broker_filter"
)

type envConfig struct {
Expand Down Expand Up @@ -103,7 +104,14 @@ func main() {
// Watch the logging config map and dynamically update logging levels.
configMapWatcher := configmap.NewInformedWatcher(kubeClient, system.Namespace())
// Watch the observability config map and dynamically update metrics exporter.
configMapWatcher.Watch(metrics.ConfigMapName(), metrics.UpdateExporterFromConfigMap(component, sl))
updateFunc, err := metrics.UpdateExporterFromConfigMapWithOpts(metrics.ExporterOptions{
Component: component,
PrometheusPort: defaultMetricsPort,
}, sl)
if err != nil {
logger.Fatal("Failed to create metrics exporter update function", zap.Error(err))
}
configMapWatcher.Watch(metrics.ConfigMapName(), updateFunc)
// TODO change the component name to broker once Stackdriver metrics are approved.
// Watch the observability config map and dynamically update request logs.
configMapWatcher.Watch(logging.ConfigMapName(), logging.UpdateLevelFromConfigMap(sl, atomicLevel, component))
Expand Down
10 changes: 9 additions & 1 deletion cmd/broker/ingress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const (
defaultMaxIdleConnections = 1000
defaultMaxIdleConnectionsPerHost = 1000
defaultTTL int32 = 255
defaultMetricsPort = 9092
component = "broker_ingress"
)

Expand Down Expand Up @@ -120,7 +121,14 @@ func main() {
// Watch the logging config map and dynamically update logging levels.
configMapWatcher := configmap.NewInformedWatcher(kubeclient.Get(ctx), system.Namespace())
// Watch the observability config map and dynamically update metrics exporter.
configMapWatcher.Watch(metrics.ConfigMapName(), metrics.UpdateExporterFromConfigMap(component, sl))
updateFunc, err := metrics.UpdateExporterFromConfigMapWithOpts(metrics.ExporterOptions{
Component: component,
PrometheusPort: defaultMetricsPort,
}, sl)
if err != nil {
logger.Fatal("Failed to create metrics exporter update function", zap.Error(err))
}
configMapWatcher.Watch(metrics.ConfigMapName(), updateFunc)
// TODO change the component name to broker once Stackdriver metrics are approved.
// Watch the observability config map and dynamically update request logs.
configMapWatcher.Watch(logging.ConfigMapName(), logging.UpdateLevelFromConfigMap(sl, atomicLevel, component))
Expand Down
2 changes: 2 additions & 0 deletions vendor/knative.dev/pkg/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions vendor/knative.dev/pkg/reconciler/retry.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Copyright 2020 The Knative Authors
Licensed under the Apache License, Veroute.on 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package reconciler

import (
"k8s.io/client-go/util/retry"
)

// RetryUpdateConflicts retries the inner function if it returns conflict errors.
// This can be used to retry status updates without constantly reenqueuing keys.
func RetryUpdateConflicts(updater func(int) error) error {
attempts := 0
return retry.RetryOnConflict(retry.DefaultRetry, func() error {
err := updater(attempts)
attempts++
return err
})
}