Skip to content

Commit

Permalink
17300 Windows agent do not use timeout on fail for section CpuLoad an…
Browse files Browse the repository at this point in the history
…d DotNetClr

Previously, after a WMI error occurred during the generation of
specific WMI sections, particularly the CpuLoad and DotNetClr sections,
the agent would stop creating these sections for a period of one
hour. This was done to reduce noise in the log file. However,
this approach led to situations where a random WMI failure could
prevent data collection for an hour.

Since this release the delay for the CpuLoad and DotNetclr sections is eliminated thus making monitoring more smooth.

Change-Id: I4fc70c6aa4d9b5a13442d4d6ea8eafc3e4248ed6
  • Loading branch information
s-kipnis committed Jan 14, 2025
1 parent e7aa978 commit 1f8a0a3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
19 changes: 19 additions & 0 deletions .werks/17300
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Title: Windows agent do not use timeout on fail for section CpuLoad and DotNetClr
Class: feature
Compatible: compat
Component: checks
Date: 1736870131
Edition: cre
Level: 1
Version: 2.2.0p39


Previously, after a WMI error occurred during the generation of
specific WMI sections, particularly the CpuLoad and DotNetClr sections,
the agent would stop creating these sections for a period of one
hour. This was done to reduce noise in the log file. However,
this approach led to situations where a random WMI failure could
prevent data collection for an hour.

Since this release, the delay on fail or the CpuLoad and DotNetClr
sections is eliminated thus making monitoring more smooth.
11 changes: 6 additions & 5 deletions agents/wnx/src/engine/providers/internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const std::unordered_map<std::string_view, std::chrono::seconds>
&GetDelaysOnFail() {
const static std::unordered_map<std::string_view, std::chrono::seconds>
delays_on_fail = {
{kDotNetClrMemory, cfg::G_DefaultDelayOnFail}, //
{kWmiWebservices, cfg::G_DefaultDelayOnFail}, //
{kWmiCpuLoad, cfg::G_DefaultDelayOnFail}, //
{kMsExch, cfg::G_DefaultDelayOnFail}, //
{kDotNetClrMemory, 0s}, //
{kWmiWebservices, cfg::G_DefaultDelayOnFail}, //
{kWmiCpuLoad, 0s}, //
{kMsExch, cfg::G_DefaultDelayOnFail}, //
{kOhm, cfg::G_DefaultDelayOnFail},

// end of the real sections
Expand Down Expand Up @@ -129,7 +129,8 @@ void Basic::setupDelayOnFail() noexcept {
const auto &delay_in_seconds = GetDelaysOnFail().at(uniq_name_);
delay_on_fail_ = delay_in_seconds;
} catch (const std::out_of_range &) {
// do nothing here
XLOG::l.crit("Unsupported section name {}", uniq_name_);
delay_on_fail_ = std::chrono::seconds(0);
}
}

Expand Down
8 changes: 6 additions & 2 deletions agents/wnx/watest/test-section_wmi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,16 @@ TEST(WmiProviderTest, BasicWmi) {
}

TEST(WmiProviderTest, DelayOnFailDefault) {
for (const auto name :
{kOhm, kWmiCpuLoad, kWmiWebservices, kDotNetClrMemory, kMsExch}) {
for (const auto name : {kOhm, kWmiWebservices, kMsExch}) {
Wmi b(name, ',');
EXPECT_EQ(b.delayOnFail(), 3600s)
<< "bad delay for section by default " << name;
}
for (const auto name : {kWmiCpuLoad, kDotNetClrMemory}) {
Wmi b(name, ',');
EXPECT_EQ(b.delayOnFail(), 0s)
<< "bad delay for section by default " << name;
}
}

TEST(WmiProviderTest, DelayOnFailShift) {
Expand Down

0 comments on commit 1f8a0a3

Please sign in to comment.