Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nr 350676 changing handled exceptions to send one per request #338

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

mbruin-NR
Copy link
Contributor

@mbruin-NR mbruin-NR commented Jan 8, 2025

This is the simplest patch to change handled exceptions to send one per request without rearchitecting.
We are planning to rewrite this code so this PR may not be necessary but open to input.

@mbruin-NR mbruin-NR marked this pull request as ready for review January 10, 2025 18:03

namespace NewRelic {
namespace Hex {
class HexReportContext : public HexContext {
class HexReportContext : public HexContext, public std::enable_shared_from_this<HexReportContext> {
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this line do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://en.cppreference.com/w/cpp/memory/enable_shared_from_this
The std::enable_shared_from_this is used to safely obtain a std::shared_ptr to *this. This is what enables the ability to cast it as a HexContext and send it to the publisher.

HexReportContext::finalize() uses the shared_from_this() function to create a std::shared_ptr cast as a HexContext to send to publish.

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.

3 participants