diff --git a/cmd/broker/filter/main.go b/cmd/broker/filter/main.go index 59eb6701f8e..5bb7e1f5cc3 100644 --- a/cmd/broker/filter/main.go +++ b/cmd/broker/filter/main.go @@ -45,8 +45,7 @@ import ( ) const ( - defaultMetricsPort = 9092 - component = "mt_broker_filter" + component = "mt_broker_filter" ) type envConfig struct { @@ -91,14 +90,7 @@ 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. - updateFunc, err := metrics.UpdateExporterFromConfigMapWithOpts(ctx, 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) + configMapWatcher.Watch(metrics.ConfigMapName(), metrics.ConfigMapWatcher(ctx, component, nil, sl)) // 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)) diff --git a/cmd/broker/ingress/main.go b/cmd/broker/ingress/main.go index 59c39508a4b..ccc9ba70ff4 100644 --- a/cmd/broker/ingress/main.go +++ b/cmd/broker/ingress/main.go @@ -56,7 +56,6 @@ const ( // based on what serving is doing. See https://github.com/knative/serving/blob/main/pkg/network/transports.go. defaultMaxIdleConnections = 1000 defaultMaxIdleConnectionsPerHost = 1000 - defaultMetricsPort = 9092 component = "mt_broker_ingress" ) @@ -106,14 +105,7 @@ 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. - updateFunc, err := metrics.UpdateExporterFromConfigMapWithOpts(ctx, 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) + configMapWatcher.Watch(metrics.ConfigMapName(), metrics.ConfigMapWatcher(ctx, component, nil, sl)) // 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)) diff --git a/config/brokers/mt-channel-broker/deployments/broker-filter.yaml b/config/brokers/mt-channel-broker/deployments/broker-filter.yaml index 34f9d7b01d6..3197af17c4a 100644 --- a/config/brokers/mt-channel-broker/deployments/broker-filter.yaml +++ b/config/brokers/mt-channel-broker/deployments/broker-filter.yaml @@ -55,7 +55,7 @@ spec: - containerPort: 8080 name: http protocol: TCP - - containerPort: 9092 + - containerPort: 9090 name: metrics protocol: TCP terminationMessagePath: /dev/termination-log @@ -104,8 +104,8 @@ spec: protocol: TCP targetPort: 8080 - name: http-metrics - port: 9092 + port: 9090 protocol: TCP - targetPort: 9092 + targetPort: 9090 selector: eventing.knative.dev/brokerRole: filter diff --git a/config/brokers/mt-channel-broker/deployments/broker-ingress.yaml b/config/brokers/mt-channel-broker/deployments/broker-ingress.yaml index ee7ee314e8e..a76ed988d69 100644 --- a/config/brokers/mt-channel-broker/deployments/broker-ingress.yaml +++ b/config/brokers/mt-channel-broker/deployments/broker-ingress.yaml @@ -55,7 +55,7 @@ spec: - containerPort: 8080 name: http protocol: TCP - - containerPort: 9092 + - containerPort: 9090 name: metrics protocol: TCP terminationMessagePath: /dev/termination-log @@ -104,8 +104,8 @@ spec: protocol: TCP targetPort: 8080 - name: http-metrics - port: 9092 + port: 9090 protocol: TCP - targetPort: 9092 + targetPort: 9090 selector: eventing.knative.dev/brokerRole: ingress