2525#include " Framework/Tracing.h"
2626#include " Framework/Monitoring.h"
2727#include " TextDriverClient.h"
28+ #include " WSDriverClient.h"
29+ #include " HTTPParser.h"
2830#include " ../src/DataProcessingStatus.h"
31+ #include " DPLMonitoringBackend.h"
2932
3033#include < Configuration/ConfigurationInterface.h>
3134#include < Configuration/ConfigurationFactory.h>
3538#include < options/FairMQProgOptions.h>
3639
3740#include < cstdlib>
41+ #include < cstring>
3842
3943using AliceO2::InfoLogger::InfoLogger;
4044using AliceO2::InfoLogger::InfoLoggerContext;
@@ -58,8 +62,19 @@ struct ServiceKindExtractor<InfoLoggerContext> {
5862o2::framework::ServiceSpec CommonServices::monitoringSpec ()
5963{
6064 return ServiceSpec{" monitoring" ,
61- [](ServiceRegistry&, DeviceState&, fair::mq::ProgOptions& options) -> ServiceHandle {
62- void * service = MonitoringFactory::Get (options.GetPropertyAsString (" monitoring-backend" )).release ();
65+ [](ServiceRegistry& registry, DeviceState&, fair::mq::ProgOptions& options) -> ServiceHandle {
66+ void * service = nullptr ;
67+ bool isWebsocket = strncmp (options.GetPropertyAsString (" driver-client-backend" ).c_str (), " ws://" , 4 ) == 0 ;
68+ bool isDefault = options.GetPropertyAsString (" monitoring-backend" ) == " default" ;
69+ bool useDPL = (isWebsocket && isDefault) || options.GetPropertyAsString (" monitoring-backend" ) == " dpl://" ;
70+ if (useDPL) {
71+ auto monitoring = new Monitoring ();
72+ monitoring->addBackend (std::make_unique<DPLMonitoringBackend>(registry));
73+ service = monitoring;
74+ } else {
75+ auto backend = isDefault ? " infologger://" : options.GetPropertyAsString (" monitoring-backend" );
76+ service = MonitoringFactory::Get (backend).release ();
77+ }
6378 return ServiceHandle{TypeIdHelpers::uniqueId<Monitoring>(), service};
6479 },
6580 noConfiguration (),
@@ -223,8 +238,14 @@ o2::framework::ServiceSpec CommonServices::driverClientSpec()
223238 return ServiceSpec{
224239 " driverClient" ,
225240 [](ServiceRegistry& services, DeviceState& state, fair::mq::ProgOptions& options) -> ServiceHandle {
241+ auto backend = options.GetPropertyAsString (" driver-client-backend" );
242+ if (backend == " stdout://" ) {
243+ return ServiceHandle{TypeIdHelpers::uniqueId<DriverClient>(),
244+ new TextDriverClient (services, state)};
245+ }
246+ auto [ip, port] = o2::framework::parse_websocket_url (backend.c_str ());
226247 return ServiceHandle{TypeIdHelpers::uniqueId<DriverClient>(),
227- new TextDriverClient (services, state)};
248+ new WSDriverClient (services, state, ip. c_str (), port )};
228249 },
229250 noConfiguration (),
230251 nullptr ,
0 commit comments