Skip to content

Add timestamp to the leak sensor data in DB, Fix to not escalate a minor leak if platform doesn't support it#853

Merged
yxieca merged 2 commits into
sonic-net:masterfrom
judyjoseph:add_ts_to_leak_sensor
Jul 10, 2026
Merged

Add timestamp to the leak sensor data in DB, Fix to not escalate a minor leak if platform doesn't support it#853
yxieca merged 2 commits into
sonic-net:masterfrom
judyjoseph:add_ts_to_leak_sensor

Conversation

@judyjoseph

@judyjoseph judyjoseph commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description

Couple of enhancements/fixes in this PR

  1. Add timestamp to the leak sensor data in DB

  2. Fix to not escalate a minor leak if platform doesn't support it
    Fixes Bug: BMC leak escalation logic is not aligned with the HLD sonic-buildimage#28218

  3. Also update the leak_severity in sensor table to in DB correctly as 'CRITICAL' 'MINOR' and 'None' strings

Motivation and Context

If the platform doesn't support escalation of a minor leak --> critical Skip it by checking the return value of platform API is 0
Add timestamp to sensor leak data entry in sensor table -- This will help triage when the leak started.

How Has This Been Tested?

Unit tests added which mock the leak conditions and test

Additional Information (Optional)

@Yakiv-Huryk

Copy link
Copy Markdown

LGTM.
@judyjoseph could you please also consider addressing the following in this PR?
sonic-net/sonic-mgmt#25769 (review)

@judyjoseph

Copy link
Copy Markdown
Contributor Author

LGTM. @judyjoseph could you please also consider addressing the following in this PR? sonic-net/sonic-mgmt#25769 (review)

sure let me check @Yakiv-Huryk

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@judyjoseph judyjoseph requested a review from yxieca July 8, 2026 20:11

@yxieca yxieca left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI-assisted review — Approve

Reviewed the thermalctld leak-sensor changes:

  • Escalation fix (if 0 < max_minor_secs < inf): a get_leak_max_minor_duration_sec() of 0/negative now correctly means "platform does not support time-based MINOR→CRITICAL escalation" instead of escalating immediately. Fixes sonic-buildimage#28218.
  • leak_severity DB value now written as sensor_leak_severity.value ('MINOR'/'CRITICAL') with a 'None' fallback, instead of str(enum) which produced 'LeakSeverity.MINOR'. Applied consistently at all severity-write sites.
  • timestamp added to the sensor-table write but deliberately excluded from the fvs_tuple diff-cache, so the advancing clock doesn't defeat change-detection and rewrite the row every poll.

Test coverage is solid — the no-escalation-when-duration-zero case, timestamp-on-transitions-only, and timestamp-not-in-diff-cache behaviors are all explicitly verified.

Looks good.

AI-assisted review, reviewed and approved by Ying Xie (@yxieca).

@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202608: Azure/sonic-platform-daemons.msft#73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: BMC leak escalation logic is not aligned with the HLD

4 participants