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 module LatencyAddSample still work when latency-monitor-threshold is 0 #1541

Merged
merged 2 commits into from
Jan 11, 2025

Conversation

enjoy-binbin
Copy link
Member

@enjoy-binbin enjoy-binbin commented Jan 10, 2025

When latency-monitor-threshold is set to 0, it means the latency monitor
is disabled, and in VM_LatencyAddSample, we wrote the condition incorrectly,
causing us to record latency when latency was turned off.

This bug was introduced in the very first day, see e3b1d6d, was merged in 2019.

… is 0

When latency-monitor-threshold is set to 0, it means the latency monitor
is disabled, and in VM_LatencyAddSample, we wrote the condition incorrectly,
causing us to record latency when latency was turned off.

Signed-off-by: Binbin <[email protected]>
@enjoy-binbin
Copy link
Member Author

Currently LATENCY LATEST only has the following fields:

  • Event name.
  • Unix timestamp of the latest latency spike for the event.
  • Latest event latency in millisecond.
  • All-time maximum latency for this event.

I would also like to take it opportunity to discuss, if we can add more fields, like:

  • min, the all-time minimum latency for this event (maybe not that useful)
  • sum, the all-time sum latency for this event (i think it is useful for some events)
  • cnt, the event count that trigger the latency, with the sum we can calc the avg

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.91%. Comparing base (e60990e) to head (f645e30).
Report is 1 commits behind head on unstable.

Files with missing lines Patch % Lines
src/module.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1541      +/-   ##
============================================
+ Coverage     70.77%   70.91%   +0.14%     
============================================
  Files           120      120              
  Lines         65005    65005              
============================================
+ Hits          46005    46100      +95     
+ Misses        19000    18905      -95     
Files with missing lines Coverage Δ
src/module.c 9.56% <0.00%> (ø)

... and 13 files with indirect coverage changes

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

Great.

When was the bug introduced? Backporting, release notes, etc...

@PingXie
Copy link
Member

PingXie commented Jan 10, 2025

Great.

When was the bug introduced? Backporting, release notes, etc...

Day 1 bug introduced in 7.2.4 Redis: e3b1d6d3ad

@madolson
Copy link
Member

The PR was merged in 2019, it's a much older bug than that.

src/module.c Outdated Show resolved Hide resolved
Signed-off-by: Binbin <[email protected]>
@enjoy-binbin enjoy-binbin added the release-notes This issue should get a line item in the release notes label Jan 11, 2025
@enjoy-binbin
Copy link
Member Author

I added the backport label, feel free to change it if you think otherwise.

@enjoy-binbin enjoy-binbin merged commit d6bdd9e into valkey-io:unstable Jan 11, 2025
48 checks passed
@enjoy-binbin enjoy-binbin deleted the fix_module_latency branch January 11, 2025 02:33
proost pushed a commit to proost/valkey that referenced this pull request Jan 17, 2025
… is 0 (valkey-io#1541)

When latency-monitor-threshold is set to 0, it means the latency monitor
is disabled, and in VM_LatencyAddSample, we wrote the condition
incorrectly, causing us to record latency when latency was turned off.

This bug was introduced in the very first day, see e3b1d6d, it was merged
in 2019.

Signed-off-by: Binbin <[email protected]>
Signed-off-by: proost <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes This issue should get a line item in the release notes
Projects
Status: Merged
Status: To be backported
Development

Successfully merging this pull request may close these issues.

4 participants