Skip to content

Commit bf7fda3

Browse files
bigdefectM00nF1sh
andauthored
fix a few log statements from #164 (#169)
Co-authored-by: M00nF1sh <[email protected]>
1 parent 8167fdb commit bf7fda3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pkg/aws/cloudmap.go

+1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ func (c *Cloud) CloudMapGetService(ctx context.Context, serviceID string) (*Clou
167167

168168
// RegisterInstance calls AWS ServiceDiscovery RegisterInstance API
169169
func (c *Cloud) RegisterInstance(ctx context.Context, instanceID string, pod *corev1.Pod, cloudmapConfig *appmesh.AwsCloudMapServiceDiscovery) error {
170+
// FIXME we should only emit this if we're actually registering
170171
begin := time.Now()
171172
defer func() {
172173
c.stats.RecordOperationDuration("cloudmap", "instance", "register", time.Since(begin))

pkg/controller/pod.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (c *Controller) syncPod(ctx context.Context, pod *corev1.Pod) error {
247247
instanceID := awssdk.StringValue(instance.Id)
248248
serviceName := awssdk.StringValue(instance.Attributes[ctrlaws.AttrK8sApp])
249249

250-
klog.V(4).Info("Pod: %s is currently registered with the service: %s", podName, serviceName)
250+
klog.V(4).Infof("Pod: %s is currently registered with the service: %s", podName, serviceName)
251251
serviceInstanceSummary[instanceID] = true
252252
}
253253

@@ -266,14 +266,15 @@ func (c *Controller) syncPod(ctx context.Context, pod *corev1.Pod) error {
266266
serviceInstanceSummary = serviceItem.instanceSummary
267267
serviceInstanceSummary[pod.Status.PodIP] = true
268268
} else {
269-
klog.V(4).Info("Instance already %s registered under service %s", pod.Name, *cloudmapConfig.ServiceName)
269+
klog.V(4).Infof("Instance already %s registered under service %s", pod.Name, *cloudmapConfig.ServiceName)
270270
return nil
271271
}
272272
} else {
273273
serviceInstanceSummary[pod.Status.PodIP] = true
274274
}
275275

276-
klog.Info("Registering instance %s under service %s", pod.Name, *cloudmapConfig.ServiceName)
276+
// FIXME emitting this log is confusing when we might short-circuit in RegisterInstance
277+
klog.Infof("Registering instance %s under service %s", pod.Name, *cloudmapConfig.ServiceName)
277278
err = c.cloud.RegisterInstance(ctx, instanceID, pod, cloudmapConfig)
278279
if err != nil {
279280
return err
@@ -298,7 +299,7 @@ func (c *Controller) getServiceInstancesFromCloudMap(ctx context.Context,
298299
return instances, err
299300
}
300301

301-
klog.V(4).Info("Reach out to CloudMap for service: %s. Current Instance Count: ",
302+
klog.V(4).Infof("Reach out to CloudMap for service: %s. Current Instance Count: %d",
302303
*appmeshCloudMapConfig.ServiceName, len(instances))
303304
return instances, nil
304305
}

0 commit comments

Comments
 (0)