Skip to content

Commit

Permalink
fix: Ensure alarms raised during collection for profile projects are …
Browse files Browse the repository at this point in the history
…reported (#1455)

* fix: enable alarm for profile project to be reported
  • Loading branch information
henryzhx8 authored Apr 18, 2024
1 parent 041df36 commit 71e3d97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
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

0 comments on commit 71e3d97

Please sign in to comment.