Skip to content

fix: Ensure alarms raised during collection for profile projects are reported #1455

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

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/application/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ void Application::Start() {
// flusher_sls should always be loaded, since profiling will rely on this.
Sender::Instance()->Init();

LogtailAlarm::GetInstance()->Init();
LogtailMonitor::GetInstance()->Init();

// add local config dir
filesystem::path localConfigPath
= filesystem::path(AppConfig::GetInstance()->GetLogtailSysConfDir()) / "config" / "local";
Expand All @@ -210,6 +207,9 @@ void Application::Start() {
CommonConfigProvider::GetInstance()->Init("common");
#endif

LogtailAlarm::GetInstance()->Init();
LogtailMonitor::GetInstance()->Init();

PluginRegistry::GetInstance()->LoadPlugins();

#if defined(__ENTERPRISE__) && defined(__linux__) && !defined(__ANDROID__)
Expand Down
5 changes: 2 additions & 3 deletions core/monitor/LogtailAlarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,8 @@ void LogtailAlarm::SendAlarm(const LogtailAlarmType alarmType,
return;
}

// ignore logtail self alarm
string profileProject = ProfileSender::GetInstance()->GetProfileProjectName(region);
if (!profileProject.empty() && profileProject == projectName) {
// ignore alarm for profile data
if (Sender::IsProfileData(region, projectName, category)) {
return;
}
// LOG_DEBUG(sLogger, ("Add Alarm", region)("projectName", projectName)("alarm index",
Expand Down
2 changes: 1 addition & 1 deletion core/sender/Sender.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ class Sender {
void CleanTimeoutSendStatistic();

// bool CheckBatchMapFull(int64_t key);
static bool IsProfileData(const std::string& region, const std::string& project, const std::string& logstore);

std::string GetRegionCurrentEndpoint(const std::string& region);
std::string GetRegionFromEndpoint(const std::string& endpoint);
Expand All @@ -362,6 +361,7 @@ class Sender {

public:
static Sender* Instance();
static bool IsProfileData(const std::string& region, const std::string& project, const std::string& logstore);
// void ResetProfileSender();
bool Init(); // Backward compatible
// from collector to batchmap
Expand Down
Loading