@@ -26,8 +26,12 @@ import (
2626 "github.com/knative/eventing/contrib/gcppubsub/pkg/util"
2727 eventingv1alpha1 "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
2828 "github.com/knative/eventing/pkg/provisioners"
29+ "github.com/knative/eventing/pkg/tracing"
30+ "github.com/knative/pkg/configmap"
2931 "github.com/knative/pkg/signals"
32+ "github.com/knative/pkg/system"
3033 "go.uber.org/zap"
34+ "k8s.io/client-go/kubernetes"
3135 "sigs.k8s.io/controller-runtime/pkg/client/config"
3236 "sigs.k8s.io/controller-runtime/pkg/manager"
3337 "sigs.k8s.io/controller-runtime/pkg/reconcile"
@@ -59,6 +63,13 @@ func main() {
5963 logger .Fatal ("Error adding the eventingv1alpha1 scheme" , zap .Error (err ))
6064 }
6165
66+ // Zipkin tracing.
67+ kc := kubernetes .NewForConfigOrDie (mgr .GetConfig ())
68+ configMapWatcher := configmap .NewInformedWatcher (kc , system .Namespace ())
69+ if err = tracing .SetupDynamicZipkinPublishing (logger , configMapWatcher , "gcp-pubsub-dispatcher" ); err != nil {
70+ logger .Fatal ("Error setting up Zipkin publishing" , zap .Error (err ))
71+ }
72+
6273 // We are running both the receiver (takes messages in from the cluster and writes them to
6374 // PubSub) and the dispatcher (takes messages in PubSub and sends them in cluster) in this
6475 // binary.
@@ -88,6 +99,11 @@ func main() {
8899 // set up signals so we handle the first shutdown signal gracefully
89100 stopCh := signals .SetupSignalHandler ()
90101
102+ // configMapWatcher does not block, so start it first.
103+ if err = configMapWatcher .Start (stopCh ); err != nil {
104+ logger .Fatal ("Failed to start ConfigMap watcher" , zap .Error (err ))
105+ }
106+
91107 // Start blocks forever.
92108 logger .Info ("Manager starting..." )
93109 err = mgr .Start (stopCh )
0 commit comments