Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b2b6019
first implementation of Trace Spans in pubsub
IlaHadiAssar Feb 18, 2026
ebd6446
added buffering to collect spans
IlaHadiAssar Feb 18, 2026
86d2290
first draft, using json for exports
IlaHadiAssar Feb 23, 2026
2fb2f1b
spans are now exported to 1 file per process
IlaHadiAssar Feb 23, 2026
ebbb280
added tracing of metadata
IlaHadiAssar Feb 24, 2026
06f2620
added exit and crash handling
IlaHadiAssar Feb 25, 2026
2cc3cb4
Merge branch 'eclipse-ecal:master' into feature/tracing_poc
IlaHadiAssar Feb 26, 2026
7b0eb26
added span around SHM handshake
IlaHadiAssar Feb 26, 2026
50e57f5
Merge branch 'feature/tracing_poc' of github.com:hadiassarila-debug/e…
IlaHadiAssar Feb 26, 2026
5825802
minor code cleanup and switch to jsonl format
IlaHadiAssar Feb 26, 2026
3068f94
moved SendSpan creation to publisher implementation
IlaHadiAssar Feb 27, 2026
ff08fd6
added bitmask flags for layertype
IlaHadiAssar Mar 2, 2026
6460aee
added tracinglayertype enum to receive spans and shm handshake
IlaHadiAssar Mar 2, 2026
419a342
added version number
IlaHadiAssar Mar 2, 2026
e3b16a0
rule of 5
IlaHadiAssar Mar 2, 2026
923bc40
justified Span structs
IlaHadiAssar Mar 2, 2026
9f6a4aa
added constant for batch size
IlaHadiAssar Mar 2, 2026
34bfe51
cleanup
IlaHadiAssar Mar 2, 2026
677ecf2
moved file writing responsability to seperate class
IlaHadiAssar Mar 2, 2026
d73b155
moved traceprovider and span to seperate files
IlaHadiAssar Mar 2, 2026
b0b5f31
cleanup
IlaHadiAssar Mar 2, 2026
4641c13
write payload size at receive
IlaHadiAssar Mar 2, 2026
b0feb16
fixed missing includes
IlaHadiAssar Mar 2, 2026
6bc4db2
removed excessive default values
IlaHadiAssar Mar 2, 2026
f593df6
removed shm handshake span
IlaHadiAssar Mar 4, 2026
c6e4dc7
removed unused operation type
IlaHadiAssar Mar 4, 2026
417a35e
cleanup
IlaHadiAssar Mar 5, 2026
9441b93
fixed race conditions
IlaHadiAssar Mar 5, 2026
1cb8081
added tracing testsuite
IlaHadiAssar Mar 5, 2026
ebdfcac
changed buffer default size
IlaHadiAssar Mar 9, 2026
0b0fefc
removed duplicate filepaths
IlaHadiAssar Mar 9, 2026
123e2ab
Merge branch 'eclipse-ecal:master' into feature/tracing_poc
IlaHadiAssar Mar 9, 2026
f0163d2
no data dir now aborts program
IlaHadiAssar Mar 9, 2026
02b0569
Merge branch 'feature/tracing_poc' of github.com:hadiassarila-debug/e…
IlaHadiAssar Mar 9, 2026
cb9ccdd
Merge branch 'eclipse-ecal:master' into feature/tracing_poc
IlaHadiAssar Mar 10, 2026
0f80ff7
switched to ecal internal method to get pid
IlaHadiAssar Mar 10, 2026
cc2d03d
Merge branch 'feature/tracing_poc' of github.com:hadiassarila-debug/e…
IlaHadiAssar Mar 10, 2026
4d904a7
include nlohmann_json via fetchcontent
IlaHadiAssar Mar 10, 2026
0583d09
Merge branch 'eclipse-ecal:master' into feature/tracing_poc
IlaHadiAssar Mar 11, 2026
7b5f067
added find_package for nlohmann_json
IlaHadiAssar Mar 11, 2026
b7b03aa
Merge branch 'feature/tracing_poc' of github.com:hadiassarila-debug/e…
IlaHadiAssar Mar 11, 2026
0b3e08d
removed platform specific signal handling for buffer flush
IlaHadiAssar Mar 11, 2026
cbb21d7
set tracing env variable in workflows
IlaHadiAssar Mar 11, 2026
b7733c3
fixed workflows
IlaHadiAssar Mar 11, 2026
c817c47
removed platform specific get pid function
IlaHadiAssar Mar 11, 2026
70675cd
added windows compatibillity to tracing_tests
IlaHadiAssar Mar 11, 2026
45844e0
fixed windows linking issue
IlaHadiAssar Mar 11, 2026
f3ef015
added support for windows tmp directory
IlaHadiAssar Mar 11, 2026
8aa97ff
merge upstream master into feature/tracing_poc
IlaHadiAssar Mar 12, 2026
f057597
Merge branch 'eclipse-ecal:master' into feature/tracing_poc
IlaHadiAssar Mar 24, 2026
07e290f
threaded file writinh
IlaHadiAssar Apr 1, 2026
acd62f6
adjusted singele instance usage
IlaHadiAssar Apr 1, 2026
e657c72
implemented tracing_writer interface
IlaHadiAssar Apr 1, 2026
ee29aad
made file writer interchangeable
IlaHadiAssar Apr 14, 2026
c9f1dfe
Merge branch 'eclipse-ecal:master' into feature/tracing_poc
IlaHadiAssar Apr 14, 2026
b298c6b
restructured tests
IlaHadiAssar Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ jobs:
# Always save cache if configure succeeded (even if the build failed)
if: ${{ always() && steps.cmake-configure.outcome == 'success' }}

- name: Create tracing output directory
run: |
ECAL_TRACING_DATA_DIR="${{ runner.temp }}/ecal_tracing"
mkdir -p "$ECAL_TRACING_DATA_DIR"
echo "ECAL_TRACING_DATA_DIR=$ECAL_TRACING_DATA_DIR" >> "$GITHUB_ENV"

- name: Run Tests
run: ctest -V --test-dir _build

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ jobs:
run: cmake --build "${{ runner.workspace }}/_build/csharp" --config Release
shell: cmd

- name: Create tracing output directory
run: |
$TRACING_DIR = "${{ runner.temp }}\ecal_tracing"
mkdir $TRACING_DIR
echo "ECAL_TRACING_DATA_DIR=$TRACING_DIR" >> $Env:GITHUB_ENV
shell: powershell

- name: Run C# Tests
run: ctest -C Release -V --test-dir "${{ runner.workspace }}/_build/csharp"

Expand Down
1 change: 1 addition & 0 deletions cmake/submodule_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(ecal_submodule_dependencies
HDF5
#libssh2
nanobind
nlohmann_json
Protobuf
protozero
qwt
Expand Down
7 changes: 4 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def build_requirements(self):
def requirements(self):
self.requires("hdf5/1.10.6")
self.requires("protobuf/3.17.1")
self.requires("nlohmann_json/3.11.2")
self.requires("libcurl/7.78.0")
self.requires("qt/5.15.2")
self.requires("spdlog/1.9.2")
Expand Down Expand Up @@ -51,6 +52,6 @@ def generate(self):
else:
tc.variables["Protobuf_PROTOC_EXECUTABLE"] = os.path.join(self.deps_cpp_info["protobuf"].rootpath, "bin", "protoc")
tc.generate()



17 changes: 17 additions & 0 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ find_package(asio REQUIRED)
find_package(Threads REQUIRED)
find_package(ecaludp REQUIRED)
find_package(protozero REQUIRED)
find_package(nlohmann_json REQUIRED)

if (ECAL_CORE_CONFIGURATION)
find_package(yaml-cpp REQUIRED)
Expand Down Expand Up @@ -459,6 +460,20 @@ if(ECAL_CORE_TIMEPLUGIN)
)
endif()

######################################
# tracing
######################################
set(ecal_tracing_src
src/tracing/tracing.h
src/tracing/span.cpp
src/tracing/span.h
src/tracing/trace_provider.cpp
src/tracing/trace_provider.h
src/tracing/tracing_writer.h
src/tracing/tracing_writer_jsonl.cpp
src/tracing/tracing_writer_jsonl.h
)

######################################
# util
######################################
Expand Down Expand Up @@ -637,6 +652,7 @@ set(ecal_sources
${ecal_serialization_src}
${ecal_service_src}
${ecal_time_src}
${ecal_tracing_src}
${ecal_util_src}
${ecal_cmn_src}
${ecal_builder_src}
Expand Down Expand Up @@ -717,6 +733,7 @@ target_link_libraries(ecal_core_private
$<$<BOOL:${ECAL_CORE_TRANSPORT_TCP}>:tcp_pubsub::tcp_pubsub>
$<$<BOOL:${ECAL_CORE_TIMEPLUGIN}>:ecaltime>
ecaludp::ecaludp
nlohmann_json::nlohmann_json
$<$<AND:$<BOOL:${UNIX}>,$<NOT:$<BOOL:${QNXNTO}>>>:dl>
$<$<AND:$<BOOL:${UNIX}>,$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${QNXNTO}>>>:rt>
$<$<AND:$<BOOL:${UNIX}>,$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${QNXNTO}>>>:atomic>
Expand Down
2 changes: 2 additions & 0 deletions ecal/core/src/ecal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ namespace eCAL
SetGlobalUnitName(unit_name_.c_str());

if ((components_ & Init::Logging) != 0u) InitializeLogging(config_);
InitializeTracing();

auto globals_instance = CreateGlobalsInstance();
if (!globals_instance) return false;
Expand Down Expand Up @@ -169,6 +170,7 @@ namespace eCAL
ResetGlobalEcalConfiguration();

ResetLogging();
ResetTracing();

return finalized;
}
Expand Down
19 changes: 19 additions & 0 deletions ecal/core/src/ecal_global_accessors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "config/builder/logging_attribute_builder.h"
#include "logging/ecal_log_provider.h"
#include "logging/ecal_log_receiver.h"
#include "tracing/trace_provider.h"

#include <atomic>
#include <string>
Expand All @@ -57,6 +58,8 @@ namespace eCAL
std::shared_ptr<Logging::CLogProvider> g_log_provider_instance;
std::shared_ptr<Logging::CLogReceiver> g_log_receiver_instance;

std::shared_ptr<tracing::CTraceProvider> g_trace_provider_instance;

void SetGlobalUnitName(const char *unit_name_)
{
if(unit_name_ != nullptr) g_unit_name = unit_name_;
Expand Down Expand Up @@ -118,6 +121,22 @@ namespace eCAL
return nullptr;
}

void InitializeTracing()
{
g_trace_provider_instance = tracing::CTraceProvider::Create();
}

void ResetTracing()
{
g_trace_provider_instance.reset();
}

std::shared_ptr<tracing::CTraceProvider> g_trace_provider()
{
if (auto provider = g_trace_provider_instance; provider) return provider;
return nullptr;
}

std::shared_ptr<CGlobals> g_globals()
{
if (auto globals_instance = g_globals_instance; globals_instance)
Expand Down
10 changes: 10 additions & 0 deletions ecal/core/src/ecal_global_accessors.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ namespace eCAL
class CLogReceiver;
}

namespace tracing
{
class CTraceProvider;
}

#if ECAL_CORE_MONITORING
class CMonitoring;
#endif
Expand Down Expand Up @@ -80,6 +85,9 @@ namespace eCAL
void InitializeLogging(const eCAL::Configuration& config_);
void ResetLogging();

void InitializeTracing();
void ResetTracing();

// Declaration of getter functions for globally accessible variable instances
std::shared_ptr<CGlobals> g_globals();
#if ECAL_CORE_MONITORING
Expand Down Expand Up @@ -110,6 +118,8 @@ namespace eCAL
std::shared_ptr<Logging::CLogProvider> g_logging_provider();
std::shared_ptr<Logging::CLogReceiver> g_logging_receiver();

std::shared_ptr<tracing::CTraceProvider> g_trace_provider();

// declaration of globally accessible variables
extern std::string g_default_ini_file;
extern Configuration g_ecal_configuration;
Expand Down
3 changes: 2 additions & 1 deletion ecal/core/src/pubsub/ecal_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ namespace eCAL
}

bool CPublisher::Send(CPayloadWriter& payload_, long long time_)
{
{
auto publisher_impl = m_publisher_impl.lock();
if (!publisher_impl) return false;

// in an optimization case the
// publisher can send an empty package
// or we do not have any subscription at all
Expand Down
40 changes: 40 additions & 0 deletions ecal/core/src/pubsub/ecal_publisher_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

#include "registration/ecal_registration_provider.h"

#include "tracing/tracing.h"
#include "tracing/span.h"
#include "tracing/trace_provider.h"

#include <algorithm>
#include <chrono>
#include <functional>
Expand Down Expand Up @@ -122,6 +126,19 @@ namespace eCAL
m_topic_id.topic_id.host_name = m_attributes.host_name;
m_topic_id.topic_id.process_id = m_attributes.process_id;

// record topic metadata for tracing
{
eCAL::tracing::STopicMetadata meta;
meta.entity_id = m_publisher_id;
meta.process_id = m_attributes.process_id;
meta.host_name = m_attributes.host_name;
meta.topic_name = m_attributes.topic_name;
meta.encoding = m_topic_info.encoding;
meta.type_name = m_topic_info.name;
meta.direction = eCAL::tracing::topic_direction::publisher;
if (auto provider = g_trace_provider(); provider) provider->addTopicMetadata(meta);
}

// mark as created
m_created = true;
}
Expand Down Expand Up @@ -179,6 +196,29 @@ namespace eCAL
// prepare counter and internal states
const size_t snd_hash = PrepareWrite(filter_id_, payload_buf_size);

// determine active transport layer for tracing
eCAL::tracing::eTracingLayerType active_layer = eCAL::tracing::tl_trace_none;
{
#if ECAL_CORE_TRANSPORT_SHM
if (m_writer_shm) { active_layer = static_cast<eCAL::tracing::eTracingLayerType>(active_layer | eCAL::tracing::tl_trace_shm); }
#endif
#if ECAL_CORE_TRANSPORT_UDP
if (m_writer_udp) { active_layer = static_cast<eCAL::tracing::eTracingLayerType>(active_layer | eCAL::tracing::tl_trace_udp); }
#endif
#if ECAL_CORE_TRANSPORT_TCP
if (m_writer_tcp) { active_layer = static_cast<eCAL::tracing::eTracingLayerType>(active_layer | eCAL::tracing::tl_trace_tcp); }
#endif
}

// create tracing span for the send operation
eCAL::tracing::CSpan send_span(
m_topic_id,
m_clock,
active_layer,
payload_buf_size,
eCAL::tracing::operation_type::send
);

// did we write anything
bool written(false);

Expand Down
1 change: 1 addition & 0 deletions ecal/core/src/pubsub/ecal_publisher_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ namespace eCAL

void GetRegistrationSample(Registration::Sample& sample);
void GetUnregistrationSample(Registration::Sample& sample);
long long GetClock() const { return m_clock; }

bool StartUdpLayer();
bool StartShmLayer();
Expand Down
39 changes: 38 additions & 1 deletion ecal/core/src/pubsub/ecal_subscriber_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
**/

#include "ecal_subscriber_impl.h"
#include "tracing/tracing.h"
#include "tracing/span.h"
#include "tracing/trace_provider.h"
#include <ecal/config.h>
#include <ecal/log.h>
#include <ecal/process.h>
Expand Down Expand Up @@ -93,6 +96,19 @@ namespace eCAL
m_topic_id.topic_id.host_name = m_attributes.host_name;
m_topic_id.topic_id.process_id = m_attributes.process_id;

// record topic metadata for tracing
{
eCAL::tracing::STopicMetadata meta;
meta.entity_id = m_subscriber_id;
meta.process_id = m_attributes.process_id;
meta.host_name = m_attributes.host_name;
meta.topic_name = m_attributes.topic_name;
meta.encoding = m_topic_info.encoding;
meta.type_name = m_topic_info.name;
meta.direction = eCAL::tracing::topic_direction::subscriber;
if (auto provider = g_trace_provider(); provider) provider->addTopicMetadata(meta);
}

// start transport layers
InitializeLayers();
StartTransportLayer();
Expand Down Expand Up @@ -373,6 +389,16 @@ namespace eCAL

size_t CSubscriberImpl::ApplySample(const Payload::TopicInfo& topic_info_, const char* payload_, size_t size_, long long id_, long long clock_, long long time_, size_t /*hash_*/, eTLayerType layer_)
{

eCAL::tracing::CSpan receive_span(
m_subscriber_id,
topic_info_,
clock_,
eCAL::tracing::toTracingLayerType(layer_),
size_,
eCAL::tracing::operation_type::receive
);

// ensure thread safety
const std::lock_guard<std::mutex> lock(m_receive_callback_mutex);
if (!m_created) return(0);
Expand Down Expand Up @@ -450,7 +476,18 @@ namespace eCAL

// execute it
const std::lock_guard<std::mutex> exec_lock(m_connection_map_mtx);
(m_receive_callback)(topic_id, m_connection_map[pub_info].data_type_info, cb_data);
{
eCAL::tracing::CSpan receive_span(
m_subscriber_id,
topic_info_,
clock_,
eCAL::tracing::toTracingLayerType(layer_),
size_,
eCAL::tracing::operation_type::callback_execution
);


(m_receive_callback)(topic_id, m_connection_map[pub_info].data_type_info, cb_data); }
processed = true;
}
}
Expand Down
Loading