-
Notifications
You must be signed in to change notification settings - Fork 19
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
(Sentinel) reduce spamming from dal checks, offsetchecks, and event checks #2236
Conversation
WalkthroughWalkthroughThe changes involve updating alarm handling logic across multiple files, introducing new constants Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AlarmSystem
participant WebSocket
participant DAL
User->>AlarmSystem: Trigger Check
AlarmSystem->>WebSocket: Check Last Update Offsets
WebSocket->>AlarmSystem: Return Delay Info
AlarmSystem->>DAL: Check DAL Delays
DAL->>AlarmSystem: Return DAL Delay Info
AlarmSystem->>User: Send Alarm Summary
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
node/pkg/checker/event/app.go (1)
306-313
: ConsolidateAlarmOffsetPerPair
definition.The constant
AlarmOffsetPerPair
is defined multiple times across different files with the same value. To ensure maintainability and consistency, consider consolidating its definition to a single location and importing it where needed.
- Defined in:
node/pkg/checker/event/app.go
node/pkg/checker/offset/app.go
node/pkg/checker/dal/types.go
Analysis chain
Updated alarm thresholds.
The alarm thresholds are updated to use
AlarmOffsetPerPair
. This change enhances the granularity of alarm reporting. Ensure that this constant is correctly defined and used consistently throughout the codebase.Verify the definitions and usage of
AlarmOffsetPerPair
in the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the definitions and usage of `AlarmOffsetPerPair`. # Test: Search for the definitions of the constants. Expect: Definitions in the appropriate files. rg --type go 'const AlarmOffsetPerPair' -A 2 # Test: Search for the usage of the constants. Expect: Consistent usage throughout the codebase. rg --type go 'AlarmOffsetPerPair'Length of output: 1045
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- node/pkg/checker/dal/app.go (4 hunks)
- node/pkg/checker/dal/app_test.go (1 hunks)
- node/pkg/checker/dal/types.go (1 hunks)
- node/pkg/checker/event/app.go (3 hunks)
- node/pkg/checker/offset/app.go (7 hunks)
Additional comments not posted (19)
node/pkg/checker/dal/types.go (2)
12-12
: LGTM!The constant
AlarmOffsetPerPair
is correctly declared.The code changes are approved.
13-13
: LGTM!The constant
AlarmOffsetInTotal
is correctly declared.The code changes are approved.
node/pkg/checker/dal/app_test.go (2)
38-38
: LGTM!The value for "BTC" in
alarmCountMap
has been correctly updated to 10.The code changes are approved.
39-39
: LGTM!The value for "ETH" in
alarmCountMap
has been correctly updated to 10.The code changes are approved.
node/pkg/checker/offset/app.go (5)
23-23
: LGTM!The constant
AlarmOffsetPerPair
is correctly declared.The code changes are approved.
24-24
: LGTM!The constant
AlarmOffsetInTotal
is correctly declared.The code changes are approved.
93-93
: LGTM!The variable
localAggregateAlarmCount
is correctly declared and initialized.The code changes are approved.
94-94
: LGTM!The variable
globalAggregateAlarmCount
is correctly declared and initialized.The code changes are approved.
Line range hint
136-193
: LGTM!The function
checkOffsets
is correctly implemented. It includes logic to increment alarm counts based on delay and generate messages accordingly.The code changes are approved.
node/pkg/checker/dal/app.go (7)
32-32
: Introduction ofwebsocketNotPushedCount
.The new variable
websocketNotPushedCount
is introduced to track the number of symbols for which the WebSocket has not been pushed. This improves the granularity of alarm reporting.The code changes are approved.
50-52
: Summary message for WebSocket not being pushed.If any symbols have not been pushed, a summary message is appended to the
messages
slice. This provides a clear and concise summary of the issue.The code changes are approved.
156-156
: Introduction oftotalDelayed
.The new variable
totalDelayed
is introduced to track the number of delayed price updates. This improves the granularity of alarm reporting.The code changes are approved.
186-188
: Summary message for delayed price updates.If any symbols have delayed price updates, a summary message is appended to the
msg
string. This provides a clear and concise summary of the issue.The code changes are approved.
38-43
: Updated alarm thresholds.The alarm thresholds are updated to use
AlarmOffsetPerPair
andAlarmOffsetInTotal
. This change enhances the granularity of alarm reporting. Ensure that these constants are correctly defined and used consistently throughout the codebase.Verify the definitions and usage of
AlarmOffsetPerPair
andAlarmOffsetInTotal
in the codebase.Verification successful
Constants are consistently defined and used.
The constants
AlarmOffsetPerPair
andAlarmOffsetInTotal
are consistently defined and used across the codebase with the same values. This confirms the update enhances the granularity of alarm reporting as intended. No further action is needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the definitions and usage of `AlarmOffsetPerPair` and `AlarmOffsetInTotal`. # Test: Search for the definitions of the constants. Expect: Definitions in the appropriate files. rg --type go 'const AlarmOffsetPerPair' -A 2 rg --type go 'const AlarmOffsetInTotal' -A 2 # Test: Search for the usage of the constants. Expect: Consistent usage throughout the codebase. rg --type go 'AlarmOffsetPerPair' rg --type go 'AlarmOffsetInTotal'Length of output: 1941
240-240
: Updated alarm thresholds.The alarm thresholds are updated to use
AlarmOffsetPerPair
. This change enhances the granularity of alarm reporting. Ensure that this constant is correctly defined and used consistently throughout the codebase.Verify the definitions and usage of
AlarmOffsetPerPair
in the codebase.Verification successful
Consistent definition and usage of
AlarmOffsetPerPair
.The constant
AlarmOffsetPerPair
is consistently defined and used across the codebase with a value of 10. This ensures uniform alarm threshold behavior across different modules. No issues found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the definitions and usage of `AlarmOffsetPerPair`. # Test: Search for the definitions of the constants. Expect: Definitions in the appropriate files. rg --type go 'const AlarmOffsetPerPair' -A 2 # Test: Search for the usage of the constants. Expect: Consistent usage throughout the codebase. rg --type go 'AlarmOffsetPerPair'Length of output: 1045
174-178
: Updated alarm thresholds.The alarm thresholds are updated to use
AlarmOffsetPerPair
andAlarmOffsetInTotal
. This change enhances the granularity of alarm reporting. Ensure that these constants are correctly defined and used consistently throughout the codebase.Verify the definitions and usage of
AlarmOffsetPerPair
andAlarmOffsetInTotal
in the codebase.Verification successful
Alarm thresholds are consistently defined and used.
The constants
AlarmOffsetPerPair
andAlarmOffsetInTotal
are correctly defined and consistently used throughout the codebase, enhancing the granularity of alarm reporting as intended.
- Defined in
node/pkg/checker/event/app.go
andnode/pkg/checker/dal/types.go
.- Used in
node/pkg/checker/dal/app.go
,node/pkg/checker/offset/app.go
, andnode/pkg/checker/event/app.go
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the definitions and usage of `AlarmOffsetPerPair` and `AlarmOffsetInTotal`. # Test: Search for the definitions of the constants. Expect: Definitions in the appropriate files. rg --type go 'const AlarmOffsetPerPair' -A 2 rg --type go 'const AlarmOffsetInTotal' -A 2 # Test: Search for the usage of the constants. Expect: Consistent usage throughout the codebase. rg --type go 'AlarmOffsetPerPair' rg --type go 'AlarmOffsetInTotal'Length of output: 1941
node/pkg/checker/event/app.go (3)
148-148
: Introduction oftotalDelayed
.The new variable
totalDelayed
is introduced to track the number of delayed feeds. This improves the granularity of alarm reporting.The code changes are approved.
170-171
: Summary message for delayed feeds.If any feeds are delayed, a summary message is appended to the
msg
string. This provides a clear and concise summary of the issue.The code changes are approved.
157-167
: Updated alarm thresholds.The alarm thresholds are updated to use
AlarmOffsetPerPair
andAlarmOffsetInTotal
. This change enhances the granularity of alarm reporting. Ensure that these constants are correctly defined and used consistently throughout the codebase.Verify the definitions and usage of
AlarmOffsetPerPair
andAlarmOffsetInTotal
in the codebase.Verification successful
Verification Successful: Consistent Definitions and Usage of Alarm Thresholds
The constants
AlarmOffsetPerPair
andAlarmOffsetInTotal
are consistently defined and used across the codebase. They are defined with the same values in multiple files and are applied uniformly in various parts of the code. No discrepancies were found.
AlarmOffsetPerPair
is defined with a value of 10.AlarmOffsetInTotal
is defined with a value of 3.These constants are used in
node/pkg/checker/event/app.go
,node/pkg/checker/dal/app.go
, andnode/pkg/checker/offset/app.go
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the definitions and usage of `AlarmOffsetPerPair` and `AlarmOffsetInTotal`. # Test: Search for the definitions of the constants. Expect: Definitions in the appropriate files. rg --type go 'const AlarmOffsetPerPair' -A 2 rg --type go 'const AlarmOffsetInTotal' -A 2 # Test: Search for the usage of the constants. Expect: Consistent usage throughout the codebase. rg --type go 'AlarmOffsetPerPair' rg --type go 'AlarmOffsetInTotal'Length of output: 1941
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Description
Alarm per pair will be sent with 10 times of offset,
for less occurrences, it'll send cnt message for previous offset
Type of change
Please delete options that are not relevant.
Checklist before requesting a review
Deployment