Copilot commented on code in PR #1340:
URL: https://github.com/apache/dubbo-admin/pull/1340#discussion_r2446455105


##########
pkg/diagnostics/server.go:
##########
@@ -79,31 +76,30 @@ func (s *diagnosticsServer) Start(_ runtime.Runtime, stop 
<-chan struct{}) error
                Addr:              fmt.Sprintf(":%d", s.config.ServerPort),
                Handler:           mux,
                ReadHeaderTimeout: time.Second,
-               ErrorLog:          adapter.ToStd(diagnosticsServerLog),
        }
 
-       diagnosticsServerLog.Info("starting diagnostic server", "interface", 
"0.0.0.0", "port", s.config.ServerPort)
+       logger.Infof("starting diagnostic server, endpoint: 0.0.0.0: %d", 
s.config.ServerPort)

Review Comment:
   The log message format is inconsistent. The colon after '0.0.0.0' should be 
removed or the format should use '%s:%d' pattern for clarity.
   ```suggestion
        logger.Infof("starting diagnostic server, endpoint: %s:%d", "0.0.0.0", 
s.config.ServerPort)
   ```



##########
pkg/core/engine/subscriber/runtime_instance.go:
##########
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 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 subscriber
+
+import (
+       "errors"
+       "reflect"
+
+       "github.com/duke-git/lancet/v2/strutil"
+       "k8s.io/client-go/tools/cache"
+
+       "github.com/apache/dubbo-admin/pkg/common/bizerror"
+       "github.com/apache/dubbo-admin/pkg/core/events"
+       "github.com/apache/dubbo-admin/pkg/core/logger"
+       meshresource 
"github.com/apache/dubbo-admin/pkg/core/resource/apis/mesh/v1alpha1"
+       coremodel "github.com/apache/dubbo-admin/pkg/core/resource/model"
+       "github.com/apache/dubbo-admin/pkg/core/store"
+       "github.com/apache/dubbo-admin/pkg/core/store/index"
+)
+
+type RuntimeInstanceEventSubscriber struct {
+       instanceResourceStore store.ResourceStore
+       eventEmitter          events.Emitter
+}
+
+func (s *RuntimeInstanceEventSubscriber) ResourceKind() coremodel.ResourceKind 
{
+       return meshresource.RuntimeInstanceKind
+}
+
+func (s *RuntimeInstanceEventSubscriber) Name() string {
+       return "Engine-" + s.ResourceKind().ToString()
+}
+
+func (s *RuntimeInstanceEventSubscriber) ProcessEvent(event events.Event) 
error {
+       newObj, ok := event.NewObj().(*meshresource.RuntimeInstanceResource)
+       if !ok && newObj != nil {
+               return 
bizerror.NewAssertionError(meshresource.RuntimeInstanceKind, 
reflect.TypeOf(event.NewObj()).Name())
+       }
+       oldObj, ok := event.OldObj().(*meshresource.RuntimeInstanceResource)
+       if !ok && oldObj != nil {
+               return 
bizerror.NewAssertionError(meshresource.RuntimeInstanceKind, 
reflect.TypeOf(event.OldObj()).Name())
+       }
+       var processErr error
+       switch event.Type() {
+       case cache.Added, cache.Updated, cache.Replaced, cache.Sync:
+               if newObj == nil {
+                       errStr := "process runtime instance upsert event, but 
new obj is nil, skipped processing"
+                       logger.Error(errStr)
+                       return errors.New(errStr)
+               }
+               processErr = s.processUpsert(newObj)
+       case cache.Deleted:
+               if oldObj == nil {
+                       errStr := "process runtime instance delete event, but 
old obj is nil, skipped processing"
+                       logger.Error(errStr)
+                       return errors.New(errStr)
+               }
+               processErr = s.processDelete(oldObj)
+       }
+       eventStr := event.String()
+       if processErr != nil {

Review Comment:
   The condition on line 76 is inverted. Success logging should occur when 
`processErr == nil`, and error logging when `processErr != nil`.
   ```suggestion
        if processErr == nil {
   ```



##########
pkg/core/engine/subscriber/runtime_instance.go:
##########
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 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 subscriber
+
+import (
+       "errors"
+       "reflect"
+
+       "github.com/duke-git/lancet/v2/strutil"
+       "k8s.io/client-go/tools/cache"
+
+       "github.com/apache/dubbo-admin/pkg/common/bizerror"
+       "github.com/apache/dubbo-admin/pkg/core/events"
+       "github.com/apache/dubbo-admin/pkg/core/logger"
+       meshresource 
"github.com/apache/dubbo-admin/pkg/core/resource/apis/mesh/v1alpha1"
+       coremodel "github.com/apache/dubbo-admin/pkg/core/resource/model"
+       "github.com/apache/dubbo-admin/pkg/core/store"
+       "github.com/apache/dubbo-admin/pkg/core/store/index"
+)
+
+type RuntimeInstanceEventSubscriber struct {
+       instanceResourceStore store.ResourceStore
+       eventEmitter          events.Emitter
+}
+
+func (s *RuntimeInstanceEventSubscriber) ResourceKind() coremodel.ResourceKind 
{
+       return meshresource.RuntimeInstanceKind
+}
+
+func (s *RuntimeInstanceEventSubscriber) Name() string {
+       return "Engine-" + s.ResourceKind().ToString()
+}
+
+func (s *RuntimeInstanceEventSubscriber) ProcessEvent(event events.Event) 
error {
+       newObj, ok := event.NewObj().(*meshresource.RuntimeInstanceResource)
+       if !ok && newObj != nil {
+               return 
bizerror.NewAssertionError(meshresource.RuntimeInstanceKind, 
reflect.TypeOf(event.NewObj()).Name())
+       }
+       oldObj, ok := event.OldObj().(*meshresource.RuntimeInstanceResource)
+       if !ok && oldObj != nil {
+               return 
bizerror.NewAssertionError(meshresource.RuntimeInstanceKind, 
reflect.TypeOf(event.OldObj()).Name())
+       }
+       var processErr error
+       switch event.Type() {
+       case cache.Added, cache.Updated, cache.Replaced, cache.Sync:
+               if newObj == nil {
+                       errStr := "process runtime instance upsert event, but 
new obj is nil, skipped processing"
+                       logger.Error(errStr)
+                       return errors.New(errStr)
+               }
+               processErr = s.processUpsert(newObj)
+       case cache.Deleted:
+               if oldObj == nil {
+                       errStr := "process runtime instance delete event, but 
old obj is nil, skipped processing"
+                       logger.Error(errStr)
+                       return errors.New(errStr)
+               }
+               processErr = s.processDelete(oldObj)
+       }
+       eventStr := event.String()
+       if processErr != nil {
+               logger.Infof("process runtime instance event successfully, 
event: %s", eventStr)
+       } else {
+               logger.Errorf("process runtime instance event failed, event: 
%s, err: %s", eventStr, processErr.Error())
+       }
+       return processErr
+}
+
+func (s *RuntimeInstanceEventSubscriber) getRelatedInstanceResource(
+       rtInstance *meshresource.RuntimeInstanceResource) 
(*meshresource.InstanceResource, error) {
+       resources, err := 
s.instanceResourceStore.ListByIndexes(map[string]string{
+               index.ByInstanceIpIndex: rtInstance.Spec.Ip,
+       })
+       if err != nil {
+               return nil, err
+       }
+       if len(resources) == 0 {
+               return nil, nil
+       }
+       instanceResources := make([]*meshresource.InstanceResource, 
len(resources))
+       for i, item := range resources {
+               if res, ok := item.(*meshresource.InstanceResource); ok {
+                       instanceResources[i] = res
+               } else {
+                       return nil, 
bizerror.NewAssertionError("InstanceResource", reflect.TypeOf(item).Name())
+               }
+       }
+       return instanceResources[0], nil
+}
+
+func (s *RuntimeInstanceEventSubscriber) mergeRuntimeInstance(
+       instanceRes *meshresource.InstanceResource,
+       rtInstanceRes *meshresource.RuntimeInstanceResource) {
+       instanceRes.Name = rtInstanceRes.Name
+       instanceRes.Spec.Name = rtInstanceRes.Spec.Name
+       instanceRes.Spec.Ip = rtInstanceRes.Spec.Ip
+       instanceRes.Labels = rtInstanceRes.Labels
+       instanceRes.Spec.Image = rtInstanceRes.Spec.Image
+       instanceRes.Spec.CreateTime = rtInstanceRes.Spec.CreateTime
+       instanceRes.Spec.StartTime = rtInstanceRes.Spec.StartTime
+       instanceRes.Spec.ReadyTime = rtInstanceRes.Spec.ReadyTime
+       instanceRes.Spec.DeployState = rtInstanceRes.Spec.Phase
+       instanceRes.Spec.WorkloadType = rtInstanceRes.Spec.WorkloadType
+       instanceRes.Spec.WorkloadName = rtInstanceRes.Spec.WorkloadName
+       instanceRes.Spec.Node = rtInstanceRes.Spec.Node
+       instanceRes.Spec.Probes = rtInstanceRes.Spec.Probes
+       instanceRes.Spec.Conditions = rtInstanceRes.Spec.Conditions
+}
+
+func (s *RuntimeInstanceEventSubscriber) fromRuntimeInstance(
+       rtInstanceRes *meshresource.RuntimeInstanceResource) 
*meshresource.InstanceResource {
+       instanceRes := 
meshresource.NewInstanceResourceWithAttributes(rtInstanceRes.Mesh, 
rtInstanceRes.Name)

Review Comment:
   Arguments appear to be reversed. Based on the function signature, the order 
should be `name, mesh`, not `mesh, name`.
   ```suggestion
        instanceRes := 
meshresource.NewInstanceResourceWithAttributes(rtInstanceRes.Name, 
rtInstanceRes.Mesh)
   ```



##########
app/dubbo-admin/dubbo-admin.yaml:
##########
@@ -39,17 +39,55 @@ console:
 store:
   type: memory
 discovery:
-  - type: nacos
-    id: nacos-44.33
-    address:
-      registry: nacos://47.76.94.134:8848?username=nacos&password=nacos
-      configCenter: nacos://47.76.94.134:8848?username=nacos&password=nacos
-      metadataReport: nacos://47.76.94.134:8848?username=nacos&password=nacos
-  - type: istio
+#  - type: nacos
+#    id: nacos-44.33
+#    address:
+#      registry: nacos://47.76.94.134:8848?username=nacos&password=nacos
+#      configCenter: nacos://47.76.94.134:8848?username=nacos&password=nacos
+#      metadataReport: nacos://47.76.94.134:8848?username=nacos&password=nacos
+  # mock discovery is only for development
+  - type: mock
 engine:
   name: k8s1.28.6
   type: kubernetes
   properties:
-    apiServerAddress: https://192.168.1.1:6443
-    kubeConfig: /etc/kubernetes/admin.conf
+    # [Kubernetes] Path to kubernetes config file, if not set, will use in 
cluster config
+    kubeConfigPath: /root/.kube/config
+    # [Kubernetes] Watch pods with specified labels, if not set, will watch 
all pods
+    # podWatchSelector: org.apache.dubbo/dubbo-apps=true
+    # [Kubernetes] Identify which Dubbo app the pod belongs to, if not set, 
[type = ByIP] will be used
+    # 1. ByLabels: Use the label value corresponding to the labelKey as the 
dubbo app name
+    # e.g.
+    #    type: ByLabel
+    #    labelKey: org.apache.dubbo/dubbo-app-name
+    # 2. ByAnnotation: Use the annotation value corresponding to the 
annotationKey as the dubbo app name
+    # e.g.
+    #    type: ByAnnotation
+    #    annotationKey: org.apache.dubbo/dubbo-app-name
+    # 3. ByIP(default): Use pod's IP to find if there is a same ip of an 
instance and use the instance's app name as the identifier,
+    # if there is no such association, the pod will not be seen as a pod of 
dubbo application.
+    # e.g.
+    #    type: ByIP
+#    dubboAppIdentifier:
+#      type: ByLabels

Review Comment:
   Inconsistency in documentation: line 62 mentions 'ByLabel' but line 72 uses 
'ByLabels'. The identifier type should be consistent with the code 
implementation.
   ```suggestion
   #      type: ByLabel
   ```



##########
pkg/diagnostics/server.go:
##########
@@ -79,31 +76,30 @@ func (s *diagnosticsServer) Start(_ runtime.Runtime, stop 
<-chan struct{}) error
                Addr:              fmt.Sprintf(":%d", s.config.ServerPort),
                Handler:           mux,
                ReadHeaderTimeout: time.Second,
-               ErrorLog:          adapter.ToStd(diagnosticsServerLog),
        }
 
-       diagnosticsServerLog.Info("starting diagnostic server", "interface", 
"0.0.0.0", "port", s.config.ServerPort)
+       logger.Infof("starting diagnostic server, endpoint: 0.0.0.0: %d", 
s.config.ServerPort)
        errChan := make(chan error)
        go func() {
                defer close(errChan)
                var err error
                err = httpServer.ListenAndServe()
                if err != nil {
-                       switch err {
-                       case http.ErrServerClosed:
-                               diagnosticsServerLog.Info("shutting down 
server")
+                       switch {
+                       case errors.Is(err, http.ErrServerClosed):
+                               logger.Errorf("diagnotics http server closed, 
err: %s", err)
                        default:
-                               diagnosticsServerLog.Error(err, "could not 
start HTTP Server")
+                               logger.Error("could not start diagnotics http 
Server, unknown err: %s", err)
                                errChan <- err
                        }
                        return
                }
-               diagnosticsServerLog.Info("terminated normally")
+               logger.Info("terminated normally")
        }()
 
        select {
        case <-stop:
-               diagnosticsServerLog.Info("stopping")
+               logger.Info("received stop signal, stopping diagnotics server 
...")

Review Comment:
   Corrected spelling of 'diagnotics' to 'diagnostics'.
   ```suggestion
                logger.Info("received stop signal, stopping diagnostics server 
...")
   ```



##########
pkg/diagnostics/server.go:
##########
@@ -79,31 +76,30 @@ func (s *diagnosticsServer) Start(_ runtime.Runtime, stop 
<-chan struct{}) error
                Addr:              fmt.Sprintf(":%d", s.config.ServerPort),
                Handler:           mux,
                ReadHeaderTimeout: time.Second,
-               ErrorLog:          adapter.ToStd(diagnosticsServerLog),
        }
 
-       diagnosticsServerLog.Info("starting diagnostic server", "interface", 
"0.0.0.0", "port", s.config.ServerPort)
+       logger.Infof("starting diagnostic server, endpoint: 0.0.0.0: %d", 
s.config.ServerPort)
        errChan := make(chan error)
        go func() {
                defer close(errChan)
                var err error
                err = httpServer.ListenAndServe()
                if err != nil {
-                       switch err {
-                       case http.ErrServerClosed:
-                               diagnosticsServerLog.Info("shutting down 
server")
+                       switch {
+                       case errors.Is(err, http.ErrServerClosed):
+                               logger.Errorf("diagnotics http server closed, 
err: %s", err)
                        default:
-                               diagnosticsServerLog.Error(err, "could not 
start HTTP Server")
+                               logger.Error("could not start diagnotics http 
Server, unknown err: %s", err)

Review Comment:
   Corrected spelling of 'diagnotics' to 'diagnostics'.



##########
pkg/engine/kubernetes/engine.go:
##########
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 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 kubernetes
+
+import (
+       "fmt"
+       "reflect"
+
+       "github.com/duke-git/lancet/v2/slice"
+       "github.com/duke-git/lancet/v2/strutil"
+       v1 "k8s.io/api/core/v1"
+       metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+       "k8s.io/apimachinery/pkg/fields"
+       k8sruntime "k8s.io/apimachinery/pkg/runtime"
+       "k8s.io/apimachinery/pkg/watch"
+       "k8s.io/client-go/kubernetes"
+       "k8s.io/client-go/tools/cache"
+
+       meshproto "github.com/apache/dubbo-admin/api/mesh/v1alpha1"
+       "github.com/apache/dubbo-admin/pkg/common/bizerror"
+       enginecfg "github.com/apache/dubbo-admin/pkg/config/engine"
+       "github.com/apache/dubbo-admin/pkg/core/consts"
+       "github.com/apache/dubbo-admin/pkg/core/controller"
+       "github.com/apache/dubbo-admin/pkg/core/logger"
+       meshresource 
"github.com/apache/dubbo-admin/pkg/core/resource/apis/mesh/v1alpha1"
+       coremodel "github.com/apache/dubbo-admin/pkg/core/resource/model"
+)
+
+type PodListerWatcher struct {
+       cfg *enginecfg.Config
+       lw  cache.ListerWatcher
+}
+
+var _ controller.ResourceListerWatcher = &PodListerWatcher{}
+
+func NewPodListWatcher(clientset *kubernetes.Clientset, cfg *enginecfg.Config) 
(*PodListerWatcher, error) {
+       var selector fields.Selector
+       s := cfg.Properties.PodWatchSelector
+       if strutil.IsBlank(s) {
+               selector = fields.Everything()
+       }
+       selector, err := fields.ParseSelector(s)
+       if err != nil {
+               return nil, fmt.Errorf("parse selector %s failed: %v", s, err)
+       }
+       lw := cache.NewListWatchFromClient(
+               clientset.CoreV1().RESTClient(),
+               "pods",
+               metav1.NamespaceAll,
+               selector,
+       )
+       return &PodListerWatcher{
+               cfg: cfg,
+               lw:  lw,
+       }, nil
+}
+
+func (p *PodListerWatcher) List(options metav1.ListOptions) 
(k8sruntime.Object, error) {
+       return p.lw.List(options)
+}
+
+func (p *PodListerWatcher) Watch(options metav1.ListOptions) (watch.Interface, 
error) {
+       return p.lw.Watch(options)
+}
+
+func (p *PodListerWatcher) ResourceKind() coremodel.ResourceKind {
+       return meshresource.RuntimeInstanceKind
+}
+
+func (p *PodListerWatcher) TransformFunc() cache.TransformFunc {
+       return func(obj interface{}) (interface{}, error) {
+               pod, ok := obj.(*v1.Pod)
+               if !ok {
+                       objType := reflect.TypeOf(obj).Name()
+                       logger.Errorf("cannot transform %s to Pod", objType)
+                       return nil, bizerror.NewAssertionError("Pod", objType)
+               }
+               mainContainer := p.getMainContainer(pod)
+               appName := p.getDubboAppName(pod)
+               var startTime string
+               if pod.Status.StartTime != nil {
+                       startTime = 
pod.Status.StartTime.Format(consts.TimeFormatStr)
+               }
+               createTime := pod.CreationTimestamp.Format(consts.TimeFormatStr)
+               readyTime := ""
+               slice.ForEach(pod.Status.Conditions, func(_ int, c 
v1.PodCondition) {
+                       if c.Type == v1.PodReady && c.Status == 
v1.ConditionTrue {
+                               readyTime = 
c.LastTransitionTime.Format(consts.TimeFormatStr)
+                       }
+               })
+               phase := string(pod.Status.Phase)
+               if pod.DeletionTimestamp != nil {
+                       phase = meshproto.InstanceTerminating
+               }
+               var workloadName string
+               var workloadType string
+               if len(pod.GetOwnerReferences()) > 0 {
+                       workloadName = pod.GetOwnerReferences()[0].Name
+                       workloadType = pod.GetOwnerReferences()[0].Kind
+               }
+               conditions := slice.Map(pod.Status.Conditions, func(_ int, c 
v1.PodCondition) *meshproto.Condition {
+                       return &meshproto.Condition{
+                               Type:               string(c.Type),
+                               Status:             string(c.Status),
+                               LastTransitionTime: 
c.LastTransitionTime.Format(consts.TimeFormatStr),
+                               Reason:             c.Reason,
+                               Message:            c.Message,
+                       }
+               })
+               var image string
+               probes := make([]*meshproto.Probe, 0)
+               if mainContainer != nil {
+                       image = mainContainer.Image
+                       if mainContainer.LivenessProbe != nil {
+                               port := 
p.getProbePort(mainContainer.LivenessProbe)
+                               probes = append(probes, &meshproto.Probe{
+                                       Type: meshproto.LivenessProbe,
+                                       Port: port,
+                               })
+                       }
+                       if mainContainer.ReadinessProbe != nil {
+                               port := 
p.getProbePort(mainContainer.ReadinessProbe)
+                               probes = append(probes, &meshproto.Probe{
+                                       Type: meshproto.ReadinessProbe,
+                                       Port: port,
+                               })
+                       }
+                       if mainContainer.StartupProbe != nil {
+                               port := 
p.getProbePort(mainContainer.StartupProbe)
+                               probes = append(probes, &meshproto.Probe{
+                                       Type: meshproto.StartupProbe,
+                                       Port: port,
+                               })
+                       }
+               }
+               res := 
meshresource.NewRuntimeInstanceResourceWithAttributes(pod.Name, "default")
+               res.Spec = &meshproto.RuntimeInstance{
+                       Name:         pod.Name,
+                       Ip:           pod.Status.PodIP,
+                       Image:        image,
+                       AppName:      appName,
+                       CreateTime:   createTime,
+                       StartTime:    startTime,
+                       ReadyTime:    readyTime,
+                       Phase:        phase,
+                       WorkloadName: workloadName,
+                       WorkloadType: workloadType,
+                       Node:         pod.Spec.NodeName,
+                       Probes:       probes,
+                       Conditions:   conditions,
+               }
+               return res, nil
+       }
+}
+
+func (p *PodListerWatcher) getMainContainer(pod *v1.Pod) *v1.Container {
+       containers := pod.Spec.Containers
+       strategy := p.cfg.Properties.GetOrDefaultMainContainerChooseStrategy()
+       switch strategy.Type {
+       case enginecfg.ChooseByLast:
+               return &containers[len(containers)-1]
+       case enginecfg.ChooseByIndex:
+               return &containers[strategy.Index]
+       case enginecfg.ChooseByName:
+               c, ok := slice.FindBy[v1.Container](containers, func(_ int, c 
v1.Container) bool {
+                       return c.Name == strategy.Name
+               })
+               if !ok {
+                       logger.Warnf("pod %s has no container named %s, cannot 
retrieve the correct main container",
+                               pod.Name, strategy.Name)
+                       return nil
+               }
+               return &c
+       case enginecfg.ChooseByAnnotation:
+               value, exists := pod.Annotations[strategy.AnnotationKey]
+               if !exists {
+                       logger.Warnf("pod %s has no annotaion %s, cannot 
retrieve the correct main container",

Review Comment:
   Corrected spelling of 'annotaion' to 'annotation'.
   ```suggestion
                        logger.Warnf("pod %s has no annotation %s, cannot 
retrieve the correct main container",
   ```



##########
pkg/diagnostics/server.go:
##########
@@ -79,31 +76,30 @@ func (s *diagnosticsServer) Start(_ runtime.Runtime, stop 
<-chan struct{}) error
                Addr:              fmt.Sprintf(":%d", s.config.ServerPort),
                Handler:           mux,
                ReadHeaderTimeout: time.Second,
-               ErrorLog:          adapter.ToStd(diagnosticsServerLog),
        }
 
-       diagnosticsServerLog.Info("starting diagnostic server", "interface", 
"0.0.0.0", "port", s.config.ServerPort)
+       logger.Infof("starting diagnostic server, endpoint: 0.0.0.0: %d", 
s.config.ServerPort)
        errChan := make(chan error)
        go func() {
                defer close(errChan)
                var err error
                err = httpServer.ListenAndServe()
                if err != nil {
-                       switch err {
-                       case http.ErrServerClosed:
-                               diagnosticsServerLog.Info("shutting down 
server")
+                       switch {
+                       case errors.Is(err, http.ErrServerClosed):
+                               logger.Errorf("diagnotics http server closed, 
err: %s", err)

Review Comment:
   Corrected spelling of 'diagnotics' to 'diagnostics'.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to