Skip to content

Commit e01a768

Browse files
authored
fix(BREV-2064): reduce noise from some logs (#56)
* fix(BREV-2064): reduce noise from some logs * feat(BREV-2064): lint
1 parent 7b15365 commit e01a768

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

v1/providers/shadeform/instance.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (c *ShadeformClient) GetInstance(ctx context.Context, instanceID v1.CloudPr
180180
return nil, errors.WrapAndTrace(fmt.Errorf("no instance returned from get request"))
181181
}
182182

183-
instance, err := c.convertInstanceInfoResponseToV1Instance(ctx, *resp)
183+
instance, err := c.convertInstanceInfoResponseToV1Instance(*resp)
184184
if err != nil {
185185
return nil, errors.WrapAndTrace(err)
186186
}
@@ -215,7 +215,7 @@ func (c *ShadeformClient) ListInstances(ctx context.Context, _ v1.ListInstancesA
215215

216216
var instances []v1.Instance
217217
for _, instance := range resp.Instances {
218-
singleInstance, err := c.convertShadeformInstanceToV1Instance(ctx, instance)
218+
singleInstance, err := c.convertShadeformInstanceToV1Instance(instance)
219219
if err != nil {
220220
return nil, errors.WrapAndTrace(err)
221221
}
@@ -257,8 +257,7 @@ func (c *ShadeformClient) getLifecycleStatus(status string) v1.LifecycleStatus {
257257
}
258258

259259
// convertInstanceInfoResponseToV1Instance - converts Instance Info to v1 instance
260-
func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(ctx context.Context, instanceInfo openapi.InstanceInfoResponse) (*v1.Instance, error) {
261-
c.logger.Debug(ctx, "converting instance info response to v1 instance", v1.LogField("instanceInfo", instanceInfo))
260+
func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(instanceInfo openapi.InstanceInfoResponse) (*v1.Instance, error) {
262261
instanceType := c.getInstanceType(string(instanceInfo.Cloud), instanceInfo.ShadeInstanceType)
263262
lifeCycleStatus := c.getLifecycleStatus(string(instanceInfo.Status))
264263

@@ -271,18 +270,15 @@ func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(ctx context.Co
271270
if !found {
272271
return nil, errors.WrapAndTrace(errors.New("could not find refID tag"))
273272
}
274-
c.logger.Debug(ctx, "refID found, deleting from tags", v1.LogField("refID", refID))
275273
delete(tags, refIDTagName)
276274

277275
cloudCredRefID, found := tags[cloudCredRefIDTagName]
278276
if !found {
279277
return nil, errors.WrapAndTrace(errors.New("could not find cloudCredRefID tag"))
280278
}
281-
c.logger.Debug(ctx, "cloudCredRefID found, deleting from tags", v1.LogField("cloudCredRefID", cloudCredRefID))
282279
delete(tags, cloudCredRefIDTagName)
283280

284281
diskSize := units.Base2Bytes(instanceInfo.Configuration.StorageInGb) * units.GiB
285-
c.logger.Debug(ctx, "calculated diskSize", v1.LogField("diskSize", diskSize), v1.LogField("storageInGb", instanceInfo.Configuration.StorageInGb))
286282

287283
instance := &v1.Instance{
288284
Name: c.getProvidedInstanceName(instanceInfo.Name),
@@ -314,8 +310,7 @@ func (c *ShadeformClient) convertInstanceInfoResponseToV1Instance(ctx context.Co
314310

315311
// convertInstanceInfoResponseToV1Instance - converts /instances response to v1 instance; the api struct is slightly
316312
// different from instance info response and expected to diverge so keeping it as a separate function for now
317-
func (c *ShadeformClient) convertShadeformInstanceToV1Instance(ctx context.Context, shadeformInstance openapi.Instance) (*v1.Instance, error) {
318-
c.logger.Debug(ctx, "converting shadeform instance to v1 instance", v1.LogField("shadeformInstance", shadeformInstance))
313+
func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance openapi.Instance) (*v1.Instance, error) {
319314
instanceType := c.getInstanceType(string(shadeformInstance.Cloud), shadeformInstance.ShadeInstanceType)
320315
lifeCycleStatus := c.getLifecycleStatus(string(shadeformInstance.Status))
321316

@@ -328,18 +323,15 @@ func (c *ShadeformClient) convertShadeformInstanceToV1Instance(ctx context.Conte
328323
if !found {
329324
return nil, errors.WrapAndTrace(errors.New("could not find refID tag"))
330325
}
331-
c.logger.Debug(ctx, "refID found, deleting from tags", v1.LogField("refID", refID))
332326
delete(tags, refIDTagName)
333327

334328
cloudCredRefID, found := tags[cloudCredRefIDTagName]
335329
if !found {
336330
return nil, errors.WrapAndTrace(errors.New("could not find cloudCredRefID tag"))
337331
}
338-
c.logger.Debug(ctx, "cloudCredRefID found, deleting from tags", v1.LogField("cloudCredRefID", cloudCredRefID))
339332
delete(tags, cloudCredRefIDTagName)
340333

341334
diskSize := units.Base2Bytes(shadeformInstance.Configuration.StorageInGb) * units.GiB
342-
c.logger.Debug(ctx, "calculated diskSize", v1.LogField("diskSize", diskSize), v1.LogField("storageInGb", shadeformInstance.Configuration.StorageInGb))
343335

344336
instance := &v1.Instance{
345337
Name: shadeformInstance.Name,

0 commit comments

Comments
 (0)