cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Add logs to the listLoadBalancerRuleInstances API

Open joseflauzino opened this issue 2 years ago • 25 comments

Description

Currently, the listLoadBalancerRuleInstances API has no logs, which makes troubleshooting harder. This PR aims to add several logs with context on the processing performed by this API. This will allow cloud operators to better analyze possible errors or inconsistencies that may occur when using the API.

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] Enhancement (improves an existing feature and functionality)
  • [ ] Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [x] Minor

How Has This Been Tested?

I performed different calls to the listLoadBalancerRuleInstances API and could notice that the processes were logged correctly.

joseflauzino avatar May 04 '22 12:05 joseflauzino

@blueorangutan package

joseflauzino avatar May 04 '22 17:05 joseflauzino

@joseflauzino a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar May 04 '22 17:05 blueorangutan

Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 3350

blueorangutan avatar May 04 '22 17:05 blueorangutan

Found UI changes, kicking a new UI QA build @blueorangutan ui

acs-robot avatar May 12 '22 12:05 acs-robot

@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

blueorangutan avatar May 12 '22 12:05 blueorangutan

UI build: :heavy_check_mark: Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/6357 (SL-JID-1566)

blueorangutan avatar May 12 '22 12:05 blueorangutan

Found UI changes, kicking a new UI QA build @blueorangutan ui

acs-robot avatar May 12 '22 13:05 acs-robot

@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

blueorangutan avatar May 12 '22 13:05 blueorangutan

UI build: :heavy_check_mark: Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/6357 (SL-JID-1567)

blueorangutan avatar May 12 '22 13:05 blueorangutan

@blueorangutan package

joseflauzino avatar May 13 '22 16:05 joseflauzino

@joseflauzino a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar May 13 '22 16:05 blueorangutan

Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 3405

blueorangutan avatar May 13 '22 17:05 blueorangutan

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

github-actions[bot] avatar Aug 08 '22 12:08 github-actions[bot]

@blueorangutan package

joseflauzino avatar Aug 15 '22 14:08 joseflauzino

@joseflauzino a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar Aug 15 '22 14:08 blueorangutan

Hi @DaanHoogland, sorry for the delay in responding.

Regarding your suggested code changes: In these particular code snippets, I have a preference for not using the isDebugEnabled() check.

The main reason is that this check can provide a significant performance improvement only when the message construction is very costly, which I don't think is the case. In these snippets, the messages are built by the concatenation of strings (no need for expensive calculations or processing).

Also, if the logger is enabled at the debug level, it incurs the cost of evaluating whether the logger is enabled or not twice: once in isDebugEnabled() and once in debug(). Since it is very common for ACS users to leave the logger enabled for the debug level (because of the useful messages for troubleshoting), I don't think it is worth doing this check (especially with simple strings).

joseflauzino avatar Aug 15 '22 14:08 joseflauzino

Codecov Report

Merging #6357 (5f6d685) into main (adfaa73) will increase coverage by 0.00%. The diff coverage is 0.00%.

@@            Coverage Diff            @@
##               main    #6357   +/-   ##
=========================================
  Coverage     10.84%   10.84%           
- Complexity     7097     7099    +2     
=========================================
  Files          2485     2485           
  Lines        245392   245403   +11     
  Branches      38320    38321    +1     
=========================================
+ Hits          26606    26610    +4     
- Misses       215518   215524    +6     
- Partials       3268     3269    +1     
Impacted Files Coverage Δ
...ain/java/com/cloud/network/dao/LoadBalancerVO.java 56.66% <0.00%> (-1.96%) :arrow_down:
...loud/network/lb/LoadBalancingRulesManagerImpl.java 7.78% <0.00%> (-0.06%) :arrow_down:
...dstack/network/contrail/model/ModelObjectBase.java 28.84% <0.00%> (+7.69%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Aug 15 '22 15:08 codecov[bot]

Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 3988

blueorangutan avatar Aug 15 '22 15:08 blueorangutan

@joseflauzino , I don´t think your argument holds, in the long run we should avoid debug statements in production environments. If you think your logging is valid in production you should give it a higher level. @blueorangutan test

DaanHoogland avatar Aug 15 '22 15:08 DaanHoogland

@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

blueorangutan avatar Aug 15 '22 15:08 blueorangutan

Trillian Build Failed (tid-4695)

blueorangutan avatar Aug 15 '22 16:08 blueorangutan

Trillian test result (tid-4697) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 42409 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6357-t4697-kvm-centos7.zip Smoke tests completed. 100 look OK, 1 have errors Only failed tests results shown below:

Test Result Time (s) Test File
test_08_upgrade_kubernetes_ha_cluster Failure 599.17 test_kubernetes_clusters.py

blueorangutan avatar Aug 16 '22 04:08 blueorangutan

@joseflauzino , I don´t think your argument holds, in the long run we should avoid debug statements in production environments. If you think your logging is valid in production you should give it a higher level.

@joseflauzino please review your loging statements and make sure anything you want in present in production is at least at INFO level. You are right that this is not perfectly implemented this way, but that does not mean we shouldn´t improve on it.

DaanHoogland avatar Aug 29 '22 07:08 DaanHoogland

@DaanHoogland Most of the log messages added/improved in this PR are really useful for debugging purposes. There are only two exceptions, which are presented as warning and error. Considering the characteristics of all the messages involved, I think the log levels are appropriate.

joseflauzino avatar Aug 31 '22 13:08 joseflauzino

ok @joseflauzino but where ever there is a string operation done in the parameter passing I would still like the if (log.isDebugEnabled()) guard around it. Other wise fine.

DaanHoogland avatar Oct 14 '22 08:10 DaanHoogland

@blueorangutan package

joseflauzino avatar Oct 26 '22 13:10 joseflauzino

@joseflauzino a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar Oct 26 '22 13:10 blueorangutan

Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 4558

blueorangutan avatar Oct 26 '22 14:10 blueorangutan