Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add warn log for create/update interval #4597

Merged
merged 3 commits into from
Jul 17, 2023

Conversation

lindseysimple
Copy link
Contributor

@lindseysimple lindseysimple commented Jul 5, 2023

Add warn log for interval value from Interval and AutoEvent if the value is less than the suggested value.

Closes #4586.

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?) - no doc change needed as the change only shows the warning logs when the interval value is less than the suggested value.

Testing Instructions

Invoke the POST interval API with the following command:

curl --location 'http://localhost:59861/api/v3/interval' \
--header 'Content-Type: application/json' \
--data '  [ 
    {
      "apiVersion":"v3",
      "interval":{
         "name":"test",
         "start":"20230707T094508",
         "interval":"599us"
      }
   }
  ]'

The following warning log should be displayed in the support-scheduler log:

level=WARN ts=2023-07-05T07:27:29.922821Z app=support-scheduler source=time.go:30 msg="the interval value '599µs' is smaller than the suggested value '10ms', which might cause abnormal CPU increase"

New Dependency Instructions (If applicable)

@codecov-commenter
Copy link

codecov-commenter commented Jul 5, 2023

Codecov Report

Merging #4597 (4c96589) into main (fa614b6) will increase coverage by 0.02%.
The diff coverage is 63.63%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main    #4597      +/-   ##
==========================================
+ Coverage   41.57%   41.59%   +0.02%     
==========================================
  Files         106      107       +1     
  Lines        9759     9770      +11     
==========================================
+ Hits         4057     4064       +7     
- Misses       5356     5360       +4     
  Partials      346      346              
Impacted Files Coverage Δ
internal/core/metadata/application/device.go 0.00% <0.00%> (ø)
internal/pkg/utils/time.go 100.00% <100.00%> (ø)

cloudxxx8
cloudxxx8 previously approved these changes Jul 5, 2023
Copy link
Member

@cloudxxx8 cloudxxx8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

internal/pkg/utils/time.go Outdated Show resolved Hide resolved
internal/support/scheduler/application/interval.go Outdated Show resolved Hide resolved
internal/core/metadata/application/device.go Outdated Show resolved Hide resolved
internal/pkg/utils/time.go Outdated Show resolved Hide resolved
internal/pkg/utils/time_test.go Outdated Show resolved Hide resolved
Add warn log for interval value from Interval and AutoEvent if the value is less than the suggested value.

Closes edgexfoundry#4586.

Signed-off-by: Lindsey Cheng <beckysocute@gmail.com>
Modify minimum duration param type of CheckMinInterval func to time.Duration.

Signed-off-by: Lindsey Cheng <beckysocute@gmail.com>
Remove CheckMinInterval return value and verify the mock lc method is called in tests.

Signed-off-by: Lindsey Cheng <beckysocute@gmail.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@lindseysimple
Copy link
Contributor Author

recheck

Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cloudxxx8 cloudxxx8 merged commit db7b7ee into edgexfoundry:main Jul 17, 2023
@lindseysimple lindseysimple deleted the issue-4586 branch August 2, 2024 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CPU increases abnormal when creating interval with us/ns unit
4 participants