Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/stale-5
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Apr 11, 2022
2 parents 5714abb + d72dcb6 commit f34a938
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ class ETWProvider
{
std::lock_guard<std::mutex> lock(m_providerMapLock);

auto m = providers();
// use reference to provider list, NOT it' copy.
auto &m = providers();
auto it = m.begin();
while (it != m.end())
{
Expand All @@ -228,7 +229,10 @@ class ETWProvider
}

it->second.providerHandle = INVALID_HANDLE;
m.erase(it);
if (result == STATUS_OK)
{
m.erase(it);
}
}
return result;
}
Expand Down
6 changes: 4 additions & 2 deletions exporters/etw/test/etw_provider_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ TEST(ETWProvider, ProviderIsRegisteredSuccessfully)

bool registered = etw.is_registered(providerName);
ASSERT_TRUE(registered);
etw.close(handle);
}

TEST(ETWProvider, ProviderIsNotRegisteredSuccessfully)
Expand Down Expand Up @@ -46,17 +47,18 @@ TEST(ETWProvider, CheckOpenGUIDDataSuccessfully)
auto guidStrName = uuid_name.to_string();

ASSERT_STREQ(guidStrHandle.c_str(), guidStrName.c_str());
etw.close(handle);
}

TEST(ETWProvider, CheckCloseSuccess)
{
std::string providerName = "OpenTelemetry-ETW-Provider";

static ETWProvider etw;
auto handle = etw.open(providerName.c_str());

auto handle = etw.open(providerName.c_str(), ETWProvider::EventFormat::ETW_MANIFEST);
auto result = etw.close(handle);
ASSERT_NE(result, etw.STATUS_ERROR);
ASSERT_FALSE(etw.is_registered(providerName));
}

#endif

0 comments on commit f34a938

Please sign in to comment.