Skip to content

Conversation

@Basiljamal1
Copy link

Summary

This PR aims to provide the ability to add and remove sinks from data channels at runtime. It introduces thread-safe methods for remove and add data sinks in the LogChannel class.

Impact

  • No breaking changes to the public API.
  • This update allows users to dynamically add and remove data sinks from a channel at runtime. This is especially useful for scenarios where data needs to be recorded/streamed temporarily on specific channels for short durations.

Please review the changes and provide feedback. 🙏

Copy link
Collaborator

@henrygerardmoore henrygerardmoore left a comment

Choose a reason for hiding this comment

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

This looks good to me, thank you very much for your PR! I have one minor comment and a request: could you add a simple test that demonstrates the use case you mention in this PR? It can just ensure that the functionality of adding and removing sinks while logging functions correctly, but I think it's important to ensure future changes won't impact this functionality.

Comment on lines +166 to +174
if(!_p->logging_started)
{
_p->sinks.insert(sink);
}
else
{
sink->addChannel(_p->channel_name, _p->schema);
_p->sinks.insert(sink);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if(!_p->logging_started)
{
_p->sinks.insert(sink);
}
else
{
sink->addChannel(_p->channel_name, _p->schema);
_p->sinks.insert(sink);
}
if(_p->logging_started)
{
sink->addChannel(_p->channel_name, _p->schema);
}
_p->sinks.insert(sink);

Could you also add a comment here noting that the logic is different if logging has started due to the if(!_p->logging_started) conditional code in takeSnapshot? It wasn't clear to me at first why the logic had to be different here.

@henrygerardmoore
Copy link
Collaborator

@facontidavide I think you should take a look at this PR too, in case I'm missing anything

@Basiljamal1
Copy link
Author

Sounds good, on it:)

@henrygerardmoore
Copy link
Collaborator

Sounds good, on it:)

Great, thanks! Please re-request me when you're ready for a second review 😄

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants