Skip to content

Improvement: Add tracing for subscription-states#678

Draft
Rutuja-Patil-Bosch wants to merge 1 commit into
eclipse-score:mainfrom
bgsw-contrib:bgsw_main
Draft

Improvement: Add tracing for subscription-states#678
Rutuja-Patil-Bosch wants to merge 1 commit into
eclipse-score:mainfrom
bgsw-contrib:bgsw_main

Conversation

@Rutuja-Patil-Bosch

Copy link
Copy Markdown

#449

  • Code updated
  • UT update is pending

@Rutuja-Patil-Bosch

Copy link
Copy Markdown
Author

The required CI workflows appear to be awaiting maintainer approval before execution. Could one of the maintainers please approve the workflow run

@castler

castler commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@Rutuja-Patil-Bosch can you pleaes clean up the git history of this PR? To have only your changes included and no merge commits?

@castler

castler commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Can you then please also add necessary tests for the added code? Then a more in depth review makes sense.

I will mark the PR as draft in the meantime - please feel free to mark it again ready.

@castler
castler marked this pull request as draft July 21, 2026 06:14
@Rutuja-Patil-Bosch

Copy link
Copy Markdown
Author

Can you then please also add necessary tests for the added code? Then a more in depth review makes sense.

I will mark the PR as draft in the meantime - please feel free to mark it again ready.

@castler : Yes, test cases are ready. I'll rebase the PR so that no merged commit will be visible & will commit test cases also

Comment thread score/mw/com/impl/tracing/proxy_event_tracing.cpp
Copilot AI review requested due to automatic review settings July 24, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds proxy-side tracing support for subscription-state related operations so the tracing runtime can emit the configured tracepoints for state changes and subscription-state-change handler lifecycle/callbacks.

Changes:

  • Added new proxy tracing entry points for subscription state change and handler register/deregister/callback tracepoints.
  • Wired ProxyEventBase::{Set,Unset}SubscriptionStateChangeHandler() to emit tracing when called.
  • Updated comtrace_config_schema.json to indicate LoLa support for the previously unimplemented tracepoints.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
score/mw/com/impl/tracing/proxy_event_tracing.h Declares new tracing functions for subscription-state tracepoints.
score/mw/com/impl/tracing/proxy_event_tracing.cpp Implements new tracepoint emitters (state changed, handler register/deregister, handler callback).
score/mw/com/impl/tracing/configuration/comtrace_config_schema.json Removes _lola_support: false markers for subscription-state tracepoints in proxy-side config sections.
score/mw/com/impl/proxy_event_base.cpp Calls tracing on subscription-state-change handler register/deregister.
Comments suppressed due to low confidence (1)

score/mw/com/impl/proxy_event_base.cpp:169

  • The new null-check only guards the trace call, but the function still unconditionally dereferences binding_base_. This is inconsistent with the check and can still crash when the binding is invalid. Also, unlike most other ProxyEventBase APIs, this method does not delegate to proxy_event_base_mock_ when a mock is injected.
    if (binding_base_ != nullptr)
    {
        tracing::TraceUnsetSubscriptionStateChangeHandler(tracing_data_, *binding_base_);
    }
    return binding_base_->UnsetSubscriptionStateChangeHandler();

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 154 to 161
Result<void> ProxyEventBase::SetSubscriptionStateChangeHandler(SubscriptionStateChangeHandler handler) noexcept
{
if (binding_base_ != nullptr)
{
tracing::TraceSetSubscriptionStateChangeHandler(tracing_data_, *binding_base_);
}
return binding_base_->SetSubscriptionStateChangeHandler(std::move(handler));
}
Comment on lines +417 to +421
void TraceSubscriptionStateChanged(ProxyEventTracingData& proxy_event_tracing_data,
const ProxyEventBindingBase& proxy_event_binding_base,
SubscriptionState new_state) noexcept
{
if (proxy_event_tracing_data.enable_subscription_state_changed)
Comment on lines +525 to +529
void TraceCallSubscriptionStateChangeHandler(ProxyEventTracingData& proxy_event_tracing_data,
const ProxyEventBindingBase& proxy_event_binding_base,
SubscriptionState new_state) noexcept
{
if (proxy_event_tracing_data.enable_call_subscription_state_change_handler)
Comment on lines +453 to +457
void TraceSetSubscriptionStateChangeHandler(ProxyEventTracingData& proxy_event_tracing_data,
const ProxyEventBindingBase& proxy_event_binding_base) noexcept
{
if (proxy_event_tracing_data.enable_set_subcription_state_change_handler)
{

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (4)

score/mw/com/impl/proxy_event_base.cpp:160

  • The null-check around tracing does not prevent dereferencing binding_base_; if binding_base_ is ever null (e.g. moved-from object), this still crashes, and the guard makes the code look safer than it is. Either assert binding_base_ is set (consistent with other methods) or return an error when it is null.
    if (binding_base_ != nullptr)
    {
        tracing::TraceSetSubscriptionStateChangeHandler(tracing_data_, *binding_base_);
    }
    return binding_base_->SetSubscriptionStateChangeHandler(std::move(handler));

score/mw/com/impl/proxy_event_base.cpp:169

  • Same as SetSubscriptionStateChangeHandler(): the tracing guard checks binding_base_ for null, but the method still unconditionally dereferences binding_base_ afterwards. Prefer an assertion (or early error return) and then trace/call the binding.
    if (binding_base_ != nullptr)
    {
        tracing::TraceUnsetSubscriptionStateChangeHandler(tracing_data_, *binding_base_);
    }
    return binding_base_->UnsetSubscriptionStateChangeHandler();

score/mw/com/impl/tracing/proxy_event_tracing.cpp:421

  • TraceSubscriptionStateChanged() and TraceCallSubscriptionStateChangeHandler() are added, but there are currently no call sites for either helper in the codebase. This means the tracepoints "trace_subscription_state_changed" and "trace_subscription_state_change_handler_callback" will still never be emitted (despite being enabled in config/schema).
void TraceSubscriptionStateChanged(ProxyEventTracingData& proxy_event_tracing_data,
                                   const ProxyEventBindingBase& proxy_event_binding_base,
                                   SubscriptionState new_state) noexcept
{
    if (proxy_event_tracing_data.enable_subscription_state_changed)

score/mw/com/impl/tracing/proxy_event_tracing.cpp:420

  • There are existing unit tests for other proxy event tracing helpers (e.g. TraceSubscribe/TraceUnsubscribe), but the newly added subscription-state trace helpers are not covered. Adding UTs would help validate the correct trace point selection (event vs field) and that the local data chunk contains the 1-byte SubscriptionState value for the *_changed and *_callback tracepoints.
void TraceSubscriptionStateChanged(ProxyEventTracingData& proxy_event_tracing_data,
                                   const ProxyEventBindingBase& proxy_event_binding_base,
                                   SubscriptionState new_state) noexcept
{

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

4 participants