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

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

enjoy-binbin
Copy link
Member

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.

… 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 2 lines in your changes missing coverage. Please review.

Project coverage is 70.95%. Comparing base (e60990e) to head (a901e64).

Files with missing lines Patch % Lines
src/module.c 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1541      +/-   ##
============================================
+ Coverage     70.77%   70.95%   +0.18%     
============================================
  Files           120      120              
  Lines         65005    65006       +1     
============================================
+ Hits          46005    46124     +119     
+ Misses        19000    18882     -118     
Files with missing lines Coverage Δ
src/module.c 9.56% <0.00%> (-0.01%) ⬇️

... and 11 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.

Comment on lines +7683 to +7684
if (server.latency_monitor_threshold && latency >= server.latency_monitor_threshold)
latencyAddSample(event, latency);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (server.latency_monitor_threshold && latency >= server.latency_monitor_threshold)
latencyAddSample(event, latency);
latencyAddSampleIfNeeded(event, latency);

Optional, I just noticed we have this helper.

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.

4 participants