[I] [BUG] 告警静默的周期性静默时间判断有缺陷 [hertzbeat]</span></a></span> </h1> <p class="darkgray font13"> <span class="sender pipe"><a href="/search?l=notifications@hertzbeat.apache.org&q=from:%22via+GitHub%22" rel="nofollow"><span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">via GitHub</span></span></a></span> <span class="date"><a href="/search?l=notifications@hertzbeat.apache.org&q=date:20260316" rel="nofollow">Mon, 16 Mar 2026 03:08:07 -0700</a></span> </p> </div> <div itemprop="articleBody" class="msgBody"> <!--X-Body-of-Message--> <pre> xiaotan opened a new issue, #4069: URL: <a rel="nofollow" href="https://github.com/apache/hertzbeat/issues/4069">https://github.com/apache/hertzbeat/issues/4069</a></pre><pre> ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior hertzbeat\hertzbeat-alerter\src\main\java\org\apache\hertzbeat\alert\reduce\AlarmSilenceReduce.java中的checkAndSave时间判断方法,判断的是完整日期时间 /** * Check if alert time is within silence period and update silence rule counter * @param now Current time * @param alertSilence Silence rule to check * @return true if alert should not be silenced, false if alert should be silenced */ private boolean checkAndSave(LocalDateTime now, AlertSilence alertSilence) { boolean startMatch = alertSilence.getPeriodStart() == null || now.isAfter(alertSilence.getPeriodStart().toLocalDateTime()); boolean endMatch = alertSilence.getPeriodEnd() == null || now.isBefore(alertSilence.getPeriodEnd().toLocalDateTime()); if (startMatch && endMatch) { int time = Optional.ofNullable(alertSilence.getTimes()).orElse(0); alertSilence.setTimes(time + 1); alertSilenceDao.save(alertSilence); return false; } return true; } 周期性静默应该只判断时分格式的时间 /** * Check if alert time is within silence period and update silence rule counter * @param now Current time * @param alertSilence Silence rule to check * @return true if alert should not be silenced, false if alert should be silenced */ private boolean checkAndSave(LocalDateTime now, AlertSilence alertSilence) { boolean startMatch, endMatch; if (alertSilence.getType() == 1) { // 周期性静默 - 只比较时间部分 LocalTime nowTime = now.toLocalTime(); startMatch = alertSilence.getPeriodStart() == null || !nowTime.isBefore(alertSilence.getPeriodStart().toLocalTime()); endMatch = alertSilence.getPeriodEnd() == null || !nowTime.isAfter(alertSilence.getPeriodEnd().toLocalTime()); } else { // 一次性静默 - 比较完整日期时间(保持原逻辑) startMatch = alertSilence.getPeriodStart() == null || now.isAfter(alertSilence.getPeriodStart().toLocalDateTime()); endMatch = alertSilence.getPeriodEnd() == null || now.isBefore(alertSilence.getPeriodEnd().toLocalDateTime()); } if (startMatch && endMatch) { int time = Optional.ofNullable(alertSilence.getTimes()).orElse(0); alertSilence.setTimes(time + 1); alertSilenceDao.save(alertSilence); return false; } return true; } ### Expected Behavior _No response_ ### Steps To Reproduce _No response_ ### Environment ```markdown HertzBeat version(s): ``` ### Debug logs _No response_ ### Anything else? _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org For additional commands, e-mail: notifications-h...@hertzbeat.apache.org </pre> </div> <div class="msgButtons margintopdouble"> <ul class="overflow"> <li class="msgButtonItems"><a class="button buttonleft " accesskey="p" href="msg15752.html">Previous message</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="c" href="thrd4.html#15753">View by thread</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="i" href="mail4.html#15753">View by date</a></li> <li class="msgButtonItems textalignright"><a class="button buttonright " accesskey="n" href="msg15824.html">Next message</a></li> </ul> </div> <a name="tslice"></a> <div class="tSliceList margintopdouble"> <ul class="icons monospace"> <li class="icons-email tSliceCur"><span class="subject">[I] [BUG] <title>告警静默的周期性静默时间判断有缺陷 [hertzbeat]</span> <span class="sender italic">via GitHub</span></li> <li><ul> <li class="icons-email"><span class="subject"><a href="msg15824.html">Re: [I] [BUG] <title>告警静默的周期性静默时间判断有缺陷 [hertzbeat]</a></span> <span class="sender italic">via GitHub</span></li> </ul> </ul> </div> <div class="overflow msgActions margintopdouble"> <div class="msgReply" > <h2> Reply via email to </h2> <form method="POST" action="/mailto.php"> <input type="hidden" name="subject" value="[I] [BUG] <title>告警静默的周期性静默时间判断有缺陷 [hertzbeat]"> <input type="hidden" name="msgid" value="I_kwDOGyeqAs7zRtMp@gitbox.apache.org"> <input type="hidden" name="relpath" value="notifications@hertzbeat.apache.org/msg15753.html"> <input type="submit" value=" via GitHub "> </form> </div> </div> </div> <div class="aside" role="complementary"> <div class="logo"> <a href="/"><img src="/logo.png" width=247 height=88 alt="The Mail Archive"></a> </div> <form class="overflow" action="/search" method="get"> <input type="hidden" name="l" value="notifications@hertzbeat.apache.org"> <label class="hidden" for="q">Search the site</label> <input class="submittext" type="text" id="q" name="q" placeholder="Search notifications"> <input class="submitbutton" name="submit" type="image" src="/submit.png" alt="Submit"> </form> <div class="nav margintop" id="nav" role="navigation"> <ul class="icons font16"> <li class="icons-home"><a href="/">The Mail Archive home</a></li> <li class="icons-list"><a href="/notifications@hertzbeat.apache.org/">notifications - all messages</a></li> <li class="icons-about"><a href="/notifications@hertzbeat.apache.org/info.html">notifications - about the list</a></li> <li class="icons-expand"><a href="/search?l=notifications@hertzbeat.apache.org&q=subject:%22%5C%5BI%5C%5D+%5C%5BBUG%5C%5D+%3Ctitle%3E%E5%91%8A%E8%AD%A6%E9%9D%99%E9%BB%98%E7%9A%84%E5%91%A8%E6%9C%9F%E6%80%A7%E9%9D%99%E9%BB%98%E6%97%B6%E9%97%B4%E5%88%A4%E6%96%AD%E6%9C%89%E7%BC%BA%E9%99%B7+%5C%5Bhertzbeat%5C%5D%22&o=newest&f=1" title="e" id="e">Expand</a></li> <li class="icons-prev"><a href="msg15752.html" title="p">Previous message</a></li> <li class="icons-next"><a href="msg15824.html" title="n">Next message</a></li> </ul> </div> <div class="listlogo margintopdouble"> </div> <div class="margintopdouble"> </div> </div> </div> <div class="footer" role="contentinfo"> <ul> <li><a href="/">The Mail Archive home</a></li> <li><a href="/faq.html#newlist">Add your mailing list</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/faq.html#support">Support</a></li> <li><a href="/faq.html#privacy">Privacy</a></li> <li class="darkgray">I_kwDOGyeqAs7zRtMp@gitbox.apache.org</li> </ul> </div> </body> </html>