@@ -27,9 +27,13 @@ mesos::mesos(const std::string& state_uri,
2727 const uri_list_t & marathon_uris,
2828 const std::string& groups_api,
2929 const std::string& apps_api,
30- const std::string& watch_api): m_state_http(*this , state_uri + state_api),
30+ const std::string& watch_api)
31+ #ifdef HAS_CAPTURE
32+ : m_state_http(*this , state_uri + state_api),
3133 m_collector (false ), m_creation_logged(false )
34+ #endif // HAS_CAPTURE
3235{
36+ #ifdef HAS_CAPTURE
3337 for (const auto & uri : marathon_uris)
3438 {
3539 int port = (uri.substr (0 , 5 ) == " https" ) ? 443 : 80 ;
@@ -51,6 +55,7 @@ mesos::mesos(const std::string& state_uri,
5155 }
5256
5357 refresh (marathon_uris.size ());
58+ #endif // HAS_CAPTURE
5459}
5560
5661mesos::~mesos ()
@@ -59,6 +64,7 @@ mesos::~mesos()
5964
6065void mesos::refresh (bool marathon)
6166{
67+ #ifdef HAS_CAPTURE
6268 clear (marathon);
6369
6470 m_state_http.get_all_data (&mesos::parse_state);
@@ -80,12 +86,13 @@ void mesos::refresh(bool marathon)
8086 m_collector.add (watch_http.second );
8187 }
8288 }
89+ #endif // HAS_CAPTURE
8390}
8491
8592bool mesos::is_alive () const
8693{
8794 bool connected = true ;
88-
95+ # ifdef HAS_CAPTURE
8996 connected &= m_state_http.is_connected ();
9097 for (const auto & group : m_marathon_groups_http)
9198 {
@@ -98,12 +105,14 @@ bool mesos::is_alive() const
98105 }
99106
100107 connected &= (m_collector.subscription_count () > 0 );
108+ #endif // HAS_CAPTURE
101109
102110 return connected;
103111}
104112
105113void mesos::watch ()
106114{
115+ #ifdef HAS_CAPTURE
107116 if (m_marathon_watch_http.size ())
108117 {
109118 if (!m_collector.subscription_count ())
@@ -115,6 +124,7 @@ void mesos::watch()
115124 }
116125 m_collector.get_data ();
117126 }
127+ #endif // HAS_CAPTURE
118128}
119129
120130void mesos::determine_node_type (const Json::Value& root)
@@ -143,6 +153,7 @@ void mesos::determine_node_type(const Json::Value& root)
143153
144154void mesos::add_task_labels (std::string& json)
145155{
156+ #ifdef HAS_CAPTURE
146157 Json::Value root;
147158 Json::Reader reader;
148159 try
@@ -174,8 +185,10 @@ void mesos::add_task_labels(std::string& json)
174185 {
175186 g_logger.log (std::string (" Error while looking for taks labels:" ) + ex.what (), sinsp_logger::SEV_ERROR);
176187 }
188+ #endif // HAS_CAPTURE
177189}
178190
191+ #ifdef HAS_CAPTURE
179192void mesos::get_groups (marathon_http::ptr_t http, std::string& json)
180193{
181194 std::string group_ev_type = mesos_event_data::m_events[mesos_event_data::MESOS_GROUP_CHANGE_SUCCESS_EVENT];
@@ -242,6 +255,7 @@ void mesos::on_watch_data(const std::string& framework_id, mesos_event_data&& ms
242255 }
243256 }
244257}
258+ #endif // HAS_CAPTURE
245259
246260void mesos::parse_state (const std::string& json)
247261{
0 commit comments