1- #include " SensorClientFormatter .h"
1+ #include " Formatter .h"
22
33#include < uuid/uuid.h>
44
1616namespace collector ::output {
1717
1818using SignalStreamMessage = sensor::SignalStreamMessage;
19- using Signal = SensorClientFormatter ::Signal;
20- using ProcessSignal = SensorClientFormatter ::ProcessSignal;
21- using LineageInfo = SensorClientFormatter ::LineageInfo;
19+ using Signal = Formatter ::Signal;
20+ using ProcessSignal = Formatter ::ProcessSignal;
21+ using LineageInfo = Formatter ::LineageInfo;
2222
2323using Timestamp = google::protobuf::Timestamp;
2424using TimeUtil = google::protobuf::util::TimeUtil;
@@ -57,17 +57,17 @@ std::string extract_proc_args(sinsp_threadinfo* tinfo) {
5757
5858} // namespace
5959
60- SensorClientFormatter::SensorClientFormatter (sinsp* inspector, const CollectorConfig& config)
60+ Formatter::Formatter (sinsp* inspector, const CollectorConfig& config)
6161 : event_names_(EventNames::GetInstance()),
6262 event_extractor_ (std::make_unique<system_inspector::EventExtractor>()),
6363 container_metadata_(inspector),
6464 config_(config) {
6565 event_extractor_->Init (inspector);
6666}
6767
68- SensorClientFormatter ::~SensorClientFormatter () = default ;
68+ Formatter ::~Formatter () = default ;
6969
70- const sensor::ProcessSignal* SensorClientFormatter ::ToProtoMessage (sinsp_evt* event) {
70+ const sensor::ProcessSignal* Formatter ::ToProtoMessage (sinsp_evt* event) {
7171 if (process_signals[event->get_type ()] == ProcessSignalType::UNKNOWN_PROCESS_TYPE) {
7272 return nullptr ;
7373 }
@@ -82,7 +82,7 @@ const sensor::ProcessSignal* SensorClientFormatter::ToProtoMessage(sinsp_evt* ev
8282 return CreateProcessSignal (event);
8383}
8484
85- const sensor::ProcessSignal* SensorClientFormatter ::ToProtoMessage (sinsp_threadinfo* tinfo) {
85+ const sensor::ProcessSignal* Formatter ::ToProtoMessage (sinsp_threadinfo* tinfo) {
8686 Reset ();
8787 if (!ValidateProcessDetails (tinfo)) {
8888 CLOG (INFO) << " Dropping process event: " << tinfo;
@@ -92,7 +92,7 @@ const sensor::ProcessSignal* SensorClientFormatter::ToProtoMessage(sinsp_threadi
9292 return CreateProcessSignal (tinfo);
9393}
9494
95- ProcessSignal* SensorClientFormatter ::CreateProcessSignal (sinsp_evt* event) {
95+ ProcessSignal* Formatter ::CreateProcessSignal (sinsp_evt* event) {
9696 auto signal = AllocateRoot ();
9797
9898 // set id
@@ -174,7 +174,7 @@ ProcessSignal* SensorClientFormatter::CreateProcessSignal(sinsp_evt* event) {
174174 return signal;
175175}
176176
177- ProcessSignal* SensorClientFormatter ::CreateProcessSignal (sinsp_threadinfo* tinfo) {
177+ ProcessSignal* Formatter ::CreateProcessSignal (sinsp_threadinfo* tinfo) {
178178 auto signal = AllocateRoot ();
179179
180180 // set id
@@ -237,7 +237,7 @@ ProcessSignal* SensorClientFormatter::CreateProcessSignal(sinsp_threadinfo* tinf
237237 return signal;
238238}
239239
240- std::string SensorClientFormatter ::ToString (sinsp_evt* event) {
240+ std::string Formatter ::ToString (sinsp_evt* event) {
241241 std::stringstream ss;
242242 const std::string* path = event_extractor_->get_exepath (event);
243243 const std::string* name = event_extractor_->get_comm (event);
@@ -254,7 +254,7 @@ std::string SensorClientFormatter::ToString(sinsp_evt* event) {
254254 return ss.str ();
255255}
256256
257- bool SensorClientFormatter ::ValidateProcessDetails (const sinsp_threadinfo* tinfo) {
257+ bool Formatter ::ValidateProcessDetails (const sinsp_threadinfo* tinfo) {
258258 if (tinfo == nullptr ) {
259259 return false ;
260260 }
@@ -266,11 +266,11 @@ bool SensorClientFormatter::ValidateProcessDetails(const sinsp_threadinfo* tinfo
266266 return true ;
267267}
268268
269- bool SensorClientFormatter ::ValidateProcessDetails (sinsp_evt* event) {
269+ bool Formatter ::ValidateProcessDetails (sinsp_evt* event) {
270270 return ValidateProcessDetails (event->get_thread_info ());
271271}
272272
273- void SensorClientFormatter ::UpdateLineageStats (const std::vector<LineageInfo>& lineage) {
273+ void Formatter ::UpdateLineageStats (const std::vector<LineageInfo>& lineage) {
274274 int string_total = std::accumulate (lineage.cbegin (), lineage.cend (), 0 , [](int acc, const auto & l) {
275275 return acc + l.parent_exec_file_path ().size ();
276276 });
@@ -281,7 +281,7 @@ void SensorClientFormatter::UpdateLineageStats(const std::vector<LineageInfo>& l
281281 COUNTER_ADD (CollectorStats::process_lineage_string_total, string_total);
282282}
283283
284- std::vector<LineageInfo> SensorClientFormatter ::GetProcessLineage (sinsp_threadinfo* tinfo) {
284+ std::vector<LineageInfo> Formatter ::GetProcessLineage (sinsp_threadinfo* tinfo) {
285285 std::vector<LineageInfo> lineage;
286286 if (tinfo == nullptr ) {
287287 return lineage;
0 commit comments