mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-30 03:34:26 +03:00
Mar 13th 2023 update
This commit is contained in:
@@ -280,6 +280,8 @@ Debug::Debug(
|
||||
:
|
||||
do_assert(false)
|
||||
{
|
||||
isCommunicationFlag(flag1);
|
||||
|
||||
auto current_configuration =
|
||||
Singleton::exists<Config::I_Config>() ? getConfigurationWithDefault(default_config, "Debug") : default_config;
|
||||
for (auto &stream : current_configuration.streams_in_context) {
|
||||
@@ -309,6 +311,9 @@ Debug::Debug(
|
||||
:
|
||||
do_assert(false)
|
||||
{
|
||||
isCommunicationFlag(flag1);
|
||||
isCommunicationFlag(flag2);
|
||||
|
||||
auto current_configuration =
|
||||
Singleton::exists<Config::I_Config>() ? getConfigurationWithDefault(default_config, "Debug") : default_config;
|
||||
|
||||
@@ -344,6 +349,10 @@ Debug::Debug(
|
||||
:
|
||||
do_assert(false)
|
||||
{
|
||||
isCommunicationFlag(flag1);
|
||||
isCommunicationFlag(flag2);
|
||||
isCommunicationFlag(flag3);
|
||||
|
||||
auto current_configuration =
|
||||
Singleton::exists<Config::I_Config>() ? getConfigurationWithDefault(default_config, "Debug") : default_config;
|
||||
|
||||
@@ -382,6 +391,11 @@ Debug::Debug(
|
||||
:
|
||||
do_assert(false)
|
||||
{
|
||||
isCommunicationFlag(flag1);
|
||||
isCommunicationFlag(flag2);
|
||||
isCommunicationFlag(flag3);
|
||||
isCommunicationFlag(flag4);
|
||||
|
||||
auto current_configuration =
|
||||
Singleton::exists<Config::I_Config>() ? getConfigurationWithDefault(default_config, "Debug") : default_config;
|
||||
|
||||
@@ -694,6 +708,7 @@ Debug::findDebugFilePrefix(const string &file_name)
|
||||
void
|
||||
Debug::addActiveStream(const string &name)
|
||||
{
|
||||
if (is_communication && name == "FOG") return;
|
||||
auto stream_entry = active_streams.find(name);
|
||||
if (stream_entry != active_streams.end()) {
|
||||
current_active_streams.insert(stream_entry->second);
|
||||
@@ -735,6 +750,12 @@ Debug::startStreams(
|
||||
is_debug_running = true;
|
||||
}
|
||||
|
||||
void
|
||||
Debug::isCommunicationFlag(const DebugFlags &flag)
|
||||
{
|
||||
is_communication |= (flag == D_HTTP_REQUEST || flag == D_COMMUNICATION);
|
||||
}
|
||||
|
||||
Debug::DebugLevel Debug::lowest_global_level = default_level;
|
||||
I_TimeGet *Debug::time = nullptr;
|
||||
I_MainLoop *Debug::mainloop = nullptr;
|
||||
|
@@ -24,6 +24,7 @@ USE_DEBUG_FLAG(D_FW);
|
||||
USE_DEBUG_FLAG(D_PM);
|
||||
USE_DEBUG_FLAG(D_PM_EXEC);
|
||||
USE_DEBUG_FLAG(D_TRACE);
|
||||
USE_DEBUG_FLAG(D_HTTP_REQUEST);
|
||||
|
||||
string line = "";
|
||||
|
||||
|
@@ -201,6 +201,8 @@ private:
|
||||
const uint &line
|
||||
);
|
||||
|
||||
void isCommunicationFlag(const DebugFlags &flag);
|
||||
|
||||
static DebugLevel lowest_global_level;
|
||||
static I_TimeGet *time;
|
||||
static I_MainLoop *mainloop;
|
||||
@@ -212,6 +214,7 @@ private:
|
||||
static std::vector<std::string> streams_from_mgmt;
|
||||
|
||||
bool do_assert;
|
||||
bool is_communication = false;
|
||||
DebugStreamAggr stream;
|
||||
std::set<std::shared_ptr<DebugStream>> current_active_streams;
|
||||
};
|
||||
|
@@ -122,7 +122,7 @@ DEFINE_FLAG(D_COMPONENT, D_ALL)
|
||||
DEFINE_FLAG(D_ORCHESTRATOR, D_COMPONENT)
|
||||
DEFINE_FLAG(D_HEALTH_CHECK, D_ORCHESTRATOR)
|
||||
DEFINE_FLAG(D_AGENT_DETAILS, D_ORCHESTRATOR)
|
||||
DEFINE_FLAG(D_K8S_POLICY, D_ORCHESTRATOR)
|
||||
DEFINE_FLAG(D_LOCAL_POLICY, D_ORCHESTRATOR)
|
||||
DEFINE_FLAG(D_NGINX_POLICY, D_ORCHESTRATOR)
|
||||
|
||||
DEFINE_FLAG(D_GRADUAL_DEPLOYMENT, D_COMPONENT)
|
||||
|
@@ -38,6 +38,8 @@ namespace MetricCalculations
|
||||
template <typename PrintableKey, typename Metric> class MetricMap;
|
||||
} // MetricCalculations
|
||||
|
||||
class LogRest;
|
||||
|
||||
class GenericMetric
|
||||
:
|
||||
Singleton::Consume<I_MainLoop>,
|
||||
@@ -84,6 +86,9 @@ public:
|
||||
std::string getMetricName() const;
|
||||
std::chrono::seconds getReportInterval() const;
|
||||
|
||||
protected:
|
||||
virtual void sendLog(const LogRest &metric_client_rest) const;
|
||||
|
||||
private:
|
||||
class MetricsRest;
|
||||
|
||||
|
@@ -220,9 +220,15 @@ GenericMetric::generateLog()
|
||||
}
|
||||
}
|
||||
|
||||
string fog_metric_uri = getConfigurationWithDefault<string>("/api/v1/agents/events", "metric", "fogMetricUri");
|
||||
LogRest metric_client_rest(metric_to_fog);
|
||||
|
||||
sendLog(metric_client_rest);
|
||||
}
|
||||
|
||||
void
|
||||
GenericMetric::sendLog(const LogRest &metric_client_rest) const
|
||||
{
|
||||
string fog_metric_uri = getConfigurationWithDefault<string>("/api/v1/agents/events", "metric", "fogMetricUri");
|
||||
Singleton::Consume<I_Messaging>::by<GenericMetric>()->sendObjectWithPersistence(
|
||||
metric_client_rest,
|
||||
I_Messaging::Method::POST,
|
||||
|
Reference in New Issue
Block a user